Re: Pgoutput not capturing the generated columns

From: Peter Smith <smithpb2250(at)gmail(dot)com>
To: vignesh C <vignesh21(at)gmail(dot)com>
Cc: Amit Kapila <amit(dot)kapila16(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-17 01:53:06
Message-ID: CAHut+PuykmXF57T9AcBnsVqQEddmpBeHZvnGdJt=byYozXAcSg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Vignesh.

Some review comments for v52-0001.

======
Commit message

1.
I guess the root cause is that in PG18 we decided to put the
"Generated columns" column to the left of the "Via Root" column
instead of to the right, and in doing so introduced a mistake ordering
the code.

The commit message can say that a bit more plainly -- e.g. you can
name those columns 'pubgencols' and 'pubviaroot' explicitly instead of
just referring to "the newly added column".

======
src/bin/psql/describe.c

describePublications:

2.
if (has_pubgencols)
- printTableAddCell(&cont, PQgetvalue(res, i, 8), false, false);
- if (has_pubviaroot)
printTableAddCell(&cont, PQgetvalue(res, i, 9), false, false);
+ if (has_pubviaroot)
+ printTableAddCell(&cont, PQgetvalue(res, i, 8), false, false);

It seems a bit tricky for the code to just have the PQgetvalue
hardwired indexes (8,9) reversed like that. I think at least this
reversal needs a comment to explain why it is done that way, so nobody
in future is tempted to change it and accidentally re-break this.

Maybe also, consider adding variables for those PQgetvalue indexes.
Maybe, something like this can work?

pubviaroot_idx = ncols;
pubgencols_idx = ncols + 1;

======
Kind Regards,
Peter Smith.
Fujitsu Australia

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2025-01-17 02:04:03 Re: An improvement of ProcessTwoPhaseBuffer logic
Previous Message Masahiko Sawada 2025-01-17 01:06:14 Re: Parallel heap vacuum