ALTER OBJECT any_name SET SCHEMA name

Поиск
Список
Период
Сортировка
От Dimitri Fontaine
Тема ALTER OBJECT any_name SET SCHEMA name
Дата
Msg-id m239rngzms.fsf@2ndQuadrant.fr
обсуждение исходный текст
Ответы Re: ALTER OBJECT any_name SET SCHEMA name  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Hi,

In the road to the extension patch, we already found some parts that
have to be separated into their own patch. Here's another one. It
occurred to me while implementing the pg_extension_objects() SRF that if
we can list all objects that belong to an extension, certainly we also
are able to move them to another schema.

As soon as we have that ability, we are able to provide for relocatable
extensions with the following command:

  ALTER EXTENSION ext SET SCHEMA name;
  ALTER EXTENSION ext SET SCHEMA foo TO bar;

I think that would end the open debate about search_path vs extension,
because each user would be able to relocate his local extensions easily,
wherever the main script has installed them (often enough, public).

Please find attached a work-in-progress patch (it's missing
documentation) implementing support for setting a new schema to SQL
objects of types conversion, operator, operator class, operator family,
text search parser, dictionary, template and configuration.

If there's will to apply such a patch, I'll finish it by writing the
necessary documentation for the 8 new SQL commands.

Note: CreateCommandTag() already has support for tags for ALTER TEXT
      SEARCH <OBJECT> … SET SCHEMA …, but the implementation I've not
      found, in the grammar nor in tsearchcmds.c. It's in the patch.

As usual, you can also get to the development version by using git:
  http://git.postgresql.org/gitweb?p=postgresql-extension.git;a=shortlog;h=refs/heads/set_schema

git --no-pager diff master..|diffstat
 backend/catalog/pg_namespace.c    |   38 ++++
 backend/commands/alter.c          |   32 ++++
 backend/commands/conversioncmds.c |   84 ++++++++++
 backend/commands/opclasscmds.c    |  215 +++++++++++++++++++++++++++
 backend/commands/operatorcmds.c   |   90 +++++++++++
 backend/commands/tsearchcmds.c    |  295 ++++++++++++++++++++++++++++++++++++++
 backend/parser/gram.y             |   67 ++++++++
 backend/tcop/utility.c            |   12 +
 include/catalog/pg_namespace.h    |    2
 include/commands/conversioncmds.h |    5
 include/commands/defrem.h         |   23 ++
 11 files changed, 863 insertions(+)

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


Вложения

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

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: 9.1alpha2 bundled -- please verify
Следующее
От: Tom Lane
Дата:
Сообщение: Re: ALTER OBJECT any_name SET SCHEMA name