pgschema icon indicating copy to clipboard operation
pgschema copied to clipboard

Ownership transfer must execute under the current owner's authority

Open Goldziher opened this issue 1 month ago • 1 comments

Parent: #627

Ownership preflight and emitted SQL disagree for a non-inherited role relationship.

Reproduced on PostgreSQL 15, 16, 17, and 18:

  1. A table is owned by old_owner.
  2. deployer can SET ROLE to old_owner but does not inherit it.
  3. old_owner has valid authority to transfer the table to new_owner.
  4. 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.

Goldziher avatar Oct 09 '26 09:10 Goldziher

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.

tianzhou avatar Oct 15 '26 03:10 tianzhou