From: Tom Lane Date: Mon, 14 Jan 2008 19:27:41 +0000 (+0000) Subject: Prevent pg_dump from dumping the comment (if any) on the 'public' schema. X-Git-Url: http://git.postgresql.org/gitweb/static/gitweb.js?a=commitdiff_plain;h=106f786a2f1807c59f1edea592a2cf33bd24e26c;p=users%2Fbernd%2Fpostgres.git 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. --- diff --git a/src/bin/pg_dump/pg_backup_archiver.c b/src/bin/pg_dump/pg_backup_archiver.c index b75ba77694..a4b442e370 100644 --- a/src/bin/pg_dump/pg_backup_archiver.c +++ b/src/bin/pg_dump/pg_backup_archiver.c @@ -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);