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: Fix usage of "tableoid" in GENERATED expressions.
Date: Fri, 21 May 2021 19:02:20 +0000
Message-ID: <E1lkAPc-0004Oy-B9@gemulon.postgresql.org> (raw)

Fix usage of "tableoid" in GENERATED expressions.

We consider this supported (though I've got my doubts that it's a
good idea, because tableoid is not immutable).  However, several
code paths failed to fill the field in soon enough, causing such
a GENERATED expression to see zero or the wrong value.  This
occurred when ALTER TABLE adds a new GENERATED column to a table
with existing rows, and during regular INSERT or UPDATE on a
foreign table with GENERATED columns.

Noted during investigation of a report from Vitaly Ustinov.
Back-patch to v12 where GENERATED came in.

Discussion: https://postgr.es/m/CAM_DEiWR2DPT6U4xb-Ehigozzd3n3G37ZB1+867zbsEVtYoJww@mail.gmail.com

Branch
------
REL_12_STABLE

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

Modified Files
--------------
src/backend/commands/tablecmds.c        | 13 ++++++++-----
src/backend/executor/nodeModifyTable.c  | 24 ++++++++++++++++++------
src/test/regress/expected/generated.out | 13 ++++++++-----
src/test/regress/sql/generated.sql      |  5 ++++-
4 files changed, 38 insertions(+), 17 deletions(-)



view thread (3+ messages)

Message-ID: <E1lkAPc-0004Oy-B9@gemulon.postgresql.org>
Permalink:  ../E1lkAPc-0004Oy-B9@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1lkAPc-0004Oy-B9@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: Fix usage of "tableoid" in GENERATED expressions.
  In-Reply-To: <E1lkAPc-0004Oy-B9@gemulon.postgresql.org>
  References: <E1lkAPc-0004Oy-B9@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