pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Make new GENERATED-expressions code more bulletproof.
Date: Sun, 15 Jan 2023 19:06:51 +0000
Message-ID: <E1pH8LD-003pa9-Jr@gemulon.postgresql.org> (raw)

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_14_STABLE

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

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 | 50 +++++++++++++++++++++++++++-----
4 files changed, 51 insertions(+), 11 deletions(-)



view thread (4+ messages)  latest in thread

Message-ID: <E1pH8LD-003pa9-Jr@gemulon.postgresql.org>
Permalink:  ../E1pH8LD-003pa9-Jr@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1pH8LD-003pa9-Jr@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us
  Subject: Re: pgsql: Make new GENERATED-expressions code more bulletproof.
  In-Reply-To: <E1pH8LD-003pa9-Jr@gemulon.postgresql.org>
  References: <E1pH8LD-003pa9-Jr@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox