Commands to change name, schema, owner - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Commands to change name, schema, owner
Date
Msg-id Pine.LNX.4.44.0306201932560.2297-100000@peter.localdomain
Whole thread Raw
Responses Re: Commands to change name, schema, owner
Re: Commands to change name, schema, owner
List pgsql-hackers
We only have sporadic support to rename objects, change the owner of
objects, and no support to change the schema of an object.  So how about a
big bang to add support for these three operations for every object where
it is applicable?  I hope to do it without a separate parse structure and
routine for each kind of object and operation, so it can easily be
extended.

Are there any tricky problems with any of these operations?  For example,
what happens when an object you have used, say, in a view gets moved to a
schema that you don't have access to.  Bad luck?


Renaming is possible for: aggregate, constraint, conversion, database,
domain, function, group, index, language, operator, opclass, rule, schema,
sequence, table, trigger, type, user, view.

The command is: ALTER THING oldname RENAME TO newname;

Requires being the owner of the object (or superuser for group, user,
language) and CREATE privilege on containing schema.


Changing the owner is possible for: aggregate, conversion, database,
domain, function, operator, opclass, schema, sequence, table, type, view.

The command is: ALTER THING name AUTHORIZATION username;  (This is
consistent with the CREATE SCHEMA syntax.  Anyone like OWNER better?)

Requires being superuser.


Changing the schema is possible for: aggregate, conversion, domain,
function, operator, opclass, table, type, view.

The command is: ALTER THING name SCHEMA newschema;

Requires USAGE on old schema(?), owner of object, CREATE in new schema.

-- 
Peter Eisentraut   peter_e@gmx.net



pgsql-hackers by date:

Previous
From: Jason Earl
Date:
Subject: Re: Two weeks to feature freeze
Next
From: Robert Treat
Date:
Subject: Re: src/bin/scripts seems a bit of a misnomer now