10

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? It is causing issues later when I try to execute other SQL commands, without the schema qualifier.

This is the pg_dump command I am using right now:

pg_dump -O -x -h <db-host> -p <db-port> -U <db-user> -d <db-name> --schema public --schema-only > public-schema.sql
Laurenz Albe
  • 209,280
  • 17
  • 206
  • 263
Shahidh
  • 2,472
  • 1
  • 18
  • 18
  • 10
    If, like me, you found this page while searching for the *reason* pg_dump does this, [here is the answer](https://www.postgresql.org/message-id/ace62b19-f918-3579-3633-b9e19da8b9de%40aklaver.com). – Wildcard Dec 19 '18 at 03:23

1 Answers1

1

No, there is no such option.

I recommend that you restore a dump with psql -f dumpfile rather than using \i to execute it in the current session.

Laurenz Albe
  • 209,280
  • 17
  • 206
  • 263