Re: Add pg_get_publication_ddl function

From: Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Add pg_get_publication_ddl function
Date: 2026-06-09 22:06:38
Message-ID: CAN4CZFPrPB+YJ4Kt+gcafr2DNK5nai+6gXm-ainKerFEe5S-SQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello!

This generates an invalid statement:

CREATE TABLE rt_ex1 (a int, b int);
CREATE TABLE rt_ex2 (a int, b int);
CREATE PUBLICATION rt_combo FOR ALL SEQUENCES, ALL TABLES EXCEPT
(TABLE rt_ex1, rt_ex2);
SELECT pg_get_publication_ddl('rt_combo');

It switches the tables/sequences order in the output: ".. FOR ALL
TABLES, ALL SEQUENCES EXCEPT .."

And if I only specify "FOR ALL SEQUENCES", it still emits WITH options
that causes a notice. The query succeeds, but maybe this could be
improved?

CREATE PUBLICATION rt_allseq FOR ALL SEQUENCES;
SELECT pg_get_publication_ddl('rt_allseq');

Outputs:

CREATE PUBLICATION rt_allseq FOR ALL SEQUENCES WITH (publish='insert,
update, delete, truncate', publish_generated_columns='none',
publish_via_partition_root='false');
-- NOTICE: publication parameters are not applicable to sequence
synchronization and will be ignored for sequences

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Chao Li 2026-06-09 23:22:42 Re: Reject negative max_retention_duration values
Previous Message Jeff Davis 2026-06-09 21:44:10 Re: Avoid orphaned objects dependencies, take 3