Commands to change name, schema, owner

Поиск
Список
Период
Сортировка
От Peter Eisentraut
Тема Commands to change name, schema, owner
Дата
Msg-id Pine.LNX.4.44.0306201932560.2297-100000@peter.localdomain
обсуждение исходный текст
Ответы Re: Commands to change name, schema, owner  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: Commands to change name, schema, owner  (Christopher Kings-Lynne <chriskl@familyhealth.com.au>)
Список 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 по дате отправления:

Предыдущее
От: Jason Earl
Дата:
Сообщение: Re: Two weeks to feature freeze
Следующее
От: Robert Treat
Дата:
Сообщение: Re: src/bin/scripts seems a bit of a misnomer now