Check for USAGE privilege on types used by stored expressions. This omission allowed roles without USAGE on a type to create stored expressions that depend on it, which could prevent the owner from changing the type later.
The checks deliberately live in the command paths rather than the dependency-recording routines. Those routines also run whenever the server re-derives an existing expression, and re-checking there would break routine maintenance for an owner who has since lost USAGE on a type its objects already reference. (Checking in the dependency-recording routines would also require additional CommandCounterIncrement() calls to avoid spurious errors.) The addition of a parameter to AlterDomainAddConstraint() breaks ABI compatibility, but we are unaware of any impacted third-party code. Reported-by: Noah Misch <[email protected]> Author: Nathan Bossart <[email protected]> Reviewed-by: Noah Misch <[email protected]> Reviewed-by: Tom Lane <[email protected]> Reviewed-by: Robert Haas <[email protected]> Security: CVE-2026-6470 Backpatch-through: 14 Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/4fac4c1085ab12a811f2285b189979e844ceb670 Author: Nathan Bossart <[email protected]> Modified Files -------------- src/backend/catalog/dependency.c | 76 ++++++++++++++++++++++++++++++++ src/backend/catalog/heap.c | 22 +++++++++ src/backend/catalog/index.c | 3 ++ src/backend/catalog/pg_attrdef.c | 3 ++ src/backend/catalog/pg_constraint.c | 3 ++ src/backend/catalog/pg_proc.c | 6 +++ src/backend/catalog/pg_publication.c | 4 ++ src/backend/catalog/pg_type.c | 6 +++ src/backend/commands/indexcmds.c | 16 +++++++ src/backend/commands/policy.c | 8 ++++ src/backend/commands/propgraphcmds.c | 7 +++ src/backend/commands/statscmds.c | 5 +++ src/backend/commands/tablecmds.c | 19 +++++++- src/backend/commands/trigger.c | 5 +++ src/backend/commands/typecmds.c | 33 +++++++++++--- src/backend/parser/parse_utilcmd.c | 10 +++++ src/backend/rewrite/rewriteDefine.c | 2 + src/backend/tcop/utility.c | 3 +- src/include/catalog/dependency.h | 4 ++ src/include/commands/typecmds.h | 3 +- src/test/regress/expected/privileges.out | 46 +++++++++++++++++++ src/test/regress/sql/privileges.sql | 43 ++++++++++++++++++ 22 files changed, 318 insertions(+), 9 deletions(-)
