From: | vignesh C <vignesh21(at)gmail(dot)com> |
---|---|
To: | Shlok Kyal <shlok(dot)kyal(dot)oss(at)gmail(dot)com> |
Cc: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Peter Smith <smithpb2250(at)gmail(dot)com>, Michael Paquier <michael(at)paquier(dot)xyz>, "Shinoda, Noriyoshi (SXD Japan FSIP)" <noriyoshi(dot)shinoda(at)hpe(dot)com>, Shubham Khanna <khannashubham1197(at)gmail(dot)com>, Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>, Rajendra Kumar Dangwal <dangwalrajendra888(at)gmail(dot)com>, "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>, "euler(at)eulerto(dot)com" <euler(at)eulerto(dot)com> |
Subject: | Re: Pgoutput not capturing the generated columns |
Date: | 2025-01-16 08:49:31 |
Message-ID: | CALDaNm3GG93bSF0v8RdpF+mxm3LESh9s-ZvyAN2JKUzOFQmiLQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Wed, 15 Jan 2025 at 14:41, Shlok Kyal <shlok(dot)kyal(dot)oss(at)gmail(dot)com> wrote:
>
> I have reviewed the patch and have following comments:
>
> In file: create_publication.sgml
>
> 1.
> + <para>
> + If set to <literal>stored</literal>, the generated columns present in
> + the tables associated with publication will be replicated.
> </para>
>
> Instead of 'generated columns' we should use 'stored generated columns'
Modified
> ======
> In file: pg_publication.c
>
> 2. I feel this condition can be more specific. Since a new macro will
> be introduced for upcoming Virtual Generated columns.
>
> - if (att->attisdropped || (att->attgenerated && !include_gencols))
> + if (att->attisdropped ||
> + (att->attgenerated && (gencols_type == PUBLISH_GENCOL_NONE)))
> continue;
>
> Something like:
> if (att->attisdropped)
> continue;
> if (att->attgenerated == ATTRIBUTE_GENERATED_STORED &&
> gencols_type != PUBLISH_GENCOL_STORED)
> continue;
>
> Thoughs?
Modified
> 3. Similarly this can be updated here as well:
>
> - if (att->attisdropped || (att->attgenerated && !pub->pubgencols))
> + if (att->attisdropped ||
> + (att->attgenerated && pub->pubgencols_type == PUBLISH_GENCOL_NONE))
> continue;
Modified
> =======
> In file proto.c
>
> 4. I feel this condition should also be more specific:
>
> /* All non-generated columns are always published. */
> - return att->attgenerated ? include_gencols : true;
> + return att->attgenerated ? (gencols_type == PUBLISH_GENCOL_STORED) : true;
>
> We should return 'true' for 'gencols_type == PUBLISH_GENCOL_STORED'
> only if 'att->attgenerated = ATTRIBUTE_GENERATED_STORED'
Modified
> =======
> In file publicationcmds.c
>
> 5.
> /*
> * As we don't allow a column list with REPLICA IDENTITY FULL, the
> - * publish_generated_columns option must be set to true if the table
> - * has any stored generated columns.
> + * publish_generated_columns option must be set to 's'(stored) if the
> + * table has any stored generated columns.
> */
> - if (!pubgencols &&
> + if (gencols_type == PUBLISH_GENCOL_NONE &&
> relation->rd_att->constr &&
>
> To be consistent with the comment, I think we should check if
> 'gencols_type != PUBLISH_GENCOL_STORED' instead of 'gencols_type ==
> PUBLISH_GENCOL_NONE'.
> Thoughts?
Modified
The v52 version patch attached at [1] has the changes for the same.
[1] - https://www.postgresql.org/message-id/CALDaNm3OcXdY0EzDEKAfaK9gq2B67Mfsgxu93%2B_249ohyts%3D0g%40mail.gmail.com
Regards,
Vignesh
From | Date | Subject | |
---|---|---|---|
Next Message | vignesh C | 2025-01-16 08:51:20 | Re: Virtual generated columns |
Previous Message | vignesh C | 2025-01-16 08:47:08 | Re: Pgoutput not capturing the generated columns |