15
15
*
16
16
*
17
17
* IDENTIFICATION
18
- *$Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_archiver.c,v 1.51 2002/07/0403:04:54 momjian Exp $
18
+ *$Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_archiver.c,v 1.52 2002/07/0415:35:07 momjian Exp $
19
19
*
20
20
* Modifications - 28-Jun-2000 - pjw@rhyme.com.au
21
21
*
@@ -266,7 +266,7 @@ RestoreArchive(Archive *AHX, RestoreOptions *ropt)
266
266
if (((reqs & REQ_SCHEMA )!= 0 )&& te -> dropStmt )
267
267
{
268
268
/* 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 );
270
270
/* Select owner and schema as necessary */
271
271
_reconnectAsOwner (AH ,NULL ,te );
272
272
_selectOutputSchema (AH ,te -> namespace );
@@ -300,15 +300,15 @@ RestoreArchive(Archive *AHX, RestoreOptions *ropt)
300
300
301
301
if ((reqs & REQ_SCHEMA )!= 0 )/* We want the schema */
302
302
{
303
- ahlog (AH ,1 ,"creating %s %s\n" ,te -> desc ,te -> name );
303
+ ahlog (AH ,1 ,"creating %s %s\n" ,te -> desc ,te -> tag );
304
304
_printTocEntry (AH ,te ,ropt , false);
305
305
defnDumped = true;
306
306
307
307
/* If we created a DB, connect to it... */
308
308
if (strcmp (te -> desc ,"DATABASE" )== 0 )
309
309
{
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 );
312
312
}
313
313
}
314
314
@@ -366,7 +366,7 @@ RestoreArchive(Archive *AHX, RestoreOptions *ropt)
366
366
_reconnectAsOwner (AH ,NULL ,te );
367
367
_selectOutputSchema (AH ,te -> namespace );
368
368
369
- ahlog (AH ,1 ,"restoring data for table %s\n" ,te -> name );
369
+ ahlog (AH ,1 ,"restoring data for table %s\n" ,te -> tag );
370
370
371
371
/*
372
372
* If we have a copy statement, use it. As of
@@ -391,7 +391,7 @@ RestoreArchive(Archive *AHX, RestoreOptions *ropt)
391
391
else if (!defnDumped )
392
392
{
393
393
/* 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 );
395
395
_printTocEntry (AH ,te ,ropt , false);
396
396
}
397
397
}
@@ -415,18 +415,18 @@ RestoreArchive(Archive *AHX, RestoreOptions *ropt)
415
415
if (strcmp (te -> desc ,"TABLE DATA" )== 0 )
416
416
{
417
417
418
- ahlog (AH ,2 ,"checking whether we loaded %s\n" ,te -> name );
418
+ ahlog (AH ,2 ,"checking whether we loaded %s\n" ,te -> tag );
419
419
420
420
reqs = _tocEntryRequired (te ,ropt );
421
421
422
422
if ((reqs & REQ_DATA )!= 0 )/* We loaded the data */
423
423
{
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 );
425
425
FixupBlobRefs (AH ,te );
426
426
}
427
427
}
428
428
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 );
430
430
431
431
te = te -> next ;
432
432
}
@@ -529,10 +529,10 @@ _disableTriggersIfNecessary(ArchiveHandle *AH, TocEntry *te, RestoreOptions *rop
529
529
* Just update the AFFECTED table, if known. Otherwise update all
530
530
* non-system tables.
531
531
*/
532
- if (te && te -> name && strlen (te -> name )> 0 )
532
+ if (te && te -> tag && strlen (te -> tag )> 0 )
533
533
ahprintf (AH ,"UPDATE pg_catalog.pg_class SET reltriggers = 0 "
534
534
"WHERE oid = '%s'::pg_catalog.regclass;\n\n" ,
535
- fmtId (te -> name , false));
535
+ fmtId (te -> tag , false));
536
536
else
537
537
ahprintf (AH ,"UPDATE pg_catalog.pg_class SET reltriggers = 0 FROM pg_catalog.pg_namespace "
538
538
"WHERE relnamespace = pg_namespace.oid AND nspname !~ '^pg_';\n\n" );
@@ -596,11 +596,11 @@ _enableTriggersIfNecessary(ArchiveHandle *AH, TocEntry *te, RestoreOptions *ropt
596
596
* Just update the AFFECTED table, if known. Otherwise update all
597
597
* non-system tables.
598
598
*/
599
- if (te && te -> name && strlen (te -> name )> 0 )
599
+ if (te && te -> tag && strlen (te -> tag )> 0 )
600
600
ahprintf (AH ,"UPDATE pg_catalog.pg_class SET reltriggers = "
601
601
"(SELECT pg_catalog.count(*) FROM pg_catalog.pg_trigger where pg_class.oid = tgrelid) "
602
602
"WHERE oid = '%s'::pg_catalog.regclass;\n\n" ,
603
- fmtId (te -> name , false));
603
+ fmtId (te -> tag , false));
604
604
else
605
605
ahprintf (AH ,"UPDATE pg_catalog.pg_class SET reltriggers = "
606
606
"(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)
647
647
648
648
/* Public */
649
649
void
650
- ArchiveEntry (Archive * AHX ,const char * oid ,const char * name ,
650
+ ArchiveEntry (Archive * AHX ,const char * oid ,const char * tag ,
651
651
const char * namespace ,const char * owner ,
652
652
const char * desc ,const char * ((* deps )[]),
653
653
const char * defn ,const char * dropStmt ,
@@ -671,7 +671,7 @@ ArchiveEntry(Archive *AHX, const char *oid, const char *name,
671
671
672
672
newToc -> id = AH -> lastID ;
673
673
674
- newToc -> name = strdup (name );
674
+ newToc -> tag = strdup (tag );
675
675
newToc -> namespace = namespace ?strdup (namespace ) :NULL ;
676
676
newToc -> owner = strdup (owner );
677
677
newToc -> desc = strdup (desc );
@@ -738,7 +738,7 @@ PrintTOCSummary(Archive *AHX, RestoreOptions *ropt)
738
738
while (te != AH -> toc )
739
739
{
740
740
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 );
742
742
te = te -> next ;
743
743
}
744
744
@@ -1795,7 +1795,7 @@ WriteToc(ArchiveHandle *AH)
1795
1795
WriteInt (AH ,te -> dataDumper ?1 :0 );
1796
1796
WriteStr (AH ,te -> oid );
1797
1797
1798
- WriteStr (AH ,te -> name );
1798
+ WriteStr (AH ,te -> tag );
1799
1799
WriteStr (AH ,te -> desc );
1800
1800
WriteStr (AH ,te -> defn );
1801
1801
WriteStr (AH ,te -> dropStmt );
@@ -1844,7 +1844,7 @@ ReadToc(ArchiveHandle *AH)
1844
1844
te -> oid = ReadStr (AH );
1845
1845
te -> oidVal = atooid (te -> oid );
1846
1846
1847
- te -> name = ReadStr (AH );
1847
+ te -> tag = ReadStr (AH );
1848
1848
te -> desc = ReadStr (AH );
1849
1849
te -> defn = ReadStr (AH );
1850
1850
te -> dropStmt = ReadStr (AH );
@@ -1874,7 +1874,7 @@ ReadToc(ArchiveHandle *AH)
1874
1874
#if 0
1875
1875
if ((* deps )[depIdx ])
1876
1876
write_msg (modulename ,"read dependency for %s -> %s\n" ,
1877
- te -> name , (* deps )[depIdx ]);
1877
+ te -> tag , (* deps )[depIdx ]);
1878
1878
#endif
1879
1879
}while ((* deps )[depIdx ++ ]!= NULL );
1880
1880
@@ -1892,7 +1892,7 @@ ReadToc(ArchiveHandle *AH)
1892
1892
if (AH -> ReadExtraTocPtr )
1893
1893
(* AH -> ReadExtraTocPtr ) (AH ,te );
1894
1894
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 );
1896
1896
1897
1897
te -> prev = AH -> toc -> prev ;
1898
1898
AH -> toc -> prev -> next = te ;
@@ -1920,28 +1920,28 @@ _tocEntryRequired(TocEntry *te, RestoreOptions *ropt)
1920
1920
{
1921
1921
if (!ropt -> selTable )
1922
1922
return 0 ;
1923
- if (ropt -> tableNames && strcmp (ropt -> tableNames ,te -> name )!= 0 )
1923
+ if (ropt -> tableNames && strcmp (ropt -> tableNames ,te -> tag )!= 0 )
1924
1924
return 0 ;
1925
1925
}
1926
1926
else if (strcmp (te -> desc ,"INDEX" )== 0 )
1927
1927
{
1928
1928
if (!ropt -> selIndex )
1929
1929
return 0 ;
1930
- if (ropt -> indexNames && strcmp (ropt -> indexNames ,te -> name )!= 0 )
1930
+ if (ropt -> indexNames && strcmp (ropt -> indexNames ,te -> tag )!= 0 )
1931
1931
return 0 ;
1932
1932
}
1933
1933
else if (strcmp (te -> desc ,"FUNCTION" )== 0 )
1934
1934
{
1935
1935
if (!ropt -> selFunction )
1936
1936
return 0 ;
1937
- if (ropt -> functionNames && strcmp (ropt -> functionNames ,te -> name )!= 0 )
1937
+ if (ropt -> functionNames && strcmp (ropt -> functionNames ,te -> tag )!= 0 )
1938
1938
return 0 ;
1939
1939
}
1940
1940
else if (strcmp (te -> desc ,"TRIGGER" )== 0 )
1941
1941
{
1942
1942
if (!ropt -> selTrigger )
1943
1943
return 0 ;
1944
- if (ropt -> triggerNames && strcmp (ropt -> triggerNames ,te -> name )!= 0 )
1944
+ if (ropt -> triggerNames && strcmp (ropt -> triggerNames ,te -> tag )!= 0 )
1945
1945
return 0 ;
1946
1946
}
1947
1947
else
@@ -1965,10 +1965,10 @@ _tocEntryRequired(TocEntry *te, RestoreOptions *ropt)
1965
1965
}
1966
1966
1967
1967
/*
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
1969
1969
* DATA restore even though it has SQL.
1970
1970
*/
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 ))
1972
1972
res = REQ_DATA ;
1973
1973
1974
1974
/* Mask it if we only want schema */
@@ -2221,7 +2221,7 @@ _printTocEntry(ArchiveHandle *AH, TocEntry *te, RestoreOptions *ropt, bool isDat
2221
2221
pfx = "" ;
2222
2222
2223
2223
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 ,
2225
2225
te -> namespace ?te -> namespace :"-" ,
2226
2226
te -> owner );
2227
2227
if (AH -> PrintExtraTocPtr != NULL )