as it appears in the schema dump, and index tags.
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
/* 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,
*
*
* 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 $
*
*
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);
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);
}
}
_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
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);
}
}
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;
}
* 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");
* 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) "
/* 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,
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);
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;
}
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);
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);
#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);
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;
{
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
}
/*
- * Special case: type with name; this is part of a
+ * Special case: type with tag; this is part of a
* DATA restore even though it has SQL.
*/
- if ((strcmp(te->desc, "") == 0) && (strcmp(te->name, "Max OID") == 0))
+ if ((strcmp(te->desc, "") == 0) && (strcmp(te->tag, "Max OID") == 0))
res = REQ_DATA;
/* Mask it if we only want schema */
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)
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
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;
* 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 $
*
*-------------------------------------------------------------------------
*/
n;
char *attr;
- if (strcmp(te->name, BLOB_XREF_TABLE) == 0)
+ if (strcmp(te->tag, BLOB_XREF_TABLE) == 0)
return;
tblName = createPQExpBuffer();
appendPQExpBuffer(tblName, "%s.",
fmtId(te->namespace, false));
appendPQExpBuffer(tblName, "%s",
- fmtId(te->name, false));
+ fmtId(te->tag, false));
appendPQExpBuffer(tblQry,
"SELECT a.attname FROM "
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++)
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);
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);
}
*
*
* 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 $
*
*
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);
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)
{
lclContext *ctx = (lclContext *) AH->formatData;
char h[512];
- char name[100];
+ char tag[100];
int sum,
chk;
int len;
}
}
- 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;
/* sprintf(&h[156], "%c", LF_NORMAL); */
sprintf(&h[156], "0");
- /* Link name 100 (NULL) */
+ /* Link tag 100 (NULL) */
/* Magic 8 */
sprintf(&h[257], "ustar ");
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
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);
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);
}
PQExpBuffer asPart = createPQExpBuffer();
PGresult *res = NULL;
char *funcsig = NULL;
- char *funcsig_noquotes = NULL;
+ char *funcsig_tag = NULL;
int ntups;
char *proretset;
char *prosrc;
}
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",
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,
destroyPQExpBuffer(delqry);
destroyPQExpBuffer(asPart);
free(funcsig);
- free(funcsig_noquotes);
+ free(funcsig_tag);
}
/*
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);
}
PQExpBuffer delq = createPQExpBuffer();
PQExpBuffer details = createPQExpBuffer();
char *aggsig;
- char *aggsig_noquotes;
+ char *aggsig_tag;
PGresult *res;
int ntups;
int i_aggtransfn;
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)
{
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 */ ,
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,
destroyPQExpBuffer(delq);
destroyPQExpBuffer(details);
free(aggsig);
- free(aggsig_noquotes);
+ free(aggsig_tag);
}
*/
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,
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);