1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-23 14:01:44 +03:00

Issue CREATE SCHEMA as the originally connecting user, with an

AUTHORIZATION clause to specify the desired owner.  This allows a
superuser to restore schemas owned by users without CREATE-SCHEMA
permissions (ie, schemas originally created by a superuser using
AUTHORIZATION).  --no-owner can be specified to suppress the
AUTHORIZATION clause if need be.
This commit is contained in:
Tom Lane
2003-09-23 23:31:52 +00:00
parent 6767cebc6f
commit a9e9abebd9
2 changed files with 41 additions and 29 deletions

View File

@ -15,7 +15,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_archiver.c,v 1.76 2003/09/23 22:48:53 tgl Exp $
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_archiver.c,v 1.77 2003/09/23 23:31:52 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -2211,8 +2211,21 @@ _printTocEntry(ArchiveHandle *AH, TocEntry *te, RestoreOptions *ropt, bool isDat
(*AH->PrintExtraTocPtr) (AH, te);
ahprintf(AH, "--\n\n");
if (strlen(te->defn) > 0)
ahprintf(AH, "%s\n\n", te->defn);
/*
* 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 ...
*/
if (AH->ropt && AH->ropt->noOwner && strcmp(te->desc, "SCHEMA") == 0)
{
ahprintf(AH, "CREATE SCHEMA %s;\n\n\n", te->tag);
}
else
{
/* normal case */
if (strlen(te->defn) > 0)
ahprintf(AH, "%s\n\n", te->defn);
}
return 1;
}