pgschema
pgschema copied to clipboard
Ownership transfer must execute under the current owner's authority
Parent: #627
Ownership preflight and emitted SQL disagree for a non-inherited role relationship.
Reproduced on PostgreSQL 15, 16, 17, and 18:
- A table is owned by
old_owner. deployercan SET ROLE toold_ownerbut does not inherit it.old_ownerhas valid authority to transfer the table tonew_owner.- Desired state changes the table owner to
new_owner.
Observed: preflight accepts the plan, but the emitted direct ALTER TABLE ... OWNER TO ... runs as deployer and fails with must be owner of table documents.
Required behavior: execute the transfer under the current owner's authority, or reject it before the first mutation with an exact authority error. Cover SET true / INHERIT false explicitly.
Tracked under #627. A proposed implementation is in #637, which is still under discussion. Closing this sub-issue since it is covered by the #627 umbrella.