summaryrefslogtreecommitdiff
path: root/src/bin/pg_dump/pg_backup_archiver.c
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>2004-07-19 21:39:48 +0000
committerBruce Momjian <bruce@momjian.us>2004-07-19 21:39:48 +0000
commit45995219a015b841d48dff2b3920b03edcd35d06 (patch)
tree7ede40c8e4e43b4a7bcce09a92fab7b16b3ec1e4 /src/bin/pg_dump/pg_backup_archiver.c
parent465edca3ecfb8f1750adda9731820286c109973b (diff)
Here is another patch that fixes a stack of pg_dump bugs:
* Fix help text ordering * Add back --set-session-authorization to pg_dumpall. Updated the docs for that. Updated help for that. * Dump ALTER USER commands for the cluster owner ("pgsql"). These are dumped AFTER the create user and create database commands in case the permissions to do these have been revoked. * Dump ALTER OWNER for public schema (because it's possible to change it). This was done by adding TOC entries for the public schema, and filtering them out at archiver time. I also save the owner in the TOC entry just for the public schema. * Suppress dumping single quotes around schema_path and DateStyle options when they are set using ALTER USER or ALTER DATABASE. Added a comment to the steps in guc.c to remind people to update that list. * Fix dumping in --clean mode against a pre-7.3 server. It just sets all drop statements to assume the public schema, allowing it to restore without error. * Cleaned up text output. eg. Don't output -- Tablespaces comment if there are none. Same for groups and users. * Make the commands to DELETE FROM pg_shadow and DELETE FROM pg_group only be output when -c mode is enabled. I'm not sure why that hasn't been done before?!?! This should be good for application asap, after which I will start on regression dumping 7.0-7.4 databases. Christopher Kings-Lynne
Diffstat (limited to 'src/bin/pg_dump/pg_backup_archiver.c')
-rw-r--r--src/bin/pg_dump/pg_backup_archiver.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/src/bin/pg_dump/pg_backup_archiver.c b/src/bin/pg_dump/pg_backup_archiver.c
index 5515f98db39..939baf86ec9 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.89 2004/07/19 21:02:17 tgl Exp $
+ * $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_archiver.c,v 1.90 2004/07/19 21:39:47 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -2356,7 +2356,8 @@ _printTocEntry(ArchiveHandle *AH, TocEntry *te, RestoreOptions *ropt, bool isDat
strcmp(te->desc, "TABLE") == 0 ||
strcmp(te->desc, "TYPE") == 0 ||
strcmp(te->desc, "VIEW") == 0 ||
- strcmp(te->desc, "SEQUENCE") == 0
+ strcmp(te->desc, "SEQUENCE") == 0 ||
+ (strcmp(te->desc, "SCHEMA") == 0 && strcmp(te->tag, "public") == 0) /* Only public schema */
))
{
char *temp = _getObjectFromDropStmt(te->dropStmt, te->desc);
@@ -2376,15 +2377,18 @@ _printTocEntry(ArchiveHandle *AH, TocEntry *te, RestoreOptions *ropt, bool isDat
/*
* Really crude hack for suppressing AUTHORIZATION clause of CREATE SCHEMA
* when --no-owner mode is selected. This is ugly, but I see no other
- * good way ...
+ * good way ... Also, avoid dumping the public schema as it will already be
+ * created.
*/
- if (AH->ropt && AH->ropt->noOwner && strcmp(te->desc, "SCHEMA") == 0)
- {
- ahprintf(AH, "CREATE SCHEMA %s;\n\n\n", te->tag);
- }
- else
- {
- ahprintf(AH, "%s\n\n", te->defn);
+ if (strcmp(te->tag, "public") != 0) {
+ if (AH->ropt && AH->ropt->noOwner && strcmp(te->desc, "SCHEMA") == 0)
+ {
+ ahprintf(AH, "CREATE SCHEMA %s;\n\n\n", te->tag);
+ }
+ else
+ {
+ ahprintf(AH, "%s\n\n", te->defn);
+ }
}
}
else if (isData) {