postgresql/src/bin
Tom Lane 5955d93419 Improve pg_dump's handling of "special" built-in objects.
We had some pretty ad-hoc handling of the public schema and the plpgsql
extension, which are both presumed to exist in template0 but might be
modified or deleted in the database being dumped.

Up to now, by default pg_dump would emit a CREATE EXTENSION IF NOT EXISTS
command as well as a COMMENT command for plpgsql.  The usefulness of the
former is questionable, and the latter caused annoying errors in
non-superuser dump/restore scenarios.  Let's instead install a rule that
built-in extensions (identified by having low-numbered OIDs) are not to be
dumped.  We were doing it that way already in binary-upgrade mode, so this
just makes regular mode behave the same.  It remains true that if someone
has installed a non-default ACL on the plpgsql language, that will get
dumped thanks to the pg_init_privs mechanism.  This is more consistent with
the handling of built-in objects of other kinds.

Also, change the very ad-hoc mechanism that was used to avoid dumping
creation and comment commands for the public schema.  Instead of hardwiring
a test in _printTocEntry(), make use of the DUMP_COMPONENT_ infrastructure
to mark that schema up-front about what we want to do with it.  This has
the visible effect that the public schema won't be mentioned in the output
at all, except for updating its ACL if it has a non-default ACL.
Previously, while it was normally not mentioned, --clean mode would drop
and recreate it, again causing headaches for non-superuser usage.  This
change likewise makes the public schema less special and more like other
built-in objects.

If plpgsql, or the public schema, has been removed entirely in the source
DB, that situation won't be reproduced in the destination ... but that
was true before.

Discussion: https://postgr.es/m/29048.1516812451@sss.pgh.pa.us
2018-01-25 13:54:42 -05:00
..
initdb Update copyright for 2018 2018-01-02 23:30:12 -05:00
pg_archivecleanup pg_archivecleanup: Add test suite 2017-09-14 22:23:00 -04:00
pg_basebackup Update copyright for 2018 2018-01-02 23:30:12 -05:00
pg_config Update copyright for 2018 2018-01-02 23:30:12 -05:00
pg_controldata Update copyright for 2018 2018-01-02 23:30:12 -05:00
pg_ctl Support huge pages on Windows 2018-01-21 15:40:46 +01:00
pg_dump Improve pg_dump's handling of "special" built-in objects. 2018-01-25 13:54:42 -05:00
pg_resetwal Update copyright for 2018 2018-01-02 23:30:12 -05:00
pg_rewind Refactor subscription tests to use PostgresNode's wait_for_catchup 2018-01-11 13:35:38 -05:00
pg_test_fsync Make WAL segment size configurable at initdb time. 2017-09-19 22:03:48 -07:00
pg_test_timing pg_test_timing: Some NLS fixes 2017-08-26 09:25:19 -04:00
pg_upgrade Move handling of database properties from pg_dumpall into pg_dump. 2018-01-22 14:09:09 -05:00
pg_waldump Update copyright for 2018 2018-01-02 23:30:12 -05:00
pgbench pgbench: Remove accidental garbage in test file 2018-01-23 12:31:01 -05:00
pgevent Update copyright for 2018 2018-01-02 23:30:12 -05:00
psql Local partitioned indexes 2018-01-19 11:49:22 -03:00
scripts Update copyright for 2018 2018-01-02 23:30:12 -05:00
Makefile Update copyright for 2018 2018-01-02 23:30:12 -05:00