More clearly document in pg_dump when we are dealing with an object name
as it appears in the schema dump, and index tags.
This commit is contained in:
parent
68d9fbeb55
commit
d59478c4f3
@ -15,7 +15,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup.h,v 1.19 2002/05/10 22:36:26 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup.h,v 1.20 2002/07/04 15:35:07 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -133,7 +133,7 @@ PGconn *ConnectDatabase(Archive *AH,
|
||||
|
||||
|
||||
/* Called to add a TOC entry */
|
||||
extern void ArchiveEntry(Archive *AHX, const char *oid, const char *name,
|
||||
extern void ArchiveEntry(Archive *AHX, const char *oid, const char *tag,
|
||||
const char *namespace, const char *owner,
|
||||
const char *desc, const char *((*deps)[]),
|
||||
const char *defn, const char *dropStmt,
|
||||
|
@ -15,7 +15,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_archiver.c,v 1.51 2002/07/04 03:04:54 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_archiver.c,v 1.52 2002/07/04 15:35:07 momjian Exp $
|
||||
*
|
||||
* Modifications - 28-Jun-2000 - pjw@rhyme.com.au
|
||||
*
|
||||
@ -266,7 +266,7 @@ RestoreArchive(Archive *AHX, RestoreOptions *ropt)
|
||||
if (((reqs & REQ_SCHEMA) != 0) && te->dropStmt)
|
||||
{
|
||||
/* We want the schema */
|
||||
ahlog(AH, 1, "dropping %s %s\n", te->desc, te->name);
|
||||
ahlog(AH, 1, "dropping %s %s\n", te->desc, te->tag);
|
||||
/* Select owner and schema as necessary */
|
||||
_reconnectAsOwner(AH, NULL, te);
|
||||
_selectOutputSchema(AH, te->namespace);
|
||||
@ -300,15 +300,15 @@ RestoreArchive(Archive *AHX, RestoreOptions *ropt)
|
||||
|
||||
if ((reqs & REQ_SCHEMA) != 0) /* We want the schema */
|
||||
{
|
||||
ahlog(AH, 1, "creating %s %s\n", te->desc, te->name);
|
||||
ahlog(AH, 1, "creating %s %s\n", te->desc, te->tag);
|
||||
_printTocEntry(AH, te, ropt, false);
|
||||
defnDumped = true;
|
||||
|
||||
/* If we created a DB, connect to it... */
|
||||
if (strcmp(te->desc, "DATABASE") == 0)
|
||||
{
|
||||
ahlog(AH, 1, "connecting to new database %s as user %s\n", te->name, te->owner);
|
||||
_reconnectAsUser(AH, te->name, te->owner);
|
||||
ahlog(AH, 1, "connecting to new database %s as user %s\n", te->tag, te->owner);
|
||||
_reconnectAsUser(AH, te->tag, te->owner);
|
||||
}
|
||||
}
|
||||
|
||||
@ -366,7 +366,7 @@ RestoreArchive(Archive *AHX, RestoreOptions *ropt)
|
||||
_reconnectAsOwner(AH, NULL, te);
|
||||
_selectOutputSchema(AH, te->namespace);
|
||||
|
||||
ahlog(AH, 1, "restoring data for table %s\n", te->name);
|
||||
ahlog(AH, 1, "restoring data for table %s\n", te->tag);
|
||||
|
||||
/*
|
||||
* If we have a copy statement, use it. As of
|
||||
@ -391,7 +391,7 @@ RestoreArchive(Archive *AHX, RestoreOptions *ropt)
|
||||
else if (!defnDumped)
|
||||
{
|
||||
/* If we haven't already dumped the defn part, do so now */
|
||||
ahlog(AH, 1, "executing %s %s\n", te->desc, te->name);
|
||||
ahlog(AH, 1, "executing %s %s\n", te->desc, te->tag);
|
||||
_printTocEntry(AH, te, ropt, false);
|
||||
}
|
||||
}
|
||||
@ -415,18 +415,18 @@ RestoreArchive(Archive *AHX, RestoreOptions *ropt)
|
||||
if (strcmp(te->desc, "TABLE DATA") == 0)
|
||||
{
|
||||
|
||||
ahlog(AH, 2, "checking whether we loaded %s\n", te->name);
|
||||
ahlog(AH, 2, "checking whether we loaded %s\n", te->tag);
|
||||
|
||||
reqs = _tocEntryRequired(te, ropt);
|
||||
|
||||
if ((reqs & REQ_DATA) != 0) /* We loaded the data */
|
||||
{
|
||||
ahlog(AH, 1, "fixing up large object cross-reference for %s\n", te->name);
|
||||
ahlog(AH, 1, "fixing up large object cross-reference for %s\n", te->tag);
|
||||
FixupBlobRefs(AH, te);
|
||||
}
|
||||
}
|
||||
else
|
||||
ahlog(AH, 2, "ignoring large object cross-references for %s %s\n", te->desc, te->name);
|
||||
ahlog(AH, 2, "ignoring large object cross-references for %s %s\n", te->desc, te->tag);
|
||||
|
||||
te = te->next;
|
||||
}
|
||||
@ -529,10 +529,10 @@ _disableTriggersIfNecessary(ArchiveHandle *AH, TocEntry *te, RestoreOptions *rop
|
||||
* Just update the AFFECTED table, if known. Otherwise update all
|
||||
* non-system tables.
|
||||
*/
|
||||
if (te && te->name && strlen(te->name) > 0)
|
||||
if (te && te->tag && strlen(te->tag) > 0)
|
||||
ahprintf(AH, "UPDATE pg_catalog.pg_class SET reltriggers = 0 "
|
||||
"WHERE oid = '%s'::pg_catalog.regclass;\n\n",
|
||||
fmtId(te->name, false));
|
||||
fmtId(te->tag, false));
|
||||
else
|
||||
ahprintf(AH, "UPDATE pg_catalog.pg_class SET reltriggers = 0 FROM pg_catalog.pg_namespace "
|
||||
"WHERE relnamespace = pg_namespace.oid AND nspname !~ '^pg_';\n\n");
|
||||
@ -596,11 +596,11 @@ _enableTriggersIfNecessary(ArchiveHandle *AH, TocEntry *te, RestoreOptions *ropt
|
||||
* Just update the AFFECTED table, if known. Otherwise update all
|
||||
* non-system tables.
|
||||
*/
|
||||
if (te && te->name && strlen(te->name) > 0)
|
||||
if (te && te->tag && strlen(te->tag) > 0)
|
||||
ahprintf(AH, "UPDATE pg_catalog.pg_class SET reltriggers = "
|
||||
"(SELECT pg_catalog.count(*) FROM pg_catalog.pg_trigger where pg_class.oid = tgrelid) "
|
||||
"WHERE oid = '%s'::pg_catalog.regclass;\n\n",
|
||||
fmtId(te->name, false));
|
||||
fmtId(te->tag, false));
|
||||
else
|
||||
ahprintf(AH, "UPDATE pg_catalog.pg_class SET reltriggers = "
|
||||
"(SELECT pg_catalog.count(*) FROM pg_catalog.pg_trigger where pg_class.oid = tgrelid) "
|
||||
@ -647,7 +647,7 @@ WriteData(Archive *AHX, const void *data, int dLen)
|
||||
|
||||
/* Public */
|
||||
void
|
||||
ArchiveEntry(Archive *AHX, const char *oid, const char *name,
|
||||
ArchiveEntry(Archive *AHX, const char *oid, const char *tag,
|
||||
const char *namespace, const char *owner,
|
||||
const char *desc, const char *((*deps)[]),
|
||||
const char *defn, const char *dropStmt,
|
||||
@ -671,7 +671,7 @@ ArchiveEntry(Archive *AHX, const char *oid, const char *name,
|
||||
|
||||
newToc->id = AH->lastID;
|
||||
|
||||
newToc->name = strdup(name);
|
||||
newToc->tag = strdup(tag);
|
||||
newToc->namespace = namespace ? strdup(namespace) : NULL;
|
||||
newToc->owner = strdup(owner);
|
||||
newToc->desc = strdup(desc);
|
||||
@ -738,7 +738,7 @@ PrintTOCSummary(Archive *AHX, RestoreOptions *ropt)
|
||||
while (te != AH->toc)
|
||||
{
|
||||
if (_tocEntryRequired(te, ropt) != 0)
|
||||
ahprintf(AH, "%d; %d %s %s %s\n", te->id, te->oidVal, te->desc, te->name, te->owner);
|
||||
ahprintf(AH, "%d; %d %s %s %s\n", te->id, te->oidVal, te->desc, te->tag, te->owner);
|
||||
te = te->next;
|
||||
}
|
||||
|
||||
@ -1795,7 +1795,7 @@ WriteToc(ArchiveHandle *AH)
|
||||
WriteInt(AH, te->dataDumper ? 1 : 0);
|
||||
WriteStr(AH, te->oid);
|
||||
|
||||
WriteStr(AH, te->name);
|
||||
WriteStr(AH, te->tag);
|
||||
WriteStr(AH, te->desc);
|
||||
WriteStr(AH, te->defn);
|
||||
WriteStr(AH, te->dropStmt);
|
||||
@ -1844,7 +1844,7 @@ ReadToc(ArchiveHandle *AH)
|
||||
te->oid = ReadStr(AH);
|
||||
te->oidVal = atooid(te->oid);
|
||||
|
||||
te->name = ReadStr(AH);
|
||||
te->tag = ReadStr(AH);
|
||||
te->desc = ReadStr(AH);
|
||||
te->defn = ReadStr(AH);
|
||||
te->dropStmt = ReadStr(AH);
|
||||
@ -1874,7 +1874,7 @@ ReadToc(ArchiveHandle *AH)
|
||||
#if 0
|
||||
if ((*deps)[depIdx])
|
||||
write_msg(modulename, "read dependency for %s -> %s\n",
|
||||
te->name, (*deps)[depIdx]);
|
||||
te->tag, (*deps)[depIdx]);
|
||||
#endif
|
||||
} while ((*deps)[depIdx++] != NULL);
|
||||
|
||||
@ -1892,7 +1892,7 @@ ReadToc(ArchiveHandle *AH)
|
||||
if (AH->ReadExtraTocPtr)
|
||||
(*AH->ReadExtraTocPtr) (AH, te);
|
||||
|
||||
ahlog(AH, 3, "read TOC entry %d (id %d) for %s %s\n", i, te->id, te->desc, te->name);
|
||||
ahlog(AH, 3, "read TOC entry %d (id %d) for %s %s\n", i, te->id, te->desc, te->tag);
|
||||
|
||||
te->prev = AH->toc->prev;
|
||||
AH->toc->prev->next = te;
|
||||
@ -1920,28 +1920,28 @@ _tocEntryRequired(TocEntry *te, RestoreOptions *ropt)
|
||||
{
|
||||
if (!ropt->selTable)
|
||||
return 0;
|
||||
if (ropt->tableNames && strcmp(ropt->tableNames, te->name) != 0)
|
||||
if (ropt->tableNames && strcmp(ropt->tableNames, te->tag) != 0)
|
||||
return 0;
|
||||
}
|
||||
else if (strcmp(te->desc, "INDEX") == 0)
|
||||
{
|
||||
if (!ropt->selIndex)
|
||||
return 0;
|
||||
if (ropt->indexNames && strcmp(ropt->indexNames, te->name) != 0)
|
||||
if (ropt->indexNames && strcmp(ropt->indexNames, te->tag) != 0)
|
||||
return 0;
|
||||
}
|
||||
else if (strcmp(te->desc, "FUNCTION") == 0)
|
||||
{
|
||||
if (!ropt->selFunction)
|
||||
return 0;
|
||||
if (ropt->functionNames && strcmp(ropt->functionNames, te->name) != 0)
|
||||
if (ropt->functionNames && strcmp(ropt->functionNames, te->tag) != 0)
|
||||
return 0;
|
||||
}
|
||||
else if (strcmp(te->desc, "TRIGGER") == 0)
|
||||
{
|
||||
if (!ropt->selTrigger)
|
||||
return 0;
|
||||
if (ropt->triggerNames && strcmp(ropt->triggerNames, te->name) != 0)
|
||||
if (ropt->triggerNames && strcmp(ropt->triggerNames, te->tag) != 0)
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
@ -1965,10 +1965,10 @@ _tocEntryRequired(TocEntry *te, RestoreOptions *ropt)
|
||||
}
|
||||
|
||||
/*
|
||||
* Special case: <Init> type with <Max OID> name; this is part of a
|
||||
* Special case: <Init> type with <Max OID> tag; this is part of a
|
||||
* DATA restore even though it has SQL.
|
||||
*/
|
||||
if ((strcmp(te->desc, "<Init>") == 0) && (strcmp(te->name, "Max OID") == 0))
|
||||
if ((strcmp(te->desc, "<Init>") == 0) && (strcmp(te->tag, "Max OID") == 0))
|
||||
res = REQ_DATA;
|
||||
|
||||
/* Mask it if we only want schema */
|
||||
@ -2221,7 +2221,7 @@ _printTocEntry(ArchiveHandle *AH, TocEntry *te, RestoreOptions *ropt, bool isDat
|
||||
pfx = "";
|
||||
|
||||
ahprintf(AH, "--\n-- %sTOC Entry ID %d (OID %s)\n--\n-- Name: %s Type: %s Schema: %s Owner: %s\n",
|
||||
pfx, te->id, te->oid, te->name, te->desc,
|
||||
pfx, te->id, te->oid, te->tag, te->desc,
|
||||
te->namespace ? te->namespace : "-",
|
||||
te->owner);
|
||||
if (AH->PrintExtraTocPtr !=NULL)
|
||||
|
@ -17,7 +17,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_archiver.h,v 1.43 2002/05/10 22:36:26 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_archiver.h,v 1.44 2002/07/04 15:35:07 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -245,7 +245,7 @@ typedef struct _tocEntry
|
||||
int id;
|
||||
int hadDumper; /* Archiver was passed a dumper routine
|
||||
* (used in restore) */
|
||||
char *name;
|
||||
char *tag; /* index tag */
|
||||
char *namespace; /* null or empty string if not in a schema */
|
||||
char *owner;
|
||||
char *desc;
|
||||
|
@ -5,7 +5,7 @@
|
||||
* Implements the basic DB functions used by the archiver.
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_db.c,v 1.33 2002/05/29 01:38:56 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_db.c,v 1.34 2002/07/04 15:35:07 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -714,7 +714,7 @@ FixupBlobRefs(ArchiveHandle *AH, TocEntry *te)
|
||||
n;
|
||||
char *attr;
|
||||
|
||||
if (strcmp(te->name, BLOB_XREF_TABLE) == 0)
|
||||
if (strcmp(te->tag, BLOB_XREF_TABLE) == 0)
|
||||
return;
|
||||
|
||||
tblName = createPQExpBuffer();
|
||||
@ -724,7 +724,7 @@ FixupBlobRefs(ArchiveHandle *AH, TocEntry *te)
|
||||
appendPQExpBuffer(tblName, "%s.",
|
||||
fmtId(te->namespace, false));
|
||||
appendPQExpBuffer(tblName, "%s",
|
||||
fmtId(te->name, false));
|
||||
fmtId(te->tag, false));
|
||||
|
||||
appendPQExpBuffer(tblQry,
|
||||
"SELECT a.attname FROM "
|
||||
@ -736,12 +736,12 @@ FixupBlobRefs(ArchiveHandle *AH, TocEntry *te)
|
||||
res = PQexec(AH->blobConnection, tblQry->data);
|
||||
if (!res)
|
||||
die_horribly(AH, modulename, "could not find oid columns of table \"%s\": %s",
|
||||
te->name, PQerrorMessage(AH->connection));
|
||||
te->tag, PQerrorMessage(AH->connection));
|
||||
|
||||
if ((n = PQntuples(res)) == 0)
|
||||
{
|
||||
/* nothing to do */
|
||||
ahlog(AH, 1, "no OID type columns in table %s\n", te->name);
|
||||
ahlog(AH, 1, "no OID type columns in table %s\n", te->tag);
|
||||
}
|
||||
|
||||
for (i = 0; i < n; i++)
|
||||
@ -749,7 +749,7 @@ FixupBlobRefs(ArchiveHandle *AH, TocEntry *te)
|
||||
attr = PQgetvalue(res, i, 0);
|
||||
|
||||
ahlog(AH, 1, "fixing large object cross-references for %s.%s\n",
|
||||
te->name, attr);
|
||||
te->tag, attr);
|
||||
|
||||
resetPQExpBuffer(tblQry);
|
||||
|
||||
@ -770,12 +770,12 @@ FixupBlobRefs(ArchiveHandle *AH, TocEntry *te)
|
||||
if (!uRes)
|
||||
die_horribly(AH, modulename,
|
||||
"could not update column \"%s\" of table \"%s\": %s",
|
||||
attr, te->name, PQerrorMessage(AH->blobConnection));
|
||||
attr, te->tag, PQerrorMessage(AH->blobConnection));
|
||||
|
||||
if (PQresultStatus(uRes) != PGRES_COMMAND_OK)
|
||||
die_horribly(AH, modulename,
|
||||
"error while updating column \"%s\" of table \"%s\": %s",
|
||||
attr, te->name, PQerrorMessage(AH->blobConnection));
|
||||
attr, te->tag, PQerrorMessage(AH->blobConnection));
|
||||
|
||||
PQclear(uRes);
|
||||
}
|
||||
|
@ -16,7 +16,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_tar.c,v 1.23 2002/05/29 01:38:56 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_tar.c,v 1.24 2002/07/04 15:35:07 momjian Exp $
|
||||
*
|
||||
* Modifications - 28-Jun-2000 - pjw@rhyme.com.au
|
||||
*
|
||||
@ -157,7 +157,7 @@ InitArchiveFmt_Tar(ArchiveHandle *AH)
|
||||
ctx = (lclContext *) malloc(sizeof(lclContext));
|
||||
AH->formatData = (void *) ctx;
|
||||
ctx->filePos = 0;
|
||||
|
||||
|
||||
/* Initialize LO buffering */
|
||||
AH->lo_buf_size = LOBBUFSIZE;
|
||||
AH->lo_buf = (void *)malloc(LOBBUFSIZE);
|
||||
@ -643,7 +643,7 @@ _PrintTocData(ArchiveHandle *AH, TocEntry *te, RestoreOptions *ropt)
|
||||
if (tmpCopy[pos1] == '"')
|
||||
pos1 += 2;
|
||||
|
||||
pos1 += strlen(te->name);
|
||||
pos1 += strlen(te->tag);
|
||||
|
||||
for (pos2 = pos1; pos2 < strlen(tmpCopy); pos2++)
|
||||
if (strncmp(&tmpCopy[pos2], "from stdin", 10) == 0)
|
||||
@ -1119,7 +1119,7 @@ _tarGetHeader(ArchiveHandle *AH, TAR_MEMBER *th)
|
||||
{
|
||||
lclContext *ctx = (lclContext *) AH->formatData;
|
||||
char h[512];
|
||||
char name[100];
|
||||
char tag[100];
|
||||
int sum,
|
||||
chk;
|
||||
int len;
|
||||
@ -1170,19 +1170,19 @@ _tarGetHeader(ArchiveHandle *AH, TAR_MEMBER *th)
|
||||
}
|
||||
}
|
||||
|
||||
sscanf(&h[0], "%99s", &name[0]);
|
||||
sscanf(&h[0], "%99s", &tag[0]);
|
||||
sscanf(&h[124], "%12o", &len);
|
||||
sscanf(&h[148], "%8o", &sum);
|
||||
|
||||
ahlog(AH, 3, "TOC Entry %s at %d (length %d, checksum %d)\n", &name[0], hPos, len, sum);
|
||||
ahlog(AH, 3, "TOC Entry %s at %d (length %d, checksum %d)\n", &tag[0], hPos, len, sum);
|
||||
|
||||
if (chk != sum)
|
||||
die_horribly(AH, modulename,
|
||||
"corrupt tar header found in %s "
|
||||
"(expected %d (%o), computed %d (%o)) file position %ld (%lx)\n",
|
||||
&name[0], sum, sum, chk, chk, ftell(ctx->tarFH), ftell(ctx->tarFH));
|
||||
&tag[0], sum, sum, chk, chk, ftell(ctx->tarFH), ftell(ctx->tarFH));
|
||||
|
||||
th->targetFile = strdup(name);
|
||||
th->targetFile = strdup(tag);
|
||||
th->fileLen = len;
|
||||
|
||||
return 1;
|
||||
@ -1224,7 +1224,7 @@ _tarWriteHeader(TAR_MEMBER *th)
|
||||
/* sprintf(&h[156], "%c", LF_NORMAL); */
|
||||
sprintf(&h[156], "0");
|
||||
|
||||
/* Link name 100 (NULL) */
|
||||
/* Link tag 100 (NULL) */
|
||||
|
||||
/* Magic 8 */
|
||||
sprintf(&h[257], "ustar ");
|
||||
|
@ -22,7 +22,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.269 2002/07/04 03:04:54 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.270 2002/07/04 15:35:07 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -104,7 +104,7 @@ static void dumpTableACL(Archive *fout, TableInfo *tbinfo);
|
||||
static void dumpFuncACL(Archive *fout, FuncInfo *finfo);
|
||||
static void dumpAggACL(Archive *fout, AggInfo *finfo);
|
||||
static void dumpACL(Archive *fout, const char *type, const char *name,
|
||||
const char *name_noquotes, const char *nspname,
|
||||
const char *tag, const char *nspname,
|
||||
const char *usename, const char *acl, const char *objoid);
|
||||
|
||||
static void dumpTriggers(Archive *fout, TableInfo *tblinfo, int numTables);
|
||||
@ -3362,15 +3362,15 @@ format_function_signature(FuncInfo *finfo, bool honor_quotes)
|
||||
static void
|
||||
dumpFuncACL(Archive *fout, FuncInfo *finfo)
|
||||
{
|
||||
char *funcsig, *funcsig_noquotes;
|
||||
char *funcsig, *funcsig_tag;
|
||||
|
||||
funcsig = format_function_signature(finfo, true);
|
||||
funcsig_noquotes = format_function_signature(finfo, false);
|
||||
dumpACL(fout, "FUNCTION", funcsig, funcsig_noquotes,
|
||||
funcsig_tag = format_function_signature(finfo, false);
|
||||
dumpACL(fout, "FUNCTION", funcsig, funcsig_tag,
|
||||
finfo->pronamespace->nspname,
|
||||
finfo->usename, finfo->proacl, finfo->oid);
|
||||
free(funcsig);
|
||||
free(funcsig_noquotes);
|
||||
free(funcsig_tag);
|
||||
}
|
||||
|
||||
|
||||
@ -3387,7 +3387,7 @@ dumpOneFunc(Archive *fout, FuncInfo *finfo)
|
||||
PQExpBuffer asPart = createPQExpBuffer();
|
||||
PGresult *res = NULL;
|
||||
char *funcsig = NULL;
|
||||
char *funcsig_noquotes = NULL;
|
||||
char *funcsig_tag = NULL;
|
||||
int ntups;
|
||||
char *proretset;
|
||||
char *prosrc;
|
||||
@ -3496,7 +3496,7 @@ dumpOneFunc(Archive *fout, FuncInfo *finfo)
|
||||
}
|
||||
|
||||
funcsig = format_function_signature(finfo, true);
|
||||
funcsig_noquotes = format_function_signature(finfo, false);
|
||||
funcsig_tag = format_function_signature(finfo, false);
|
||||
|
||||
/* DROP must be fully qualified in case same name appears in pg_catalog */
|
||||
appendPQExpBuffer(delqry, "DROP FUNCTION %s.%s;\n",
|
||||
@ -3539,7 +3539,7 @@ dumpOneFunc(Archive *fout, FuncInfo *finfo)
|
||||
|
||||
appendPQExpBuffer(q, ";\n");
|
||||
|
||||
ArchiveEntry(fout, finfo->oid, funcsig_noquotes,
|
||||
ArchiveEntry(fout, finfo->oid, funcsig_tag,
|
||||
finfo->pronamespace->nspname,
|
||||
finfo->usename, "FUNCTION", NULL,
|
||||
q->data, delqry->data,
|
||||
@ -3561,7 +3561,7 @@ done:
|
||||
destroyPQExpBuffer(delqry);
|
||||
destroyPQExpBuffer(asPart);
|
||||
free(funcsig);
|
||||
free(funcsig_noquotes);
|
||||
free(funcsig_tag);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -3988,15 +3988,15 @@ format_aggregate_signature(AggInfo *agginfo, Archive *fout, bool honor_quotes)
|
||||
static void
|
||||
dumpAggACL(Archive *fout, AggInfo *finfo)
|
||||
{
|
||||
char *aggsig, *aggsig_noquotes;
|
||||
char *aggsig, *aggsig_tag;
|
||||
|
||||
aggsig = format_aggregate_signature(finfo, fout, true);
|
||||
aggsig_noquotes = format_aggregate_signature(finfo, fout, false);
|
||||
dumpACL(fout, "FUNCTION", aggsig, aggsig_noquotes,
|
||||
aggsig_tag = format_aggregate_signature(finfo, fout, false);
|
||||
dumpACL(fout, "FUNCTION", aggsig, aggsig_tag,
|
||||
finfo->aggnamespace->nspname,
|
||||
finfo->usename, finfo->aggacl, finfo->oid);
|
||||
free(aggsig);
|
||||
free(aggsig_noquotes);
|
||||
free(aggsig_tag);
|
||||
}
|
||||
|
||||
|
||||
@ -4012,7 +4012,7 @@ dumpOneAgg(Archive *fout, AggInfo *agginfo)
|
||||
PQExpBuffer delq = createPQExpBuffer();
|
||||
PQExpBuffer details = createPQExpBuffer();
|
||||
char *aggsig;
|
||||
char *aggsig_noquotes;
|
||||
char *aggsig_tag;
|
||||
PGresult *res;
|
||||
int ntups;
|
||||
int i_aggtransfn;
|
||||
@ -4103,7 +4103,7 @@ dumpOneAgg(Archive *fout, AggInfo *agginfo)
|
||||
convertok = (PQgetvalue(res, 0, i_convertok)[0] == 't');
|
||||
|
||||
aggsig = format_aggregate_signature(agginfo, g_fout, true);
|
||||
aggsig_noquotes = format_aggregate_signature(agginfo, g_fout, false);
|
||||
aggsig_tag = format_aggregate_signature(agginfo, g_fout, false);
|
||||
|
||||
if (!convertok)
|
||||
{
|
||||
@ -4112,7 +4112,7 @@ dumpOneAgg(Archive *fout, AggInfo *agginfo)
|
||||
|
||||
appendPQExpBuffer(q, "-- WARNING: aggregate function %s could not be dumped correctly for this database version; ignored\n",
|
||||
aggsig);
|
||||
ArchiveEntry(fout, agginfo->oid, aggsig_noquotes,
|
||||
ArchiveEntry(fout, agginfo->oid, aggsig_tag,
|
||||
agginfo->aggnamespace->nspname, agginfo->usename,
|
||||
"WARNING", NULL,
|
||||
q->data, "" /* Del */ ,
|
||||
@ -4171,7 +4171,7 @@ dumpOneAgg(Archive *fout, AggInfo *agginfo)
|
||||
fmtId(agginfo->aggname, force_quotes),
|
||||
details->data);
|
||||
|
||||
ArchiveEntry(fout, agginfo->oid, aggsig_noquotes,
|
||||
ArchiveEntry(fout, agginfo->oid, aggsig_tag,
|
||||
agginfo->aggnamespace->nspname, agginfo->usename,
|
||||
"AGGREGATE", NULL,
|
||||
q->data, delq->data,
|
||||
@ -4197,7 +4197,7 @@ dumpOneAgg(Archive *fout, AggInfo *agginfo)
|
||||
destroyPQExpBuffer(delq);
|
||||
destroyPQExpBuffer(details);
|
||||
free(aggsig);
|
||||
free(aggsig_noquotes);
|
||||
free(aggsig_tag);
|
||||
}
|
||||
|
||||
|
||||
@ -4296,7 +4296,7 @@ GetPrivileges(Archive *AH, const char *s, const char *type)
|
||||
*/
|
||||
static void
|
||||
dumpACL(Archive *fout, const char *type, const char *name,
|
||||
const char *name_noquotes, const char *nspname, const char *usename,
|
||||
const char *tag, const char *nspname, const char *usename,
|
||||
const char *acls, const char *objoid)
|
||||
{
|
||||
char *aclbuf,
|
||||
@ -4410,7 +4410,7 @@ dumpACL(Archive *fout, const char *type, const char *name,
|
||||
appendPQExpBuffer(sql, "%s;\n", fmtId(usename, force_quotes));
|
||||
}
|
||||
|
||||
ArchiveEntry(fout, objoid, name_noquotes, nspname, usename ? usename : "",
|
||||
ArchiveEntry(fout, objoid, tag, nspname, usename ? usename : "",
|
||||
"ACL", NULL, sql->data, "", NULL, NULL, NULL);
|
||||
|
||||
free(aclbuf);
|
||||
|
Loading…
x
Reference in New Issue
Block a user