Re: Add pg_get_publication_ddl function

Jonathan Gonzalez V. <jonathan.abdiel@gmail.com>

From: "Jonathan Gonzalez V." <jonathan.abdiel@gmail.com>
To: pgsql-hackers@lists.postgresql.org
Date: 2026-05-17T21:27:15Z
Lists: pgsql-hackers

Attachments

Hello all!!

I'm attaching the v2 of this patch! There's a lot of changes but I'll
try to mention the biggest ones:

* Adopted the new structure following the previous committed patches of
tablespaces and databases.

* Added the options for pretty and owner, also added the statement that
will alter the publication to have the owner. I didn't know if it was
required since the CREATE PUBLICATION doesn't have a way to add the
OWNER, but since all the other functions were doing the same, I think
it's the way to do it.

* Some improvements on managing the string splits, there's really
useful functions for bitmapsets and lists so I use them to decide if we
were in the first element or not.

* I decided to use the cache instead of opening the relation with a
shared lock, I hope it was the right decision since it didn't make
sense to me to have a lock for a DDL.

* I took all the comments and check the grammar

* Even more tests were added since many corner cases were not detected
in the first version, the regress tests helped a lot on finding corner
cases

* Added the EXCEPT clause that was added after the first version.

Thank you for your reviews!

-- 
Jonathan Gonzalez V. 
EDB: https://www.enterprisedb.com