From: Tom Lane <tgl@sss.pgh.pa.us>
To: psuderevsky@gmail.com
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #14700: pg_restore doesn't declare schema in 'create function' statements
Date: Fri, 09 Jun 2017 13:56:43 -0400
Message-ID: <5617.1497031003@sss.pgh.pa.us> (raw)
In-Reply-To: <20170609163144.26508.40598@wrigleys.postgresql.org>
References: <20170609163144.26508.40598@wrigleys.postgresql.org>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>
psuderevsky@gmail.com writes:
> When restoring only particular schema from dump with "pg_restore -n" it does
> the following:
> 1. SET search_path = yourschema, pg_catalog
> 2. CREATE FUNCTION yourfunction()
Yes, that's intentional.
> As a result, if you had forgotten creating yourschema before restoring then
> no objects will be restored except your functions, they will be restored in
> pg_catalog schema.
> These statements must be performed with direct schema reference: CREATE
> FUNCTION yourschema.yourfunction().
We're not doing that because it breaks other useful use-cases; in
particular, editing a dump to move things into another schema becomes
a lot harder. Even if we wanted to change pg_dump that way, it wouldn't
make things any safer for existing dump files.
There was a long discussion of whether to change anything in this area
a few years ago:
https://www.postgresql.org/message-id/flat/8c4600a6f10e7dd823a157eff9985068.squirrel%40webmail.xs4al...
That trailed off without any real consensus about what to do. Personally
I still like the idea of refusing to allow creates if the first schema
listed in search_path doesn't exist, but I was having a hard time selling
that plan :-(
regards, tom lane
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, psuderevsky@gmail.com
Subject: Re: BUG #14700: pg_restore doesn't declare schema in 'create function' statements
In-Reply-To: <5617.1497031003@sss.pgh.pa.us>
References: <20170609163144.26508.40598@wrigleys.postgresql.org> <5617.1497031003@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox