pgsql: Make new GENERATED-expressions code more bulletproof. - Mailing list pgsql-committers

From Tom Lane
Subject pgsql: Make new GENERATED-expressions code more bulletproof.
Date
Msg-id E1pH8LD-003pa8-JN@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Make new GENERATED-expressions code more bulletproof.

In commit 8bf6ec3ba I assumed that no code path could reach
ExecGetExtraUpdatedCols without having gone through
ExecInitStoredGenerated.  That turns out not to be the case in
logical replication: if there's an ON UPDATE trigger on the target
table, trigger.c will call this code before anybody has set up its
generated columns.  Having seen that, I don't have a lot of faith in
there not being other such paths.  ExecGetExtraUpdatedCols can call
ExecInitStoredGenerated for itself, as long as we are willing to
assume that it is only called in CMD_UPDATE operations, which on
the whole seems like a safer leap of faith.

Per report from Vitaly Davydov.

Discussion: https://postgr.es/m/d259d69652b8c2ff50e14cda3c236c7f@postgrespro.ru

Branch
------
REL_15_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/a8f7687a0b8645697b48cc40fd1a73d455d0c1fc

Modified Files
--------------
src/backend/executor/execUtils.c         |  6 ++--
src/backend/executor/nodeModifyTable.c   |  2 +-
src/include/executor/nodeModifyTable.h   |  4 +++
src/test/subscription/t/011_generated.pl | 48 +++++++++++++++++++++++++++-----
4 files changed, 50 insertions(+), 10 deletions(-)


pgsql-committers by date:

Previous
From: Tom Lane
Date:
Subject: pgsql: Make new GENERATED-expressions code more bulletproof.
Next
From: Tom Lane
Date:
Subject: pgsql: Remove arbitrary FUNC_MAX_ARGS limit in int2vectorin and oidvect