Re: ALTER OBJECT any_name SET SCHEMA name

Поиск
Список
Период
Сортировка
От Dimitri Fontaine
Тема Re: ALTER OBJECT any_name SET SCHEMA name
Дата
Msg-id m2wrotktku.fsf@2ndQuadrant.fr
обсуждение исходный текст
Ответ на Re: ALTER OBJECT any_name SET SCHEMA name  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Tom Lane <tgl@sss.pgh.pa.us> writes:
> Not having read the patch, but ... the idea that was in the back of
> my mind was to have a generic AlterObjectNamespace function that
> would take parameters approximately like the following:
>
>     OID of catalog containing object
>     Column number of catalog's namespace column (Anum_xxx constant)
>     OID of intended new namespace

Ah, the trick is to use the Anum_xxx, of course. I couldn't get rid of
thinking how to dynamically access by name... will have a try at that,
thanks for the idea.

> You could do a generic heap_open() on the catalog using the OID,
> and then use heap_modify_tuple to apply the namespace column update.

Thanks for pointing me to the right APIs: finding them is where the time
is mostly spent as far as I'm concerned.

> It might be nice to include the "object already exists" check here
> too, which could probably be done if in addition the column number
> of the name column were passed in.  Permission checks too, if the
> owner column number were passed in.  Etc.

Well it seems that depending on the object, sometime only superusers are
allowed to edit things, and sometime the owner too. Will add a boolean
superuser_only in the prototype.

Regards,
-- 
Dimitri Fontaine
http://2ndQuadrant.fr     PostgreSQL : Expertise, Formation et Support


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: ALTER OBJECT any_name SET SCHEMA name
Следующее
От: Dimitri Fontaine
Дата:
Сообщение: Re: ALTER OBJECT any_name SET SCHEMA name