OWNER TO on all objects - Mailing list pgsql-hackers

From Christopher Kings-Lynne
Subject OWNER TO on all objects
Date
Msg-id 40CE6736.5090207@familyhealth.com.au
Whole thread Raw
Responses Re: OWNER TO on all objects
Re: OWNER TO on all objects
Re: OWNER TO on all objects
List pgsql-hackers
Hi,

This is a preview patch - DON'T COMMIT IT TO HEAD!

What I've done in this patch is add the following:

ALTER AGGREGATE / OWNER TO
ALTER CONVERSION / OWNER TO
ALTER FUNCTION / OWNER TO
ALTER OPERATOR / OWNER TO
ALTER OPERATOR CLASS / OWNER TO
ALTER SCHEMA / OWNER TO
ALTER TYPE / OWNER TO

That means we can change the owner of all objects.

Next, I modified pg_dump to remove all SET SESSION AUTHORIZATION
commands for object creation.  (I left them in on the COPY commands).

Then I made it so that pg_dump will output an OWNER TO statement after
every object creation.

This means that pg_dump can dump a restorable dump in cases where, say,
a super user created a language, and then had their superuser privs
dropped, or when a user has created a table, but has then had their
create privileges removed.

At the moment, i'm happy with how it dumps and reloads the regression
database, and i'm working on adding tests for all OWNER TO in the
regression suite.  Full doc updates are already included.

Please review and give me feedback!  The patch is large, but not at all
complex :)

Some questions:

* Do we need the set session auth for COPY commands still?

* Are there any subtle implications of changing owners that I haven't
realised?  I know that it will affect SECURITY DEFINER for functions,
but I put that in the docs.

* Is doing this ok: ObjectIdGetDatum(typTup->typrelid)

* Is there any reason there is no RENAME TO command for operators?

Chris


Attachment

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Passing typmod to cast functions (for int-to-bit casting)
Next
From: Christopher Kings-Lynne
Date:
Subject: Re: Passing typmod to cast functions (for int-to-bit casting)