Re: pg_dump without setting search_path

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: pg_dump without setting search_path
Дата
Msg-id 1331174.1661396866@sss.pgh.pa.us
обсуждение исходный текст
Ответ на pg_dump without setting search_path  (gzh <gzhcoder@126.com>)
Ответы Re:Re: pg_dump without setting search_path  (gzh <gzhcoder@126.com>)
Список pgsql-general
gzh <gzhcoder@126.com> writes:
> When I use pg_dump to export schema from a database, it adds the following line at the beginning:
> SELECT pg_catalog.set_config('search_path', '', false);
> Is it possible set an option where pg_dump will not add this line?

No.  It's a security precaution.

> It is causing issues later when I try to execute other SQL commands, without the schema qualifier.

That probably means you have some user-defined functions that are
not sufficiently careful about search_path.  You want to either
schema-qualify every reference in the function body, or attach a
"SET search_path" clause to remove the function's context dependency.

(If you're using SQL-language functions in v14 or later, another
option is to use the SQL-standard syntax instead of writing the
body as a string literal.  Then the object references in the function
are parsed at definition time.)

            regards, tom lane



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

Предыдущее
От: gzh
Дата:
Сообщение: pg_dump without setting search_path
Следующее
От: gzh
Дата:
Сообщение: Re:Re: pg_dump without setting search_path