public inbox for [email protected]
help / color / mirror / Atom feedOrder of InvokeObjectPostAlterHook within ATExecSetNotNull
2+ messages / 1 participants
[nested] [flat]
* Order of InvokeObjectPostAlterHook within ATExecSetNotNull
@ 2026-03-18 16:21 Artur Zakirov <[email protected]>
2026-03-18 16:55 ` Re: Order of InvokeObjectPostAlterHook within ATExecSetNotNull Artur Zakirov <[email protected]>
0 siblings, 1 reply; 2+ messages in thread
From: Artur Zakirov @ 2026-03-18 16:21 UTC (permalink / raw)
To: Postgres hackers <[email protected]>
Hello hackers!
The commit 14e87ff added pg_constraint rows for not-null [1]. The
consequence of the patch is that it changed the order of
InvokeObjectPostAlterHook() call and update of "attnotnull" field in
the catalog. Before the update was before the call of the hook [2].
And now "attnotnull" is updated after the call of
InvokeObjectPostAlterHook() [3].
This is a noticeable change to extensions which use
"object_access_hook" since they see a bit of stale information about
the attribute.
Is this an intended behavior or rather a bug?
1 - https://postgr.es/m/[email protected]
2 - https://github.com/postgres/postgres/blob/REL_17_9/src/backend/commands/tablecmds.c#L7818
3 - https://github.com/postgres/postgres/blob/REL_18_1/src/backend/commands/tablecmds.c#L8043-L8047
--
Kind regards,
Artur
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: Order of InvokeObjectPostAlterHook within ATExecSetNotNull
2026-03-18 16:21 Order of InvokeObjectPostAlterHook within ATExecSetNotNull Artur Zakirov <[email protected]>
@ 2026-03-18 16:55 ` Artur Zakirov <[email protected]>
0 siblings, 0 replies; 2+ messages in thread
From: Artur Zakirov @ 2026-03-18 16:55 UTC (permalink / raw)
To: Álvaro Herrera <[email protected]>; +Cc: Postgres hackers <[email protected]>
On Wed, 18 Mar 2026 at 17:34, Álvaro Herrera <[email protected]> wrote:
> >
> > Is this an intended behavior or rather a bug?
>
> This was not intentional. Want to submit a patch?
>
> --
> Álvaro Herrera 48°01'N 7°57'E — https://www.EnterpriseDB.com/
Thank you for the quick response. Sure, I attached the patch for the
main branch and for REL_18_STABLE just in case, although the main
patch also should apply to REL_18_STABLE.
I think we might need to backpatch it to PG 18 too where the change
was introduced.
--
Kind regards,
Artur
Attachments:
[application/octet-stream] object_access_hook_attnotnull_order_18.patch (786B, 2-object_access_hook_attnotnull_order_18.patch)
download | inline diff:
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index dd2b4a51076..9b0aad95a0a 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -8050,12 +8050,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.
*/
[application/octet-stream] object_access_hook_attnotnull_order.patch (786B, 3-object_access_hook_attnotnull_order.patch)
download | inline diff:
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index 67e42e5df29..a5ac38578f6 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -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.
*/
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2026-03-18 16:55 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-03-18 16:21 Order of InvokeObjectPostAlterHook within ATExecSetNotNull Artur Zakirov <[email protected]>
2026-03-18 16:55 ` Artur Zakirov <[email protected]>
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox