Re: pg_dump and schema names

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: pg_dump and schema names
Дата
Msg-id 13804.1376027323@sss.pgh.pa.us
обсуждение исходный текст
Ответ на pg_dump and schema names  (Bruce Momjian <bruce@momjian.us>)
Ответы Re: pg_dump and schema names
Список pgsql-hackers
Bruce Momjian <bruce@momjian.us> writes:
> pg_dump goes to great lengths not to hard-code the schema name into
> commands like CREATE TABLE, instead setting the search_path before
> creating the table;  these commands:

>     CREATE SCHEMA xx;
>     CREATE TABLE xx.test(x int);

> generates this output:

>     SET search_path = xx, pg_catalog;
>     CREATE TABLE test (
>         x integer
>     );

> If you dump a schema and want to reload it into another schema, you
> should only need to update that one search_path line.  However, later in
> the dump file, we hardcode the schema name for setting the object owner:

>     ALTER TABLE xx.test OWNER TO postgres;

> Could we use search_path here to avoid the schema designation?

Perhaps, but that's not likely to reduce the number of places you have to
edit, unless your dump is only one schema anyway.

The practical difficulties involved can be seen by reading the comments
and code for_getObjectDescription().
        regards, tom lane



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

Предыдущее
От: James Sewell
Дата:
Сообщение: Re: pg_dump and schema names
Следующее
От: Andres Freund
Дата:
Сообщение: Re: 9.4 regression