]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Fix usage of "tableoid" in GENERATED expressions.
authorTom Lane <tgl@sss.pgh.pa.us>
Fri, 21 May 2021 19:02:07 +0000 (15:02 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Fri, 21 May 2021 19:02:07 +0000 (15:02 -0400)
commit77e3204ecbf15ab5dfd295bbc66eeeec4d9ade19
treed05a40262c896f41b3cc33712a002e54835b5c96
parentd18ee6f92d9a22b4fae57f515797b2196bf385c7
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
src/backend/commands/tablecmds.c
src/backend/executor/nodeModifyTable.c
src/test/regress/expected/generated.out
src/test/regress/sql/generated.sql