Re: Pgoutput not capturing the generated columns
vignesh C <vignesh21@gmail.com>
Attachments
- v41-0003-Tap-tests-for-generated-columns.patch (text/x-patch) patch v41-0003
- v41-0002-DOCS-Generated-Column-Replication.patch (text/x-patch) patch v41-0002
- v41-0001-Enable-support-for-publish_generated_columns-opt.patch (text/x-patch) patch v41-0001
On Wed, 23 Oct 2024 at 11:51, Amit Kapila <amit.kapila16@gmail.com> wrote: > > On Tue, Oct 22, 2024 at 9:42 PM Masahiko Sawada <sawada.mshk@gmail.com> wrote: > > > > On Tue, Oct 22, 2024 at 3:50 AM Amit Kapila <amit.kapila16@gmail.com> wrote: > > > > > > > > Considering this, I feel if find this behavior buggy then we should > > > fix this separately rather than part of this patch. What do you think? > > > > Agreed. It's better to fix it separately. > > > > Thanks. One more thing that I didn't like about the patch is that it > used column_list to address the "publish_generated_columns = false" > case such that we build column_list without generated columns for the > same. The first problem is that it will add overhead to always probe > column_list during proto.c calls (for example during > logicalrep_write_attrs()), then it makes the column_list code complex > especially the handling in pgoutput_column_list_init(), and finally > this appears to be a misuse of column_list. I simplified the process into three steps: a) Iterate through the column list of publications and raise an error if there are any discrepancies in the column list. b) Examine the non-column list of publications to identify any conflicting options for publish_generated_columns, and set this option accordingly. c) Finally, verify that the columns in the column list align with the table's columns based on the publish_generated_columns option. > So, I suggest remembering this information in RelationSyncEntry and > then using it at the required places. We discussed above that > contradictory values of "publish_generated_columns" across > publications for the same relations are not accepted, so we can detect > that during get_rel_sync_entry() and give an ERROR for the same. Resolved the issue by adding a new variable, pubgencols, to determine whether the generated columns need to be published. This variable will later be utilized in logicalrep_write_tuple and logicalrep_write_attrs to replicate the generated columns to the subscriber if required. > Additional comment on the 0003 patch > +# ============================================================================= > +# Misc test. > +# > +# A "normal -> generated" replication. > +# > +# In this test case we use DROP EXPRESSION to change the subscriber generated > +# column into a normal column, then verify replication works ok. > +# ============================================================================= > > In patch 0003, why do we have the above test? This doesn't seem to be > directly related to this patch. Removed this. The attached v41 version patch has the changes for the same. Regards, Vignesh
Commits
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Doc: Generated column replication.
- 6252b1eaf82b 18.0 landed
-
Rename pubgencols_type to pubgencols in pg_publication.
- 75eb9766ec20 18.0 landed
-
Doc: Fix column name in pg_publication catalog.
- 117f9f328e0f 18.0 landed
-
Fix buildfarm failure introduced by commit e65dbc9927.
- b35434b134b1 18.0 landed
-
Change publication's publish_generated_columns option type to enum.
- e65dbc9927fb 18.0 landed
-
Fix \dRp+ output when describing publications with a lower server version.
- 991974bb4888 18.0 landed
-
Replicate generated columns when 'publish_generated_columns' is set.
- 7054186c4ebe 18.0 landed
-
Doc: Update the behavior of generated columns in Logical Replication.
- 5b0c46ea0932 18.0 landed
-
Replicate generated columns when specified in the column list.
- 745217a051a9 18.0 landed
-
Doc: Generated columns are skipped for logical replication.
- 7a089f6e6a14 17.0 cited