Re: ALTER OBJECT any_name SET SCHEMA name

Поиск
Список
Период
Сортировка
От Dimitri Fontaine
Тема Re: ALTER OBJECT any_name SET SCHEMA name
Дата
Msg-id m2lj59p4hz.fsf@2ndQuadrant.fr
обсуждение исходный текст
Ответ на Re: ALTER OBJECT any_name SET SCHEMA name  (Alvaro Herrera <alvherre@commandprompt.com>)
Ответы Re: ALTER OBJECT any_name SET SCHEMA name  (Alvaro Herrera <alvherre@commandprompt.com>)
Re: ALTER OBJECT any_name SET SCHEMA name  (Alvaro Herrera <alvherre@commandprompt.com>)
Список pgsql-hackers
Alvaro Herrera <alvherre@commandprompt.com> writes:
> FWIW I think you should use getObjectDescription, as in the attached
> patch.  (Note the patch is incomplete and does not compile because only
> one caller to CheckSetNamespace has been fixed).

I had to re-add the object name to the CheckSetNamespace prototype to
handle this particular check:

    /* check for duplicate name (more friendly than unique-index failure) */
    if (SearchSysCacheExists2(TYPENAMENSP,
                              CStringGetDatum(name),
                              ObjectIdGetDatum(nspOid)))

If you know how to get some struct attribute given a char * holding its
name, in C, I would adapt the patch and work on the refactoring asked
for by Tom.

Apart from that, it was just about adapting the call sites, which is
done in the attached set_schema.5.patch. Thanks!

Also attached, please find the complete version of ALTER EXTENSION ext
SET SCHEMA name; with support for all contrib extensions. That's the
example that allows to see the API (AlterFooNamespace_oid and _internal
functions) in action: that should help devising the best refactoring.

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


Вложения

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Alter column to type serial
Следующее
От: Thom Brown
Дата:
Сообщение: Re: Alter column to type serial