Re: Add pg_get_publication_ddl function

From: solai v <solai(dot)cdac(at)gmail(dot)com>
To: "Jonathan Gonzalez V(dot)" <jonathan(dot)abdiel(at)gmail(dot)com>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Add pg_get_publication_ddl function
Date: 2026-06-11 09:01:08
Message-ID: CAF0whucdCZ2s4WowrupswhF_S9rkCyjs2J5JwDwXf2teZkkHNA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi all,

On Tue, Jun 9, 2026 at 5:05 PM Jonathan Gonzalez V.
<jonathan(dot)abdiel(at)gmail(dot)com> wrote:
>
> solai v <solai(dot)cdac(at)gmail(dot)com> writes:
>
> Hello,
>
> >
> > [...] One thing I noticed is that the function currently returns
> > SETOF text, producing multiple DDL statements such as CREATE
> > PUBLICATION followed by ALTER PUBLICATION ... OWNER TO .... I wanted
> > to check whether this is the intended long-term API design, as most
> > existing pg_get_* functions return a single text value.
>
> Yes this is by design, it's documented that they will return the
> OWNER[1] unless that publications doesn't intend to have an OWNER in the
> DDL.
>
> > I also noticed
> > that publication options are emitted as quoted values, for example:
> >
> > publish='insert, update'
> > publish_generated_columns='none'
> > publish_via_partition_root='false'
> >
> > Would it make sense to emit enum-like and boolean values in their
> > native SQL form instead, such as:
> >
> > publish = 'insert, update'
> > publish_generated_columns = none
> > publish_via_partition_root = false
>
> Yes, this was already handled by Peter Smith[1] email
>
> Regards!
>
> [1] https://www.postgresql.org/docs/19/functions-info.html#FUNCTIONS-GET-OBJECT-DDL
> [2] https://www.postgresql.org/message-id/CAHut%2BPvyd3vN_LV8ppyX6Vu7pKdBhC5M3_zHN7gdJCvz1%3DkKHQ%40mail.gmail.com
>

Thank you for the clarification and for sharing the references.
I understand that returning SETOF text with the OWNER statement is
intended and can see the formatting of publication options has been
addressed accordingly in Peter Smith's follow-up email.

Regards,
Solai

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Srinath Reddy Sadipiralla 2026-06-11 09:01:38 Re: First draft of PG 19 release notes
Previous Message Chao Li 2026-06-11 08:50:28 postgres_fdw: possible overlooked NAMEDATALEN comparison in stats import