Re: Pgoutput not capturing the generated columns

From: vignesh C <vignesh21(at)gmail(dot)com>
To: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Cc: Shubham Khanna <khannashubham1197(at)gmail(dot)com>, Peter Smith <smithpb2250(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, euler(at)eulerto(dot)com
Subject: Re: Pgoutput not capturing the generated columns
Date: 2024-11-04 15:11:55
Message-ID: CALDaNm1GoBqrCNyhvJ9Kf5oCTNvGC2s=PejcbxNidd9JvM1qBw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, 4 Nov 2024 at 16:25, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
>
> On Wed, Oct 30, 2024 at 9:46 PM vignesh C <vignesh21(at)gmail(dot)com> wrote:
> >
> ...
> + /*
> + * For non-column list publications—such as TABLE (without a column
> + * list), ALL TABLES, or ALL TABLES IN SCHEMA publications consider
> + * all columns of the table, including generated columns, based on the
> + * pubgencols option.
> + */
> + if (!cols)
> + {
> + Assert(pub->pubgencols == entry->pubgencols);
> +
> + /*
> + * Retrieve the columns if they haven't been prepared yet, or if
> + * there are multiple publications.
> + */
> + if (!relcols && (list_length(publications) > 1))
> + {
> + pgoutput_ensure_entry_cxt(data, entry);
> + relcols = pub_getallcol_bitmapset(relation, entry->pubgencols,
> + entry->entry_cxt);
> + }
> +
> + cols = relcols;
>
> Don't we need this only when generated column(s) are present, if so,
> we can get that as an input to pgoutput_column_list_init()?

We will use this in all cases i.e. irrespective of generated columns present:
ex:
CREATE TABLE t1(c1 int, c2 int);
create publication pub1 for table t1(c1);
create publication pub2 for table t1;

Create subscription ... publication pub1,pub2;

Even in this case we will have to identify that column list is not
matching and throw:
2024-11-04 20:35:58.199 IST [492190] 492190 sub1 ERROR: cannot use
different column lists for table "public.t1" in different publications

Regards,
Vignesh

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Matthias van de Meent 2024-11-04 15:13:25 Re: pg_dump --no-comments confusion
Previous Message vignesh C 2024-11-04 14:58:53 Re: Pgoutput not capturing the generated columns