Fix usage of "tableoid" in GENERATED expressions.
Tom Lane <tgl@sss.pgh.pa.us>
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
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/commands/tablecmds.c | modified | +8 −5 |
| src/backend/executor/nodeModifyTable.c | modified | +18 −6 |
| src/test/regress/expected/generated.out | modified | +8 −5 |
| src/test/regress/sql/generated.sql | modified | +4 −1 |
Discussion
- Generated column is not updated (Postgres 13) 10 messages · 2021-05-19 → 2021-05-20