Order of InvokeObjectPostAlterHook within ATExecSetNotNull
Artur Zakirov <zaartur@gmail.com>
From: Artur Zakirov <zaartur@gmail.com>
To: Postgres hackers <pgsql-hackers@lists.postgresql.org>
Date: 2026-03-18T16:21:06Z
Lists: pgsql-hackers
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/202408310358.sdhumtyuy2ht@alvherre.pgsql 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
Commits
-
SET NOT NULL: Call object-alter hook only after the catalog change
- e7975f1c06b5 19 (unreleased) landed
- 6958077ceb93 18.4 landed
-
Add pg_constraint rows for not-null constraints
- 14e87ffa5c54 18.0 cited