HiveBrain v1.2.0
Get Started
← Back to all entries
snippetsqlMinor

How to set search_path during pg_restore?

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
duringsetsearch_pathhowpg_restore

Problem

pg_dump and pg_restore will set search_path to an empty string, which will fail if there are functions that call functions in the public schema without explicitly specifying the schema name (ie: uuid_generate_v4() vs public.uuid_generate_v4()).

How may I force pg_restore to use a specified search_path such as public?

Solution

You cannot. You will have to fix your insecure function definitions.

If you cannot do that, because you only have the dump, you can convert it to an SQL script with pg_restore -f sql_file dump_file and edit the function definitions in that SQL script.

Context

StackExchange Database Administrators Q#301857, answer score: 3

Revisions (0)

No revisions yet.