Skip to content

Commit d59478c

Browse files
committed
More clearly document in pg_dump when we are dealing with an object name
as it appears in the schema dump, and index tags.
1 parent 68d9fbe commit d59478c

File tree

6 files changed

+70
-70
lines changed

6 files changed

+70
-70
lines changed

src/bin/pg_dump/pg_backup.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*
1616
*
1717
* IDENTIFICATION
18-
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup.h,v 1.19 2002/05/10 22:36:26 tgl Exp $
18+
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup.h,v 1.20 2002/07/04 15:35:07 momjian Exp $
1919
*
2020
*-------------------------------------------------------------------------
2121
*/
@@ -133,7 +133,7 @@ PGconn *ConnectDatabase(Archive *AH,
133133

134134

135135
/* Called to add a TOC entry */
136-
extern void ArchiveEntry(Archive *AHX, const char *oid, const char *name,
136+
extern void ArchiveEntry(Archive *AHX, const char *oid, const char *tag,
137137
const char *namespace, const char *owner,
138138
const char *desc, const char *((*deps)[]),
139139
const char *defn, const char *dropStmt,

src/bin/pg_dump/pg_backup_archiver.c

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*
1616
*
1717
* IDENTIFICATION
18-
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_archiver.c,v 1.51 2002/07/04 03:04:54 momjian Exp $
18+
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_archiver.c,v 1.52 2002/07/04 15:35:07 momjian Exp $
1919
*
2020
* Modifications - 28-Jun-2000 - pjw@rhyme.com.au
2121
*
@@ -266,7 +266,7 @@ RestoreArchive(Archive *AHX, RestoreOptions *ropt)
266266
if (((reqs & REQ_SCHEMA) != 0) && te->dropStmt)
267267
{
268268
/* We want the schema */
269-
ahlog(AH, 1, "dropping %s %s\n", te->desc, te->name);
269+
ahlog(AH, 1, "dropping %s %s\n", te->desc, te->tag);
270270
/* Select owner and schema as necessary */
271271
_reconnectAsOwner(AH, NULL, te);
272272
_selectOutputSchema(AH, te->namespace);
@@ -300,15 +300,15 @@ RestoreArchive(Archive *AHX, RestoreOptions *ropt)
300300

301301
if ((reqs & REQ_SCHEMA) != 0) /* We want the schema */
302302
{
303-
ahlog(AH, 1, "creating %s %s\n", te->desc, te->name);
303+
ahlog(AH, 1, "creating %s %s\n", te->desc, te->tag);
304304
_printTocEntry(AH, te, ropt, false);
305305
defnDumped = true;
306306

307307
/* If we created a DB, connect to it... */
308308
if (strcmp(te->desc, "DATABASE") == 0)
309309
{
310-
ahlog(AH, 1, "connecting to new database %s as user %s\n", te->name, te->owner);
311-
_reconnectAsUser(AH, te->name, te->owner);
310+
ahlog(AH, 1, "connecting to new database %s as user %s\n", te->tag, te->owner);
311+
_reconnectAsUser(AH, te->tag, te->owner);
312312
}
313313
}
314314

@@ -366,7 +366,7 @@ RestoreArchive(Archive *AHX, RestoreOptions *ropt)
366366
_reconnectAsOwner(AH, NULL, te);
367367
_selectOutputSchema(AH, te->namespace);
368368

369-
ahlog(AH, 1, "restoring data for table %s\n", te->name);
369+
ahlog(AH, 1, "restoring data for table %s\n", te->tag);
370370

371371
/*
372372
* If we have a copy statement, use it. As of
@@ -391,7 +391,7 @@ RestoreArchive(Archive *AHX, RestoreOptions *ropt)
391391
else if (!defnDumped)
392392
{
393393
/* If we haven't already dumped the defn part, do so now */
394-
ahlog(AH, 1, "executing %s %s\n", te->desc, te->name);
394+
ahlog(AH, 1, "executing %s %s\n", te->desc, te->tag);
395395
_printTocEntry(AH, te, ropt, false);
396396
}
397397
}
@@ -415,18 +415,18 @@ RestoreArchive(Archive *AHX, RestoreOptions *ropt)
415415
if (strcmp(te->desc, "TABLE DATA") == 0)
416416
{
417417

418-
ahlog(AH, 2, "checking whether we loaded %s\n", te->name);
418+
ahlog(AH, 2, "checking whether we loaded %s\n", te->tag);
419419

420420
reqs = _tocEntryRequired(te, ropt);
421421

422422
if ((reqs & REQ_DATA) != 0) /* We loaded the data */
423423
{
424-
ahlog(AH, 1, "fixing up large object cross-reference for %s\n", te->name);
424+
ahlog(AH, 1, "fixing up large object cross-reference for %s\n", te->tag);
425425
FixupBlobRefs(AH, te);
426426
}
427427
}
428428
else
429-
ahlog(AH, 2, "ignoring large object cross-references for %s %s\n", te->desc, te->name);
429+
ahlog(AH, 2, "ignoring large object cross-references for %s %s\n", te->desc, te->tag);
430430

431431
te = te->next;
432432
}
@@ -529,10 +529,10 @@ _disableTriggersIfNecessary(ArchiveHandle *AH, TocEntry *te, RestoreOptions *rop
529529
* Just update the AFFECTED table, if known. Otherwise update all
530530
* non-system tables.
531531
*/
532-
if (te && te->name && strlen(te->name) > 0)
532+
if (te && te->tag && strlen(te->tag) > 0)
533533
ahprintf(AH, "UPDATE pg_catalog.pg_class SET reltriggers = 0 "
534534
"WHERE oid = '%s'::pg_catalog.regclass;\n\n",
535-
fmtId(te->name, false));
535+
fmtId(te->tag, false));
536536
else
537537
ahprintf(AH, "UPDATE pg_catalog.pg_class SET reltriggers = 0 FROM pg_catalog.pg_namespace "
538538
"WHERE relnamespace = pg_namespace.oid AND nspname !~ '^pg_';\n\n");
@@ -596,11 +596,11 @@ _enableTriggersIfNecessary(ArchiveHandle *AH, TocEntry *te, RestoreOptions *ropt
596596
* Just update the AFFECTED table, if known. Otherwise update all
597597
* non-system tables.
598598
*/
599-
if (te && te->name && strlen(te->name) > 0)
599+
if (te && te->tag && strlen(te->tag) > 0)
600600
ahprintf(AH, "UPDATE pg_catalog.pg_class SET reltriggers = "
601601
"(SELECT pg_catalog.count(*) FROM pg_catalog.pg_trigger where pg_class.oid = tgrelid) "
602602
"WHERE oid = '%s'::pg_catalog.regclass;\n\n",
603-
fmtId(te->name, false));
603+
fmtId(te->tag, false));
604604
else
605605
ahprintf(AH, "UPDATE pg_catalog.pg_class SET reltriggers = "
606606
"(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)
647647

648648
/* Public */
649649
void
650-
ArchiveEntry(Archive *AHX, const char *oid, const char *name,
650+
ArchiveEntry(Archive *AHX, const char *oid, const char *tag,
651651
const char *namespace, const char *owner,
652652
const char *desc, const char *((*deps)[]),
653653
const char *defn, const char *dropStmt,
@@ -671,7 +671,7 @@ ArchiveEntry(Archive *AHX, const char *oid, const char *name,
671671

672672
newToc->id = AH->lastID;
673673

674-
newToc->name = strdup(name);
674+
newToc->tag = strdup(tag);
675675
newToc->namespace = namespace ? strdup(namespace) : NULL;
676676
newToc->owner = strdup(owner);
677677
newToc->desc = strdup(desc);
@@ -738,7 +738,7 @@ PrintTOCSummary(Archive *AHX, RestoreOptions *ropt)
738738
while (te != AH->toc)
739739
{
740740
if (_tocEntryRequired(te, ropt) != 0)
741-
ahprintf(AH, "%d; %d %s %s %s\n", te->id, te->oidVal, te->desc, te->name, te->owner);
741+
ahprintf(AH, "%d; %d %s %s %s\n", te->id, te->oidVal, te->desc, te->tag, te->owner);
742742
te = te->next;
743743
}
744744

@@ -1795,7 +1795,7 @@ WriteToc(ArchiveHandle *AH)
17951795
WriteInt(AH, te->dataDumper ? 1 : 0);
17961796
WriteStr(AH, te->oid);
17971797

1798-
WriteStr(AH, te->name);
1798+
WriteStr(AH, te->tag);
17991799
WriteStr(AH, te->desc);
18001800
WriteStr(AH, te->defn);
18011801
WriteStr(AH, te->dropStmt);
@@ -1844,7 +1844,7 @@ ReadToc(ArchiveHandle *AH)
18441844
te->oid = ReadStr(AH);
18451845
te->oidVal = atooid(te->oid);
18461846

1847-
te->name = ReadStr(AH);
1847+
te->tag = ReadStr(AH);
18481848
te->desc = ReadStr(AH);
18491849
te->defn = ReadStr(AH);
18501850
te->dropStmt = ReadStr(AH);
@@ -1874,7 +1874,7 @@ ReadToc(ArchiveHandle *AH)
18741874
#if 0
18751875
if ((*deps)[depIdx])
18761876
write_msg(modulename, "read dependency for %s -> %s\n",
1877-
te->name, (*deps)[depIdx]);
1877+
te->tag, (*deps)[depIdx]);
18781878
#endif
18791879
} while ((*deps)[depIdx++] != NULL);
18801880

@@ -1892,7 +1892,7 @@ ReadToc(ArchiveHandle *AH)
18921892
if (AH->ReadExtraTocPtr)
18931893
(*AH->ReadExtraTocPtr) (AH, te);
18941894

1895-
ahlog(AH, 3, "read TOC entry %d (id %d) for %s %s\n", i, te->id, te->desc, te->name);
1895+
ahlog(AH, 3, "read TOC entry %d (id %d) for %s %s\n", i, te->id, te->desc, te->tag);
18961896

18971897
te->prev = AH->toc->prev;
18981898
AH->toc->prev->next = te;
@@ -1920,28 +1920,28 @@ _tocEntryRequired(TocEntry *te, RestoreOptions *ropt)
19201920
{
19211921
if (!ropt->selTable)
19221922
return 0;
1923-
if (ropt->tableNames && strcmp(ropt->tableNames, te->name) != 0)
1923+
if (ropt->tableNames && strcmp(ropt->tableNames, te->tag) != 0)
19241924
return 0;
19251925
}
19261926
else if (strcmp(te->desc, "INDEX") == 0)
19271927
{
19281928
if (!ropt->selIndex)
19291929
return 0;
1930-
if (ropt->indexNames && strcmp(ropt->indexNames, te->name) != 0)
1930+
if (ropt->indexNames && strcmp(ropt->indexNames, te->tag) != 0)
19311931
return 0;
19321932
}
19331933
else if (strcmp(te->desc, "FUNCTION") == 0)
19341934
{
19351935
if (!ropt->selFunction)
19361936
return 0;
1937-
if (ropt->functionNames && strcmp(ropt->functionNames, te->name) != 0)
1937+
if (ropt->functionNames && strcmp(ropt->functionNames, te->tag) != 0)
19381938
return 0;
19391939
}
19401940
else if (strcmp(te->desc, "TRIGGER") == 0)
19411941
{
19421942
if (!ropt->selTrigger)
19431943
return 0;
1944-
if (ropt->triggerNames && strcmp(ropt->triggerNames, te->name) != 0)
1944+
if (ropt->triggerNames && strcmp(ropt->triggerNames, te->tag) != 0)
19451945
return 0;
19461946
}
19471947
else
@@ -1965,10 +1965,10 @@ _tocEntryRequired(TocEntry *te, RestoreOptions *ropt)
19651965
}
19661966

19671967
/*
1968-
* Special case: <Init> type with <Max OID> name; this is part of a
1968+
* Special case: <Init> type with <Max OID> tag; this is part of a
19691969
* DATA restore even though it has SQL.
19701970
*/
1971-
if ((strcmp(te->desc, "<Init>") == 0) && (strcmp(te->name, "Max OID") == 0))
1971+
if ((strcmp(te->desc, "<Init>") == 0) && (strcmp(te->tag, "Max OID") == 0))
19721972
res = REQ_DATA;
19731973

19741974
/* Mask it if we only want schema */
@@ -2221,7 +2221,7 @@ _printTocEntry(ArchiveHandle *AH, TocEntry *te, RestoreOptions *ropt, bool isDat
22212221
pfx = "";
22222222

22232223
ahprintf(AH, "--\n-- %sTOC Entry ID %d (OID %s)\n--\n-- Name: %s Type: %s Schema: %s Owner: %s\n",
2224-
pfx, te->id, te->oid, te->name, te->desc,
2224+
pfx, te->id, te->oid, te->tag, te->desc,
22252225
te->namespace ? te->namespace : "-",
22262226
te->owner);
22272227
if (AH->PrintExtraTocPtr !=NULL)

src/bin/pg_dump/pg_backup_archiver.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
*
1818
*
1919
* IDENTIFICATION
20-
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_archiver.h,v 1.43 2002/05/10 22:36:26 tgl Exp $
20+
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_archiver.h,v 1.44 2002/07/04 15:35:07 momjian Exp $
2121
*
2222
*-------------------------------------------------------------------------
2323
*/
@@ -245,7 +245,7 @@ typedef struct _tocEntry
245245
int id;
246246
int hadDumper; /* Archiver was passed a dumper routine
247247
* (used in restore) */
248-
char *name;
248+
char *tag; /* index tag */
249249
char *namespace; /* null or empty string if not in a schema */
250250
char *owner;
251251
char *desc;

src/bin/pg_dump/pg_backup_db.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Implements the basic DB functions used by the archiver.
66
*
77
* IDENTIFICATION
8-
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_db.c,v 1.33 2002/05/29 01:38:56 tgl Exp $
8+
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_db.c,v 1.34 2002/07/04 15:35:07 momjian Exp $
99
*
1010
*-------------------------------------------------------------------------
1111
*/
@@ -714,7 +714,7 @@ FixupBlobRefs(ArchiveHandle *AH, TocEntry *te)
714714
n;
715715
char *attr;
716716

717-
if (strcmp(te->name, BLOB_XREF_TABLE) == 0)
717+
if (strcmp(te->tag, BLOB_XREF_TABLE) == 0)
718718
return;
719719

720720
tblName = createPQExpBuffer();
@@ -724,7 +724,7 @@ FixupBlobRefs(ArchiveHandle *AH, TocEntry *te)
724724
appendPQExpBuffer(tblName, "%s.",
725725
fmtId(te->namespace, false));
726726
appendPQExpBuffer(tblName, "%s",
727-
fmtId(te->name, false));
727+
fmtId(te->tag, false));
728728

729729
appendPQExpBuffer(tblQry,
730730
"SELECT a.attname FROM "
@@ -736,20 +736,20 @@ FixupBlobRefs(ArchiveHandle *AH, TocEntry *te)
736736
res = PQexec(AH->blobConnection, tblQry->data);
737737
if (!res)
738738
die_horribly(AH, modulename, "could not find oid columns of table \"%s\": %s",
739-
te->name, PQerrorMessage(AH->connection));
739+
te->tag, PQerrorMessage(AH->connection));
740740

741741
if ((n = PQntuples(res)) == 0)
742742
{
743743
/* nothing to do */
744-
ahlog(AH, 1, "no OID type columns in table %s\n", te->name);
744+
ahlog(AH, 1, "no OID type columns in table %s\n", te->tag);
745745
}
746746

747747
for (i = 0; i < n; i++)
748748
{
749749
attr = PQgetvalue(res, i, 0);
750750

751751
ahlog(AH, 1, "fixing large object cross-references for %s.%s\n",
752-
te->name, attr);
752+
te->tag, attr);
753753

754754
resetPQExpBuffer(tblQry);
755755

@@ -770,12 +770,12 @@ FixupBlobRefs(ArchiveHandle *AH, TocEntry *te)
770770
if (!uRes)
771771
die_horribly(AH, modulename,
772772
"could not update column \"%s\" of table \"%s\": %s",
773-
attr, te->name, PQerrorMessage(AH->blobConnection));
773+
attr, te->tag, PQerrorMessage(AH->blobConnection));
774774

775775
if (PQresultStatus(uRes) != PGRES_COMMAND_OK)
776776
die_horribly(AH, modulename,
777777
"error while updating column \"%s\" of table \"%s\": %s",
778-
attr, te->name, PQerrorMessage(AH->blobConnection));
778+
attr, te->tag, PQerrorMessage(AH->blobConnection));
779779

