mirror of
https://github.com/postgres/postgres.git
synced 2026-07-14 12:20:52 -04:00
SET NOT NULL: Call object-alter hook only after the catalog change
... otherwise, the function invoked by the hook might consult the
catalog and not see that the new constraint exists.
This relies on set_attnotnull doing CommandCounterIncrement()
after successfully modifying the catalog.
Oversight in commit 14e87ffa5c.
Author: Artur Zakirov <zaartur@gmail.com>
Backpatch-through: 18
Discussion: https://postgr.es/m/CAKNkYnxUPCJk-3Xe0A3rmCC8B8V8kqVJbYMVN6ySGpjs_qd7dQ@mail.gmail.com
This commit is contained in:
parent
12444183e4
commit
e7975f1c06
1 changed files with 3 additions and 3 deletions
|
|
@ -8137,12 +8137,12 @@ ATExecSetNotNull(List **wqueue, Relation rel, char *conName, char *colName,
|
|||
ccon = linitial(cooked);
|
||||
ObjectAddressSet(address, ConstraintRelationId, ccon->conoid);
|
||||
|
||||
InvokeObjectPostAlterHook(RelationRelationId,
|
||||
RelationGetRelid(rel), attnum);
|
||||
|
||||
/* Mark pg_attribute.attnotnull for the column and queue validation */
|
||||
set_attnotnull(wqueue, rel, attnum, true, true);
|
||||
|
||||
InvokeObjectPostAlterHook(RelationRelationId,
|
||||
RelationGetRelid(rel), attnum);
|
||||
|
||||
/*
|
||||
* Recurse to propagate the constraint to children that don't have one.
|
||||
*/
|
||||
|
|
|
|||
Loading…
Reference in a new issue