SET NOT NULL: Call object-alter hook only after the catalog change

Álvaro Herrera <alvherre@kurilemu.de>

Commit: e7975f1c06b585dcda645c6047e6f37cdfacce84
Author: Álvaro Herrera <alvherre@kurilemu.de>
Date: 2026-03-20T13:38:50Z
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 14e87ffa5c54.

Author: Artur Zakirov <zaartur@gmail.com>
Backpatch-through: 18
Discussion: https://postgr.es/m/CAKNkYnxUPCJk-3Xe0A3rmCC8B8V8kqVJbYMVN6ySGpjs_qd7dQ@mail.gmail.com

Files

PathChange+/−
src/backend/commands/tablecmds.c modified +3 −3

Discussion