780780
PQclear(uRes);
781781
}

src/bin/pg_dump/pg_backup_tar.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*
1717
*
1818
* IDENTIFICATION
19-
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_tar.c,v 1.23 2002/05/29 01:38:56 tgl Exp $
19+
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_tar.c,v 1.24 2002/07/04 15:35:07 momjian Exp $
2020
*
2121
* Modifications - 28-Jun-2000 - pjw@rhyme.com.au
2222
*
@@ -157,7 +157,7 @@ InitArchiveFmt_Tar(ArchiveHandle *AH)
157157
ctx = (lclContext *) malloc(sizeof(lclContext));
158158
AH->formatData = (void *) ctx;
159159
ctx->filePos = 0;
160-
160+
161161
/* Initialize LO buffering */
162162
AH->lo_buf_size = LOBBUFSIZE;
163163
AH->lo_buf = (void *)malloc(LOBBUFSIZE);
@@ -643,7 +643,7 @@ _PrintTocData(ArchiveHandle *AH, TocEntry *te, RestoreOptions *ropt)
643643
if (tmpCopy[pos1] == '"')
644644
pos1 += 2;
645645

646-
pos1 += strlen(te->name);
646+
pos1 += strlen(te->tag);
647647

648648
for (pos2 = pos1; pos2 < strlen(tmpCopy); pos2++)
649649
if (strncmp(&tmpCopy[pos2], "from stdin", 10) == 0)
@@ -1119,7 +1119,7 @@ _tarGetHeader(ArchiveHandle *AH, TAR_MEMBER *th)
11191119
{
11201120
lclContext *ctx = (lclContext *) AH->formatData;
11211121
char h[512];
1122-
char name[100];
1122+
char tag[100];
11231123
int sum,
11241124
chk;
11251125
int len;
@@ -1170,19 +1170,19 @@ _tarGetHeader(ArchiveHandle *AH, TAR_MEMBER *th)
11701170
}
11711171
}
11721172

