postgresql/src
Tom Lane a5a7caaa1b Fix pg_dump's handling of public schema with both -c and -C options.
Since -c plus -C requests dropping and recreating the target database
as a whole, not dropping individual objects in it, we should assume that
the public schema already exists and need not be created.  The previous
coding considered only the state of the -c option, so it would emit
"CREATE SCHEMA public" anyway, leading to an unexpected error in restore.

Back-patch to 9.2.  Older versions did not accept -c with -C so the
issue doesn't arise there.  (The logic being patched here dates to 8.0,
cf commit 2193121fa, so it's not really wrong that it didn't consider
the case at the time.)

Note that versions before 9.6 will still attempt to emit REVOKE/GRANT
on the public schema; but that happens without -c/-C too, and doesn't
seem to be the focus of this complaint.  I considered extending this
stanza to also skip the public schema's ACL, but that would be a
misfeature, as it'd break cases where users intentionally changed that
ACL.  The real fix for this aspect is Stephen Frost's work to not dump
built-in ACLs, and that's not going to get back-ported.

Per bugs #13804 and #14271.  Solution found by David Johnston and later
rediscovered by me.

Report: <20151207163520.2628.95990@wrigleys.postgresql.org>
Report: <20160801021955.1430.47434@wrigleys.postgresql.org>
2016-08-02 12:49:15 -04:00
..
backend Fix assorted fallout from IS [NOT] NULL patch. 2016-07-28 16:09:15 -04:00
bin Fix pg_dump's handling of public schema with both -c and -C options. 2016-08-02 12:49:15 -04:00
include Fix assorted fallout from IS [NOT] NULL patch. 2016-07-28 16:09:15 -04:00
interfaces Fixed array checking code for "unsigned long long" datatypes in libecpg. 2016-08-01 15:08:48 +02:00
makefiles Don't use deprecated dllwrap on Cygwin. 2014-02-01 16:13:46 -05:00
pl Make pltcl regression tests safe for Danish locale. 2016-07-21 14:24:07 -04:00
port Stamp 9.2.17. 2016-05-09 16:56:07 -04:00
template AIX: Test the -qlonglong option before use. 2015-07-17 03:02:18 -04:00
test Fix assorted fallout from IS [NOT] NULL patch. 2016-07-28 16:09:15 -04:00
timezone Sync back-branch copies of the timezone code with IANA release tzcode2016c. 2016-07-19 15:59:36 -04:00
tools Fix MSVC build for changes in zic. 2016-07-19 17:53:31 -04:00
tutorial Remove tabs after spaces in C comments 2014-05-06 11:26:27 -04:00
.gitignore Convert cvsignore to gitignore, and add .gitignore for build targets. 2010-09-22 12:57:04 +02:00
bcc32.mak Remove useless whitespace at end of lines 2010-11-23 22:34:55 +02:00
DEVELOPERS Replace a couple of references to files that no longer exist in the source 2009-05-04 08:08:47 +00:00
Makefile Fix some oversights in distprep and maintainer-clean targets. 2011-03-10 00:04:05 -05:00
Makefile.global.in Make numeric form of PG version number readily available in Makefiles. 2015-07-05 12:01:01 -04:00
Makefile.shlib Make the AIX case of Makefile.shlib safe for parallel make. 2016-07-23 20:30:55 -04:00
nls-global.mk nls-global.mk: search build dir for source files, too 2016-06-07 18:55:18 -04:00
win32.mak Remove useless whitespace at end of lines 2010-11-23 22:34:55 +02:00