aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2008-01-14 19:27:41 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2008-01-14 19:27:41 +0000
commitea00ab8d64ae21bf1fc64cc6e362102d15f7cda7 (patch)
tree8372b441361427c19c5a186ce403746789eb6979
parent98c0ebca808aa5aa2dc5ff260cb677ac6ee25439 (diff)
downloadpostgresql-ea00ab8d64ae21bf1fc64cc6e362102d15f7cda7.tar.gz
postgresql-ea00ab8d64ae21bf1fc64cc6e362102d15f7cda7.zip
Prevent pg_dump from dumping the comment (if any) on the 'public' schema.
This is to avoid uselessly requiring superuser permissions to restore the dump without errors. Pretty grotty, but no better alternative seems available, at least not in the near term.
-rw-r--r--src/bin/pg_dump/pg_backup_archiver.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/bin/pg_dump/pg_backup_archiver.c b/src/bin/pg_dump/pg_backup_archiver.c
index a6364074310..af44e852513 100644
--- a/src/bin/pg_dump/pg_backup_archiver.c
+++ b/src/bin/pg_dump/pg_backup_archiver.c
@@ -15,7 +15,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_archiver.c,v 1.151 2007/11/24 20:26:49 tgl Exp $
+ * $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_archiver.c,v 1.152 2008/01/14 19:27:41 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -2528,11 +2528,17 @@ _printTocEntry(ArchiveHandle *AH, TocEntry *te, RestoreOptions *ropt, bool isDat
/*
* Avoid dumping the public schema, as it will already be created ...
* unless we are using --clean mode, in which case it's been deleted and
- * we'd better recreate it.
+ * we'd better recreate it. Likewise for its comment, if any.
*/
- if (!ropt->dropSchema &&
- strcmp(te->desc, "SCHEMA") == 0 && strcmp(te->tag, "public") == 0)
- return;
+ if (!ropt->dropSchema)
+ {
+ if (strcmp(te->desc, "SCHEMA") == 0 &&
+ strcmp(te->tag, "public") == 0)
+ return;
+ if (strcmp(te->desc, "COMMENT") == 0 &&
+ strcmp(te->tag, "SCHEMA public") == 0)
+ return;
+ }
/* Select owner, schema, and tablespace as necessary */
_becomeOwner(AH, te);