Adjust permissions checking for ALTER OWNER commands: instead of
Tom Lane <tgl@sss.pgh.pa.us>
Adjust permissions checking for ALTER OWNER commands: instead of requiring superuserness always, allow an owner to reassign ownership to any role he is a member of, if that role would have the right to create a similar object. These three requirements essentially state that the would-be alterer has enough privilege to DROP the existing object and then re-CREATE it as the new role; so we might as well let him do it in one step. The ALTER TABLESPACE case is a bit squirrely, but the whole concept of non-superuser tablespace owners is pretty dubious anyway. Stephen Frost, code review by Tom Lane.
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/commands/aggregatecmds.c | modified | +16 −6 |
| src/backend/commands/conversioncmds.c | modified | +17 −8 |
| src/backend/commands/dbcommands.c | modified | +32 −21 |
| src/backend/commands/functioncmds.c | modified | +16 −6 |
| src/backend/commands/opclasscmds.c | modified | +16 −6 |
| src/backend/commands/operatorcmds.c | modified | +16 −6 |
| src/backend/commands/schemacmds.c | modified | +44 −36 |
| src/backend/commands/tablecmds.c | modified | +17 −6 |
| src/backend/commands/tablespace.c | modified | +18 −6 |
| src/backend/commands/typecmds.c | modified | +16 −6 |
| src/backend/utils/adt/acl.c | modified | +19 −1 |
| src/include/utils/acl.h | modified | +2 −1 |