pgsql: Need to do CommandCounterIncrement after StoreAttrMissingVal.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Need to do CommandCounterIncrement after StoreAttrMissingVal.
Date: 2025-04-02 15:13:18
Message-ID: E1tzzmI-002JQk-0i@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Need to do CommandCounterIncrement after StoreAttrMissingVal.

Without this, an additional change to the same pg_attribute row
within the same command will fail. This is possible at least with
ALTER TABLE ADD COLUMN on a multiple-inheritance-pathway structure.
(Another potential hazard is that immediately-following operations
might not see the missingval.)

Introduced by 95f650674, which split the former coding that
used a single pg_attribute update to change both atthasdef and
atthasmissing/attmissingval into two updates, but missed that
this should entail two CommandCounterIncrements as well. Like
that fix, back-patch through v13.

Reported-by: Alexander Lakhin <exclusion(at)gmail(dot)com>
Author: Tender Wang <tndrwang(at)gmail(dot)com>
Reviewed-by: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Discussion: https://postgr.es/m/025a3ffa-5eff-4a88-97fb-8f583b015965@gmail.com
Backpatch-through: 13

Branch
------
REL_14_STABLE

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

Modified Files
--------------
src/backend/commands/tablecmds.c | 2 ++
src/test/regress/expected/inherit.out | 15 ++++++++++++++-
src/test/regress/sql/inherit.sql | 3 ++-
3 files changed, 18 insertions(+), 2 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tomas Vondra 2025-04-02 15:16:37 pgsql: Improve accounting for PredXactList, RWConflictPool and PGPROC
Previous Message Heikki Linnakangas 2025-04-02 13:43:17 pgsql: docs: Add a new section and a table listing protocol versions