Re: Virtual generated columns - Mailing list pgsql-hackers

From Dean Rasheed
Subject Re: Virtual generated columns
Date
Msg-id CAEZATCXT6VO8Q3NBYMHr3YhiRzF=kmgvj41xU3qQOiNmzF7jTQ@mail.gmail.com
Whole thread Raw
In response to Virtual generated columns  (Peter Eisentraut <peter@eisentraut.org>)
Responses Re: Virtual generated columns
List pgsql-hackers
On Tue, 5 Nov 2024 at 16:17, Peter Eisentraut <peter@eisentraut.org> wrote:
>
> New patch version.

In expand_generated_columns_in_expr():

+        /*
+         * XXX For the benefit of triggers, make two passes, so it covers
+         * PRS2_OLD_VARNO and PRS2_NEW_VARNO.
+         */
+        node = expand_generated_columns_internal(node, rel, 1, rte);
+        node = expand_generated_columns_internal(node, rel, 2, rte);

It seems a bit messy to be doing these two passes in
expand_generated_columns_in_expr(), when it is only needed for
triggers. I think it was better the way it was in the v7 patch,
passing rt_index to expand_generated_columns_in_expr(), so that
TriggerEnabled() did this:

+            tgqual = (Node *)
expand_generated_columns_in_expr(tgqual, relinfo->ri_RelationDesc,
PRS2_OLD_VARNO);
+            tgqual = (Node *)
expand_generated_columns_in_expr(tgqual, relinfo->ri_RelationDesc,
PRS2_NEW_VARNO);

Regards,
Dean



pgsql-hackers by date:

Previous
From: Amit Kapila
Date:
Subject: Re: Pgoutput not capturing the generated columns
Next
From: Amit Kapila
Date:
Subject: Re: Pgoutput not capturing the generated columns