pgsql: Make new GENERATED-expressions code more bulletproof.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Make new GENERATED-expressions code more bulletproof.
Date: 2023-01-15 18:15:11
Message-ID: E1pH7XD-003pEE-EX@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/3f244d020fbf0b4f01d71e1b7620930be4bf9dc5

Modified Files
--------------
src/backend/executor/execUtils.c | 13 +++------
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(+), 17 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2023-01-15 19:06:51 pgsql: Make new GENERATED-expressions code more bulletproof.
Previous Message David G. Johnston 2023-01-15 02:19:21 Re: pgsql: Add new GUC createrole_self_grant.