Open
Conversation
This new SQL-callable function returns the `CREATE SUBSCRIPTION` statement for a given subscription name. Like `pg_dump`, the returned DDL explicitly sets `connect = false`. This is because the original `CONNECT` option value is not cataloged, and using `connect = false` ensures the DDL can be successfully executed even if the remote publisher is unreachable. By default, the function is restricted to superusers. This is a security measure because subscription connection strings often contain sensitive information, such as passwords. EXECUTE permission can be granted to other users as needed. Author: Vaibhav Dalvi <vaibhav.dalvi@enterprisedb.com> Discussion: https://www.postgresql.org/message-id/945db7c5-be75-45bf-b55b-cb1e56f2e3e9@dunslane.net
Owner
Author
|
@alvherre , Could you please review this PR. |
ibarwick
reviewed
Oct 3, 2025
ibarwick
reviewed
Oct 3, 2025
ibarwick
reviewed
Oct 3, 2025
akshay-joshi
suggested changes
Oct 3, 2025
akshay-joshi
left a comment
There was a problem hiding this comment.
There are 2 new parameters, retain_dead_tuples and max_retention_duration. I am not sure whether we need to add those to the DDL or not.
- use appendStringInfoString() - use OID > 8000 - Add missed two options
gonzalemario
reviewed
Oct 7, 2025
gonzalemario
reviewed
Oct 7, 2025
| datum = SysCacheGetAttrNotNull(SUBSCRIPTIONOID, tup, | ||
| Anum_pg_subscription_subpublications); | ||
| publist = textarray_to_stringlist(DatumGetArrayTypeP(datum)); | ||
| GetPublicationsStr(publist, pubnames, false); |
There was a problem hiding this comment.
Should pubnames be passed by reference?
drpalaric
reviewed
Oct 7, 2025
- Allow users to access this function those have pg_create_subscription and pg_read_all_data permission - Don't omit default value because it may change in future Author: Vaibhav Dalvi <vaibhav.dalvi@enterprisedb.com> Reviewed-by: Nishant Sharma, Reviewed-by: Ian Barwick Reviewed-by: Akshay Joshi Reviewed-by: Phil Alger Discussion: https://www.postgresql.org/message-id/945db7c5-be75-45bf-b55b-cb1e56f2e3e9@dunslane.net
The error ""wal_level" is insufficient to create the replication slot required by retain_dead_tuples" was there due to true "retain_dead_tuples". Set to false. Vaibhav Dalvi
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This new SQL-callable function returns the
CREATE SUBSCRIPTIONstatement for a given subscription name.Like
pg_dump, the returned DDL explicitly setsconnect = false. This is because the originalCONNECToption value is not cataloged, and usingconnect = falseensures the DDL can be successfully executed even if the remote publisher is unreachable.By default, the function is restricted to superusers. This is a security measure because subscription connection strings often contain sensitive information, such as passwords. EXECUTE permission can be granted to other users as needed.
Author: Vaibhav Dalvi vaibhav.dalvi@enterprisedb.com
Discussion: https://www.postgresql.org/message-id/945db7c5-be75-45bf-b55b-cb1e56f2e3e9@dunslane.net