1173-
sscanf(&h[0], "%99s", &name[0]);
1173+
sscanf(&h[0], "%99s", &tag[0]);
11741174
sscanf(&h[124], "%12o", &len);
11751175
sscanf(&h[148], "%8o", &sum);
11761176

1177-
ahlog(AH, 3, "TOC Entry %s at %d (length %d, checksum %d)\n", &name[0], hPos, len, sum);
1177+
ahlog(AH, 3, "TOC Entry %s at %d (length %d, checksum %d)\n", &tag[0], hPos, len, sum);
11781178

11791179
if (chk != sum)
11801180
die_horribly(AH, modulename,
11811181
"corrupt tar header found in %s "
11821182
"(expected %d (%o), computed %d (%o)) file position %ld (%lx)\n",
1183-
&name[0], sum, sum, chk, chk, ftell(ctx->tarFH), ftell(ctx->tarFH));
1183+
&tag[0], sum, sum, chk, chk, ftell(ctx->tarFH), ftell(ctx->tarFH));
11841184

1185-
th->targetFile = strdup(name);
1185+
th->targetFile = strdup(tag);
11861186
th->fileLen = len;
11871187

11881188
return 1;
@@ -1224,7 +1224,7 @@ _tarWriteHeader(TAR_MEMBER *th)
12241224
/* sprintf(&h[156], "%c", LF_NORMAL); */
12251225
sprintf(&h[156], "0");
12261226

1227-
/* Link name 100 (NULL) */
1227+
/* Link tag 100 (NULL) */
12281228

12291229
/* Magic 8 */
12301230
sprintf(&h[257], "ustar ");

0 commit comments

Comments
 (0)