From: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> |
---|---|
To: | Peter Smith <smithpb2250(at)gmail(dot)com> |
Cc: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: DOCS - create publication (tweak for generated columns) |
Date: | 2025-04-23 00:33:09 |
Message-ID: | CAKFQuwaOPO208wruEJdUBt-tTCkKJJKkkdVf+q1nNp7-wxFrhA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Tuesday, April 22, 2025, Peter Smith <smithpb2250(at)gmail(dot)com> wrote:
> Hi,
>
> While re-reading documentation about logical replication of generated
> columns, I came across this paragraph in the CREATE PUBLICATION ...
> FOR TABLE description [1].
>
> ----
> When a column list is specified, only the named columns are
> replicated. The column list can contain stored generated columns as
> well. If no column list is specified, all table columns (except
> generated columns) are replicated through this publication, including
> any columns added later. It has no effect on TRUNCATE commands. See
> Section 29.5 for details about column lists.
> ----
>
> That "except generated columns" part is not strictly correct because
> it fails to account for the 'publish_generated_columns' parameter.
> I've suggested a more accurate description below.
>
>
> SUGGESTION
> ----
> When a column list is specified, only the named columns are
> replicated. Stored generated columns may be included in the list.
> Specifying a column list has no effect on TRUNCATE commands. See
> Section 29.5 for details about column lists. If no column list is
> specified, all table columns are replicated through this publication,
> including any columns added later. Generated columns are included in
> this case only if publish_generated_columns is set to stored.
> ----
>
> I've attached a patch to implement this suggested wording.
>
> Thoughts?
>
> ======
> [1] https://www.postgresql.org/docs/devel/sql-createpublication.html#SQL-
> CREATEPUBLICATION-PARAMS-FOR-TABLE
>
In the column list I would stick to mentioning what cannot be specified,
since it would be assumed by default that any column on the table is fair
game. I believe that means not mentioning stored generated and instead
mentioning virtual generated. It really seems odds mentioning stored
generated being allowed before mentioning when they are optional, default
excluded.
Alternative:
The optional column list may include any non-virtual columns of the table.
If omitted, tables publish all (including future) non-generated columns by
default, and may publish stored generated columns if the publication option
publish_generated_columns is set to stored. See Section 29.5 for details
about column lists.
I don’t get why truncate is mentioned here. I omitted it intentionally.
David J.
From | Date | Subject | |
---|---|---|---|
Next Message | David G. Johnston | 2025-04-23 00:41:05 | Re: Allow database owners to CREATE EVENT TRIGGER |
Previous Message | Steve Chavez | 2025-04-23 00:18:39 | Re: Allow database owners to CREATE EVENT TRIGGER |