Re: Virtual generated columns - Mailing list pgsql-hackers

From Dean Rasheed
Subject Re: Virtual generated columns
Date
Msg-id CAEZATCX6SHevKrVfAOq+88b4Ysm4Rqq2yeO6He3N0pttEbjYag@mail.gmail.com
Whole thread Raw
In response to Virtual generated columns  (Peter Eisentraut <peter@eisentraut.org>)
List pgsql-hackers
On Mon, 27 Jan 2025 at 09:59, Peter Eisentraut <peter@eisentraut.org> wrote:
>
> Here is an updated patch that integrates the above changes and also
> makes some adjustments now that the logical replication configuration
> questions are resolved.  I think this is complete now.
>

In struct ResultRelInfo, the following field is added:

    int         ri_NumGeneratedNeededI;
    int         ri_NumGeneratedNeededU;

+   /* true if the above have been computed */
+   bool        ri_Generated_valid;
+

but that doesn't really seem to be accurate, because it's set to true
by ExecInitGenerated() whether it's called with CMD_INSERT or
CMD_UPDATE, so it will be true before both the other fields are
computed. It's used from ExecGetExtraUpdatedCols() as an indicator
that ri_extraUpdatedCols is valid, but it looks like that might not be
the case, if ExecInitGenerated() was only called with CMD_INSERT.

I'm not sure if that represents an actual bug, but it looks wrong. It
should perhaps be called "ri_extraUpdatedCols_valid", and only set to
true when ExecInitGenerated() is called with CMD_UPDATE, and
ri_extraUpdatedCols is populated.

Regards,
Dean



pgsql-hackers by date:

Previous
From: Tatsuo Ishii
Date:
Subject: Re: Add RESPECT/IGNORE NULLS and FROM FIRST/LAST options
Next
From: Nitin Jadhav
Date:
Subject: Back patch of Remove durable_rename_excl()