[PATCH] Add pg_get_subscription_ddl() function

From: Vaibhav Dalvi <vaibhav(dot)dalvi(at)enterprisedb(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Cc: Vaibhav Dalvi <vaibhav(dot)dalvi(at)enterprisedb(dot)com>
Subject: [PATCH] Add pg_get_subscription_ddl() function
Date: 2025-10-31 10:57:15
Message-ID: CA+vB=AGG0NoxWW=-947RBmba8Pzhj8j7op0Xkv8nLDzVMc2=7w@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Hackers,

I am submitting a patch as a part of a larger Retail DDL functions
project described by Andrew Dunstan here
<https://www.postgresql.org/message-id/945db7c5-be75-45bf-b55b-cb1e56f2e3e9%40dunslane.net>
. This patch creates a
function pg_get_subscription_ddl, designed to retrieve the full DDL
statement for a subscription. Users can obtain the DDL by providing
the subscription name, like so:

SELECT pg_get_subscription_ddl('testsub1');

pg_get_subscription_ddl

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
CREATE SUBSCRIPTION testsub1 CONNECTION 'dbname=db_doesnotexist'
PUBLICATION "testpub1" WITH (connect = false, slot_name = 'testsub1',
enabled = false, binary = false, streaming = parallel, synchronous_commit =
off, two_phase = off, disable_on_error = off, password_required = on,
run_as_owner = off, origin = any, failover = off, retain_dead_tuples = off,
max_retention_duration = 0);
(1 row)

This patch includes documentation, comments, and regression tests.

Regards,
Vaibhav Dalvi
EnterpriseDB

Attachment Content-Type Size
v1-Add-pg_get_subscription_ddl-function.patch application/octet-stream 25.4 KB

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2025-10-31 11:02:10 Re: abi-compliance-check failure due to recent changes to pg_{clear,restore}_{attribute,relation}_stats()
Previous Message Alexander Borisov 2025-10-31 10:44:50 Re: Improve the performance of Unicode Normalization Forms.