More message munging and localization for pg_dump, especially the

--verbose messages, which had not been considered so far.  Output to the
terminal should okay now; comments written into the dump are still English
only, which may or may not be the desirable thing.
REL7_2_STABLE
Peter Eisentraut 24 years ago
parent 3ec9fb893e
commit 30ab5bd43d
  1. 61
      src/bin/pg_dump/common.c
  2. 803
      src/bin/pg_dump/de.po
  3. 4
      src/bin/pg_dump/nls.mk
  4. 55
      src/bin/pg_dump/pg_backup_archiver.c
  5. 6
      src/bin/pg_dump/pg_backup_archiver.h
  6. 6
      src/bin/pg_dump/pg_backup_custom.c
  7. 19
      src/bin/pg_dump/pg_backup_db.c
  8. 6
      src/bin/pg_dump/pg_backup_files.c
  9. 18
      src/bin/pg_dump/pg_backup_tar.c
  10. 353
      src/bin/pg_dump/pg_dump.c
  11. 3
      src/bin/pg_dump/pg_dump.h
  12. 4
      src/bin/pg_dump/pg_restore.c
  13. 4
      src/include/c.h

@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/bin/pg_dump/common.c,v 1.56 2001/06/27 21:21:36 petere Exp $ * $Header: /cvsroot/pgsql/src/bin/pg_dump/common.c,v 1.57 2001/07/03 20:21:47 petere Exp $
* *
* Modifications - 6/12/96 - dave@bensoft.com - version 1.13.dhb.2 * Modifications - 6/12/96 - dave@bensoft.com - version 1.13.dhb.2
* *
@ -179,7 +179,7 @@ findParentsByOid(TableInfo *tblinfo, int numTables,
inhinfo[i].inhparent, inhinfo[i].inhparent,
oid); oid);
exit(2); exit_nicely();
} }
(**parentIndexes)[j] = parentInd; (**parentIndexes)[j] = parentInd;
result[j++] = tblinfo[parentInd].relname; result[j++] = tblinfo[parentInd].relname;
@ -219,7 +219,7 @@ parseNumericArray(const char *str, char **array, int arraysize)
if (argNum >= arraysize) if (argNum >= arraysize)
{ {
write_msg(NULL, "parseNumericArray: too many numbers\n"); write_msg(NULL, "parseNumericArray: too many numbers\n");
exit(2); exit_nicely();
} }
temp[j] = '\0'; temp[j] = '\0';
array[argNum++] = strdup(temp); array[argNum++] = strdup(temp);
@ -234,7 +234,7 @@ parseNumericArray(const char *str, char **array, int arraysize)
j >= sizeof(temp) - 1) j >= sizeof(temp) - 1)
{ {
write_msg(NULL, "parseNumericArray: bogus number\n"); write_msg(NULL, "parseNumericArray: bogus number\n");
exit(2); exit_nicely();
} }
temp[j++] = s; temp[j++] = s;
} }
@ -297,69 +297,57 @@ dumpSchema(Archive *fout,
IndInfo *indinfo = NULL; IndInfo *indinfo = NULL;
if (g_verbose) if (g_verbose)
fprintf(stderr, "%s reading user-defined types %s\n", write_msg(NULL, "reading user-defined types\n");
g_comment_start, g_comment_end);
tinfo = getTypes(&numTypes); tinfo = getTypes(&numTypes);
if (g_verbose) if (g_verbose)
fprintf(stderr, "%s reading user-defined functions %s\n", write_msg(NULL, "reading user-defined functions\n");
g_comment_start, g_comment_end);
finfo = getFuncs(&numFuncs); finfo = getFuncs(&numFuncs);
if (g_verbose) if (g_verbose)
fprintf(stderr, "%s reading user-defined aggregates %s\n", write_msg(NULL, "reading user-defined aggregate functions\n");
g_comment_start, g_comment_end);
agginfo = getAggregates(&numAggregates); agginfo = getAggregates(&numAggregates);
if (g_verbose) if (g_verbose)
fprintf(stderr, "%s reading user-defined operators %s\n", write_msg(NULL, "reading user-defined operators\n");
g_comment_start, g_comment_end);
oprinfo = getOperators(&numOperators); oprinfo = getOperators(&numOperators);
if (g_verbose) if (g_verbose)
fprintf(stderr, "%s reading user-defined tables %s\n", write_msg(NULL, "reading user-defined tables\n");
g_comment_start, g_comment_end);
tblinfo = getTables(&numTables, finfo, numFuncs); tblinfo = getTables(&numTables, finfo, numFuncs);
if (g_verbose) if (g_verbose)
fprintf(stderr, "%s reading indexes information %s\n", write_msg(NULL, "reading index information\n");
g_comment_start, g_comment_end);
indinfo = getIndexes(&numIndexes); indinfo = getIndexes(&numIndexes);
if (g_verbose) if (g_verbose)
fprintf(stderr, "%s reading table inheritance information %s\n", write_msg(NULL, "reading table inheritance information\n");
g_comment_start, g_comment_end);
inhinfo = getInherits(&numInherits); inhinfo = getInherits(&numInherits);
if (g_verbose) if (g_verbose)
fprintf(stderr, "%s finding the attribute names and types for each table %s\n", write_msg(NULL, "finding the column names and types for each table\n");
g_comment_start, g_comment_end);
getTableAttrs(tblinfo, numTables); getTableAttrs(tblinfo, numTables);
if (g_verbose) if (g_verbose)
fprintf(stderr, "%s flagging inherited attributes in subtables %s\n", write_msg(NULL, "flagging inherited columns in subtables\n");
g_comment_start, g_comment_end);
flagInhAttrs(tblinfo, numTables, inhinfo, numInherits); flagInhAttrs(tblinfo, numTables, inhinfo, numInherits);
if (!tablename && !dataOnly) if (!tablename && !dataOnly)
{ {
if (g_verbose) if (g_verbose)
fprintf(stderr, "%s dumping out database comment %s\n", write_msg(NULL, "dumping out database comment\n");
g_comment_start, g_comment_end);
dumpDBComment(fout); dumpDBComment(fout);
} }
if (!tablename && fout) if (!tablename && fout)
{ {
if (g_verbose) if (g_verbose)
fprintf(stderr, "%s dumping out user-defined types %s\n", write_msg(NULL, "dumping out user-defined types\n");
g_comment_start, g_comment_end);
dumpTypes(fout, finfo, numFuncs, tinfo, numTypes); dumpTypes(fout, finfo, numFuncs, tinfo, numTypes);
} }
if (g_verbose) if (g_verbose)
fprintf(stderr, "%s dumping out tables %s\n", write_msg(NULL, "dumping out tables\n");
g_comment_start, g_comment_end);
dumpTables(fout, tblinfo, numTables, indinfo, numIndexes, inhinfo, numInherits, dumpTables(fout, tblinfo, numTables, indinfo, numIndexes, inhinfo, numInherits,
tinfo, numTypes, tablename, aclsSkip, oids, schemaOnly, dataOnly); tinfo, numTypes, tablename, aclsSkip, oids, schemaOnly, dataOnly);
@ -367,40 +355,35 @@ dumpSchema(Archive *fout,
if (fout && !dataOnly) if (fout && !dataOnly)
{ {
if (g_verbose) if (g_verbose)
fprintf(stderr, "%s dumping out indexes %s\n", write_msg(NULL, "dumping out indexes\n");
g_comment_start, g_comment_end);
dumpIndexes(fout, indinfo, numIndexes, tblinfo, numTables, tablename); dumpIndexes(fout, indinfo, numIndexes, tblinfo, numTables, tablename);
} }
if (!tablename && !dataOnly) if (!tablename && !dataOnly)
{ {
if (g_verbose) if (g_verbose)
fprintf(stderr, "%s dumping out user-defined procedural languages %s\n", write_msg(NULL, "dumping out user-defined procedural languages\n");
g_comment_start, g_comment_end);
dumpProcLangs(fout, finfo, numFuncs, tinfo, numTypes); dumpProcLangs(fout, finfo, numFuncs, tinfo, numTypes);
} }
if (!tablename && !dataOnly) if (!tablename && !dataOnly)
{ {
if (g_verbose) if (g_verbose)
fprintf(stderr, "%s dumping out user-defined functions %s\n", write_msg(NULL, "dumping out user-defined functions\n");
g_comment_start, g_comment_end);
dumpFuncs(fout, finfo, numFuncs, tinfo, numTypes); dumpFuncs(fout, finfo, numFuncs, tinfo, numTypes);
} }
if (!tablename && !dataOnly) if (!tablename && !dataOnly)
{ {
if (g_verbose) if (g_verbose)
fprintf(stderr, "%s dumping out user-defined aggregates %s\n", write_msg(NULL, "dumping out user-defined aggregate functions\n");
g_comment_start, g_comment_end);
dumpAggs(fout, agginfo, numAggregates, tinfo, numTypes); dumpAggs(fout, agginfo, numAggregates, tinfo, numTypes);
} }
if (!tablename && !dataOnly) if (!tablename && !dataOnly)
{ {
if (g_verbose) if (g_verbose)
fprintf(stderr, "%s dumping out user-defined operators %s\n", write_msg(NULL, "dumping out user-defined operators\n");
g_comment_start, g_comment_end);
dumpOprs(fout, oprinfo, numOperators, tinfo, numTypes); dumpOprs(fout, oprinfo, numOperators, tinfo, numTypes);
} }
@ -490,7 +473,7 @@ flagInhAttrs(TableInfo *tblinfo, int numTables,
/* shouldn't happen unless findParentsByOid is broken */ /* shouldn't happen unless findParentsByOid is broken */
write_msg(NULL, "failed sanity check, table \"%s\" not found by flagInhAttrs\n", write_msg(NULL, "failed sanity check, table \"%s\" not found by flagInhAttrs\n",
tblinfo[i].parentRels[k]); tblinfo[i].parentRels[k]);
exit(2); exit_nicely();
}; };
inhAttrInd = strInArray(tblinfo[i].attnames[j], inhAttrInd = strInArray(tblinfo[i].attnames[j],

File diff suppressed because it is too large Load Diff

@ -1,8 +1,8 @@
# $Header: /cvsroot/pgsql/src/bin/pg_dump/nls.mk,v 1.1 2001/06/27 21:21:37 petere Exp $ # $Header: /cvsroot/pgsql/src/bin/pg_dump/nls.mk,v 1.2 2001/07/03 20:21:48 petere Exp $
CATALOG_NAME := pg_dump CATALOG_NAME := pg_dump
AVAIL_LANGUAGES := de AVAIL_LANGUAGES := de
GETTEXT_FILES := pg_dump.c common.c pg_backup_archiver.c pg_backup_custom.c \ GETTEXT_FILES := pg_dump.c common.c pg_backup_archiver.c pg_backup_custom.c \
pg_backup_db.c pg_backup_files.c pg_backup_null.c \ pg_backup_db.c pg_backup_files.c pg_backup_null.c \
pg_backup_tar.c pg_restore.c pg_backup_tar.c pg_restore.c
GETTEXT_TRIGGERS:= write_msg:2 die_horribly:3 exit_horribly:3 simple_prompt \ GETTEXT_TRIGGERS:= write_msg:2 die_horribly:3 exit_horribly:3 simple_prompt \
ExecuteSqlCommand:3 ExecuteSqlCommand:3 ahlog:3

@ -15,7 +15,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_archiver.c,v 1.28 2001/06/27 21:21:37 petere Exp $ * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_archiver.c,v 1.29 2001/07/03 20:21:48 petere Exp $
* *
* Modifications - 28-Jun-2000 - pjw@rhyme.com.au * Modifications - 28-Jun-2000 - pjw@rhyme.com.au
* *
@ -91,7 +91,7 @@ static void _fixupOidInfo(TocEntry *te);
static Oid _findMaxOID(const char *((*deps)[])); static Oid _findMaxOID(const char *((*deps)[]));
const char *progname; const char *progname;
static char *modulename = "archiver"; static char *modulename = gettext_noop("archiver");
static void _write_msg(const char *modulename, const char *fmt, va_list ap); static void _write_msg(const char *modulename, const char *fmt, va_list ap);
static void _die_horribly(ArchiveHandle *AH, const char *modulename, const char *fmt, va_list ap); static void _die_horribly(ArchiveHandle *AH, const char *modulename, const char *fmt, va_list ap);
@ -170,7 +170,7 @@ RestoreArchive(Archive *AHX, RestoreOptions *ropt)
*/ */
if (ropt->useDB) if (ropt->useDB)
{ {
ahlog(AH, 1, "Connecting to database for restore\n"); ahlog(AH, 1, "connecting to database for restore\n");
if (AH->version < K_VERS_1_3) if (AH->version < K_VERS_1_3)
die_horribly(AH, modulename, "direct database connections are not supported in pre-1.3 archives\n"); die_horribly(AH, modulename, "direct database connections are not supported in pre-1.3 archives\n");
@ -219,7 +219,7 @@ RestoreArchive(Archive *AHX, RestoreOptions *ropt)
if (impliedDataOnly) if (impliedDataOnly)
{ {
ropt->dataOnly = impliedDataOnly; ropt->dataOnly = impliedDataOnly;
ahlog(AH, 1, "Implied data-only restore\n"); ahlog(AH, 1, "implied data-only restore\n");
} }
} }
@ -247,8 +247,9 @@ RestoreArchive(Archive *AHX, RestoreOptions *ropt)
{ {
reqs = _tocEntryRequired(te, ropt); reqs = _tocEntryRequired(te, ropt);
if (((reqs & 1) != 0) && te->dropStmt) if (((reqs & 1) != 0) && te->dropStmt)
{ /* We want the schema */ {
ahlog(AH, 1, "Dropping %s %s\n", te->desc, te->name); /* We want the schema */
ahlog(AH, 1, "dropping %s %s\n", te->desc, te->name);
/* Reconnect if necessary */ /* Reconnect if necessary */
_reconnectAsOwner(AH, "-", te); _reconnectAsOwner(AH, "-", te);
/* Drop it */ /* Drop it */
@ -284,14 +285,14 @@ RestoreArchive(Archive *AHX, RestoreOptions *ropt)
/* Reconnect if necessary */ /* Reconnect if necessary */
_reconnectAsOwner(AH, "-", te); _reconnectAsOwner(AH, "-", te);
ahlog(AH, 1, "Creating %s %s\n", te->desc, te->name); ahlog(AH, 1, "creating %s %s\n", te->desc, te->name);
_printTocEntry(AH, te, ropt, false); _printTocEntry(AH, te, ropt, false);
defnDumped = true; defnDumped = true;
/* If we created a DB, connect to it... */ /* If we created a DB, connect to it... */
if (strcmp(te->desc, "DATABASE") == 0) if (strcmp(te->desc, "DATABASE") == 0)
{ {
ahlog(AH, 1, "Connecting to new DB '%s' as %s\n", te->name, te->owner); ahlog(AH, 1, "connecting to new database %s as user %s\n", te->name, te->owner);
_reconnectAsUser(AH, te->name, te->owner); _reconnectAsUser(AH, te->name, te->owner);
} }
} }
@ -346,7 +347,7 @@ RestoreArchive(Archive *AHX, RestoreOptions *ropt)
*/ */
_reconnectAsOwner(AH, "-", te); _reconnectAsOwner(AH, "-", te);
ahlog(AH, 1, "Restoring data for %s \n", te->name); ahlog(AH, 1, "restoring data for table %s\n", te->name);
/* /*
* If we have a copy statement, use it. As of V1.3, these * If we have a copy statement, use it. As of V1.3, these
@ -367,7 +368,7 @@ RestoreArchive(Archive *AHX, RestoreOptions *ropt)
} }
} else if (!defnDumped) { } else if (!defnDumped) {
/* If we haven't already dumped the defn part, do so now */ /* 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->name);
_printTocEntry(AH, te, ropt, false); _printTocEntry(AH, te, ropt, false);
} }
} }
@ -391,18 +392,18 @@ RestoreArchive(Archive *AHX, RestoreOptions *ropt)
if (strcmp(te->desc, "TABLE DATA") == 0) if (strcmp(te->desc, "TABLE DATA") == 0)
{ {
ahlog(AH, 2, "Checking if we loaded %s\n", te->name); ahlog(AH, 2, "checking whether we loaded %s\n", te->name);
reqs = _tocEntryRequired(te, ropt); reqs = _tocEntryRequired(te, ropt);
if ((reqs & 2) != 0) /* We loaded the data */ if ((reqs & 2) != 0) /* We loaded the data */
{ {
ahlog(AH, 1, "Fixing up BLOB ref for %s\n", te->name); ahlog(AH, 1, "fixing up BLOB reference for %s\n", te->name);
FixupBlobRefs(AH, te->name); FixupBlobRefs(AH, te->name);
} }
} }
else else
ahlog(AH, 2, "Ignoring BLOB xrefs for %s %s\n", te->desc, te->name); ahlog(AH, 2, "ignoring BLOB cross-references for %s %s\n", te->desc, te->name);
te = te->next; te = te->next;
} }
@ -489,7 +490,7 @@ _disableTriggersIfNecessary(ArchiveHandle *AH, TocEntry *te, RestoreOptions *rop
} }
} }
ahlog(AH, 1, "Disabling triggers\n"); ahlog(AH, 1, "disabling triggers\n");
/* /*
* Disable them. This is a hack. Needs to be done via an appropriate * Disable them. This is a hack. Needs to be done via an appropriate
@ -549,7 +550,7 @@ _enableTriggersIfNecessary(ArchiveHandle *AH, TocEntry *te, RestoreOptions *ropt
} }
} }
ahlog(AH, 1, "Enabling triggers\n"); ahlog(AH, 1, "enabling triggers\n");
/* /*
* Enable them. This is a hack. Needs to be done via an appropriate * Enable them. This is a hack. Needs to be done via an appropriate
@ -752,14 +753,14 @@ EndRestoreBlobs(ArchiveHandle *AH)
{ {
if (AH->txActive) if (AH->txActive)
{ {
ahlog(AH, 2, "Committing BLOB transactions\n"); ahlog(AH, 2, "committing BLOB transactions\n");
CommitTransaction(AH); CommitTransaction(AH);
} }
if (AH->blobTxActive) if (AH->blobTxActive)
CommitTransactionXref(AH); CommitTransactionXref(AH);
ahlog(AH, 1, "Restored %d BLOBs\n", AH->blobCount); ahlog(AH, 1, "restored %d BLOBs\n", AH->blobCount);
} }
@ -769,7 +770,7 @@ EndRestoreBlobs(ArchiveHandle *AH)
void void
StartRestoreBlob(ArchiveHandle *AH, Oid oid) StartRestoreBlob(ArchiveHandle *AH, Oid oid)
{ {
int loOid; Oid loOid;
AH->blobCount++; AH->blobCount++;
@ -787,7 +788,7 @@ StartRestoreBlob(ArchiveHandle *AH, Oid oid)
*/ */
if (!AH->txActive) if (!AH->txActive)
{ {
ahlog(AH, 2, "Starting BLOB transactions\n"); ahlog(AH, 2, "starting BLOB transactions\n");
StartTransaction(AH); StartTransaction(AH);
} }
if (!AH->blobTxActive) if (!AH->blobTxActive)
@ -797,7 +798,7 @@ StartRestoreBlob(ArchiveHandle *AH, Oid oid)
if (loOid == 0) if (loOid == 0)
die_horribly(AH, modulename, "could not create BLOB\n"); die_horribly(AH, modulename, "could not create BLOB\n");
ahlog(AH, 2, "Restoring BLOB oid %d as %d\n", oid, loOid); ahlog(AH, 2, "restoring BLOB oid %u as %u\n", oid, loOid);
InsertBlobXref(AH, oid, loOid); InsertBlobXref(AH, oid, loOid);
@ -819,7 +820,7 @@ EndRestoreBlob(ArchiveHandle *AH, Oid oid)
*/ */
if (((AH->blobCount / BLOB_BATCH_SIZE) * BLOB_BATCH_SIZE) == AH->blobCount) if (((AH->blobCount / BLOB_BATCH_SIZE) * BLOB_BATCH_SIZE) == AH->blobCount)
{ {
ahlog(AH, 2, "Committing BLOB transactions\n"); ahlog(AH, 2, "committing BLOB transactions\n");
CommitTransaction(AH); CommitTransaction(AH);
CommitTransactionXref(AH); CommitTransactionXref(AH);
} }
@ -1166,7 +1167,7 @@ ahlog(ArchiveHandle *AH, int level, const char *fmt,...)
return; return;
va_start(ap, fmt); va_start(ap, fmt);
vfprintf(stderr, fmt, ap); _write_msg(NULL, fmt, ap);
va_end(ap); va_end(ap);
} }
@ -1193,7 +1194,7 @@ ahwrite(const void *ptr, size_t size, size_t nmemb, ArchiveHandle *AH)
if (AH->writingBlob) if (AH->writingBlob)
{ {
res = lo_write(AH->connection, AH->loFd, (void *) ptr, size * nmemb); res = lo_write(AH->connection, AH->loFd, (void *) ptr, size * nmemb);
ahlog(AH, 5, "Wrote %d bytes of BLOB data (result = %d)\n", size * nmemb, res); ahlog(AH, 5, "wrote %d bytes of BLOB data (result = %d)\n", size * nmemb, res);
if (res < size * nmemb) if (res < size * nmemb)
die_horribly(AH, modulename, "could not write to large object (result: %d, expected: %d)\n", die_horribly(AH, modulename, "could not write to large object (result: %d, expected: %d)\n",
res, size * nmemb); res, size * nmemb);
@ -1239,7 +1240,7 @@ static void
_write_msg(const char *modulename, const char *fmt, va_list ap) _write_msg(const char *modulename, const char *fmt, va_list ap)
{ {
if (modulename) if (modulename)
fprintf(stderr, "%s[%s]: ", progname, gettext(modulename)); fprintf(stderr, "%s: [%s] ", progname, gettext(modulename));
else else
fprintf(stderr, "%s: ", progname); fprintf(stderr, "%s: ", progname);
vfprintf(stderr, gettext(fmt), ap); vfprintf(stderr, gettext(fmt), ap);
@ -1260,6 +1261,8 @@ static void
_die_horribly(ArchiveHandle *AH, const char *modulename, const char *fmt, va_list ap) _die_horribly(ArchiveHandle *AH, const char *modulename, const char *fmt, va_list ap)
{ {
_write_msg(modulename, fmt, ap); _write_msg(modulename, fmt, ap);
if (AH->public.verbose)
write_msg(NULL, "*** aborted because of error\n");
if (AH) if (AH)
if (AH->connection) if (AH->connection)
@ -1813,7 +1816,7 @@ ReadToc(ArchiveHandle *AH)
if (AH->ReadExtraTocPtr) if (AH->ReadExtraTocPtr)
(*AH->ReadExtraTocPtr) (AH, te); (*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->name);
te->prev = AH->toc->prev; te->prev = AH->toc->prev;
AH->toc->prev->next = te; AH->toc->prev->next = te;
@ -2052,7 +2055,7 @@ ReadHead(ArchiveHandle *AH)
AH->createDate = mktime(&crtm); AH->createDate = mktime(&crtm);
if (AH->createDate == (time_t) -1) if (AH->createDate == (time_t) -1)
write_msg(modulename, "WARNING: bad creation date in header\n"); write_msg(modulename, "WARNING: invalid creation date in header\n");
} }
} }

@ -17,7 +17,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_archiver.h,v 1.35 2001/06/27 21:21:37 petere Exp $ * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_archiver.h,v 1.36 2001/07/03 20:21:48 petere Exp $
* *
* Modifications - 28-Jun-2000 - pjw@rhyme.com.au * Modifications - 28-Jun-2000 - pjw@rhyme.com.au
* - Initial version. * - Initial version.
@ -316,8 +316,8 @@ extern char *ConnectedUser(ArchiveHandle *AH);
extern int ConnectedUserIsSuperuser(ArchiveHandle *AH); extern int ConnectedUserIsSuperuser(ArchiveHandle *AH);
int ahwrite(const void *ptr, size_t size, size_t nmemb, ArchiveHandle *AH); int ahwrite(const void *ptr, size_t size, size_t nmemb, ArchiveHandle *AH);
int ahprintf(ArchiveHandle *AH, const char *fmt,...); int ahprintf(ArchiveHandle *AH, const char *fmt,...) __attribute__((format(printf,2,3)));
void ahlog(ArchiveHandle *AH, int level, const char *fmt,...); void ahlog(ArchiveHandle *AH, int level, const char *fmt,...) __attribute__((format(printf,3,4)));
#endif #endif

@ -19,7 +19,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_custom.c,v 1.12 2001/06/27 21:21:37 petere Exp $ * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_custom.c,v 1.13 2001/07/03 20:21:48 petere Exp $
* *
* Modifications - 28-Jun-2000 - pjw@rhyme.com.au * Modifications - 28-Jun-2000 - pjw@rhyme.com.au
* *
@ -102,7 +102,7 @@ static void _EndDataCompressor(ArchiveHandle *AH, TocEntry *te);
static int _getFilePos(ArchiveHandle *AH, lclContext *ctx); static int _getFilePos(ArchiveHandle *AH, lclContext *ctx);
static int _DoDeflate(ArchiveHandle *AH, lclContext *ctx, int flush); static int _DoDeflate(ArchiveHandle *AH, lclContext *ctx, int flush);
static char *modulename = "custom archiver"; static char *modulename = gettext_noop("custom archiver");
@ -193,7 +193,7 @@ InitArchiveFmt_Custom(ArchiveHandle *AH)
else else
AH->FH = stdin; AH->FH = stdin;
if (!AH->FH) if (!AH->FH)
die_horribly(AH, modulename, "could not open archive file %s: %s", AH->fSpec, strerror(errno)); die_horribly(AH, modulename, "could not open archive file %s: %s\n", AH->fSpec, strerror(errno));
ctx->hasSeek = (fseek(AH->FH, 0, SEEK_CUR) == 0); ctx->hasSeek = (fseek(AH->FH, 0, SEEK_CUR) == 0);

@ -5,7 +5,7 @@
* Implements the basic DB functions used by the archiver. * Implements the basic DB functions used by the archiver.
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_db.c,v 1.20 2001/06/27 21:21:37 petere Exp $ * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_db.c,v 1.21 2001/07/03 20:21:48 petere Exp $
* *
* NOTES * NOTES
* *
@ -20,7 +20,6 @@
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
#include "pg_dump.h"
#include "pg_backup.h" #include "pg_backup.h"
#include "pg_backup_archiver.h" #include "pg_backup_archiver.h"
#include "pg_backup_db.h" #include "pg_backup_db.h"
@ -38,7 +37,7 @@
#include "strdup.h" #include "strdup.h"
#endif #endif
static const char *modulename = "archiver (db)"; static const char *modulename = gettext_noop("archiver (db)");
static void _check_database_version(ArchiveHandle *AH, bool ignoreVersion); static void _check_database_version(ArchiveHandle *AH, bool ignoreVersion);
static PGconn *_connectDB(ArchiveHandle *AH, const char *newdbname, char *newUser); static PGconn *_connectDB(ArchiveHandle *AH, const char *newdbname, char *newUser);
@ -275,7 +274,7 @@ _connectDB(ArchiveHandle *AH, const char *reqdb, char *requser)
else else
newuser = (char *) requser; newuser = (char *) requser;
ahlog(AH, 1, "Connecting to %s as %s\n", newdb, newuser); ahlog(AH, 1, "connecting to database %s as user %s\n", newdb, newuser);
if (AH->requirePassword) if (AH->requirePassword)
{ {
@ -347,7 +346,7 @@ ConnectDatabase(Archive *AHX,
bool need_pass = false; bool need_pass = false;
if (AH->connection) if (AH->connection)
die_horribly(AH, modulename, "already connected to database\n"); die_horribly(AH, modulename, "already connected to a database\n");
if (!dbname && !(dbname = getenv("PGDATABASE"))) if (!dbname && !(dbname = getenv("PGDATABASE")))
die_horribly(AH, modulename, "no database name specified\n"); die_horribly(AH, modulename, "no database name specified\n");
@ -449,7 +448,7 @@ _executeSqlCommand(ArchiveHandle *AH, PGconn *conn, PQExpBuffer qry, char *desc)
/* fprintf(stderr, "Executing: '%s'\n\n", qry->data); */ /* fprintf(stderr, "Executing: '%s'\n\n", qry->data); */
res = PQexec(conn, qry->data); res = PQexec(conn, qry->data);
if (!res) if (!res)
die_horribly(AH, modulename, "%s: no result from backend\n", desc); die_horribly(AH, modulename, "%s: no result from server\n", desc);
if (PQresultStatus(res) != PGRES_COMMAND_OK && PQresultStatus(res) != PGRES_TUPLES_OK) if (PQresultStatus(res) != PGRES_COMMAND_OK && PQresultStatus(res) != PGRES_TUPLES_OK)
{ {
@ -701,7 +700,7 @@ FixupBlobRefs(ArchiveHandle *AH, char *tablename)
if ((n = PQntuples(res)) == 0) if ((n = PQntuples(res)) == 0)
{ {
/* We're done */ /* We're done */
ahlog(AH, 1, "No OID attributes in table %s\n", tablename); ahlog(AH, 1, "no OID type columns in table %s\n", tablename);
PQclear(res); PQclear(res);
return; return;
} }
@ -710,7 +709,7 @@ FixupBlobRefs(ArchiveHandle *AH, char *tablename)
{ {
attr = PQgetvalue(res, i, 0); attr = PQgetvalue(res, i, 0);
ahlog(AH, 1, " - %s.%s\n", tablename, attr); ahlog(AH, 1, "fixing BLOB cross-references for %s.%s\n", tablename, attr);
resetPQExpBuffer(tblQry); resetPQExpBuffer(tblQry);
@ -725,7 +724,7 @@ FixupBlobRefs(ArchiveHandle *AH, char *tablename)
"(select * from %s x where x.oldOid = \"%s\".\"%s\");", "(select * from %s x where x.oldOid = \"%s\".\"%s\");",
BLOB_XREF_TABLE, tablename, attr); BLOB_XREF_TABLE, tablename, attr);
ahlog(AH, 10, " - sql:\n%s\n", tblQry->data); ahlog(AH, 10, "SQL: %s\n", tblQry->data);
uRes = PQexec(AH->blobConnection, tblQry->data); uRes = PQexec(AH->blobConnection, tblQry->data);
if (!uRes) if (!uRes)
@ -757,7 +756,7 @@ CreateBlobXrefTable(ArchiveHandle *AH)
if (!AH->blobConnection) if (!AH->blobConnection)
AH->blobConnection = _connectDB(AH, NULL, NULL); AH->blobConnection = _connectDB(AH, NULL, NULL);
ahlog(AH, 1, "Creating table for BLOBS xrefs\n"); ahlog(AH, 1, "creating table for BLOB cross-references\n");
appendPQExpBuffer(qry, "Create Temporary Table %s(oldOid oid, newOid oid);", BLOB_XREF_TABLE); appendPQExpBuffer(qry, "Create Temporary Table %s(oldOid oid, newOid oid);", BLOB_XREF_TABLE);

@ -20,7 +20,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_files.c,v 1.11 2001/06/27 21:21:37 petere Exp $ * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_files.c,v 1.12 2001/07/03 20:21:48 petere Exp $
* *
* Modifications - 28-Jun-2000 - pjw@rhyme.com.au * Modifications - 28-Jun-2000 - pjw@rhyme.com.au
* *
@ -74,7 +74,7 @@ typedef struct
char *filename; char *filename;
} lclTocEntry; } lclTocEntry;
static char *modulename = "file archiver"; static char *modulename = gettext_noop("file archiver");
static void _LoadBlobs(ArchiveHandle *AH, RestoreOptions *ropt); static void _LoadBlobs(ArchiveHandle *AH, RestoreOptions *ropt);
static void _getBlobTocEntry(ArchiveHandle *AH, int *oid, char *fname); static void _getBlobTocEntry(ArchiveHandle *AH, int *oid, char *fname);
@ -120,7 +120,7 @@ InitArchiveFmt_Files(ArchiveHandle *AH)
{ {
write_msg(modulename, "WARNING:\n" write_msg(modulename, "WARNING:\n"
" This format is for demonstration purposes, it is not intended for\n" " This format is for demonstration purposes; it is not intended for\n"
" normal use. Files will be written in the current working directory.\n"); " normal use. Files will be written in the current working directory.\n");
if (AH->fSpec && strcmp(AH->fSpec, "") != 0) if (AH->fSpec && strcmp(AH->fSpec, "") != 0)

@ -16,7 +16,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_tar.c,v 1.16 2001/06/27 21:21:37 petere Exp $ * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_tar.c,v 1.17 2001/07/03 20:21:48 petere Exp $
* *
* Modifications - 28-Jun-2000 - pjw@rhyme.com.au * Modifications - 28-Jun-2000 - pjw@rhyme.com.au
* *
@ -101,7 +101,7 @@ typedef struct
char *filename; char *filename;
} lclTocEntry; } lclTocEntry;
static char *modulename = "tar archiver"; static char *modulename = gettext_noop("tar archiver");
static void _LoadBlobs(ArchiveHandle *AH, RestoreOptions *ropt); static void _LoadBlobs(ArchiveHandle *AH, RestoreOptions *ropt);
@ -698,7 +698,7 @@ _PrintTocData(ArchiveHandle *AH, TocEntry *te, RestoreOptions *ropt)
static void static void
_LoadBlobs(ArchiveHandle *AH, RestoreOptions *ropt) _LoadBlobs(ArchiveHandle *AH, RestoreOptions *ropt)
{ {
int oid; Oid oid;
lclContext *ctx = (lclContext *) AH->formatData; lclContext *ctx = (lclContext *) AH->formatData;
TAR_MEMBER *th; TAR_MEMBER *th;
int cnt; int cnt;
@ -711,11 +711,11 @@ _LoadBlobs(ArchiveHandle *AH, RestoreOptions *ropt)
{ {
ctx->FH = th; ctx->FH = th;
oid = atoi(&th->targetFile[5]); oid = (Oid)strtoul(&th->targetFile[5], NULL, 10);
if (strncmp(th->targetFile, "blob_", 5) == 0 && oid != 0) if (strncmp(th->targetFile, "blob_", 5) == 0 && oid != 0)
{ {
ahlog(AH, 1, " - Restoring BLOB oid %d\n", oid); ahlog(AH, 1, "restoring BLOB oid %u\n", oid);
StartRestoreBlob(AH, oid); StartRestoreBlob(AH, oid);
@ -1088,7 +1088,7 @@ _tarPositionTo(ArchiveHandle *AH, const char *filename)
/* Go to end of current file, if any */ /* Go to end of current file, if any */
if (ctx->tarFHpos != 0) if (ctx->tarFHpos != 0)
{ {
ahlog(AH, 4, "Moving from %d (%x) to next member at file position %d (%x)\n", ahlog(AH, 4, "moving from position %d (%x) to next member at file position %d (%x)\n",
ctx->tarFHpos, ctx->tarFHpos, ctx->tarFHpos, ctx->tarFHpos,
ctx->tarNextMember, ctx->tarNextMember); ctx->tarNextMember, ctx->tarNextMember);
@ -1096,7 +1096,7 @@ _tarPositionTo(ArchiveHandle *AH, const char *filename)
_tarReadRaw(AH, &c, 1, NULL, ctx->tarFH); _tarReadRaw(AH, &c, 1, NULL, ctx->tarFH);
} }
ahlog(AH, 4, "Now at file position %d (%x)\n", ctx->tarFHpos, ctx->tarFHpos); ahlog(AH, 4, "now at file position %d (%x)\n", ctx->tarFHpos, ctx->tarFHpos);
/* We are at the start of the file. or at the next member */ /* We are at the start of the file. or at the next member */
@ -1115,7 +1115,7 @@ _tarPositionTo(ArchiveHandle *AH, const char *filename)
while (filename != NULL && strcmp(th->targetFile, filename) != 0) while (filename != NULL && strcmp(th->targetFile, filename) != 0)
{ {
ahlog(AH, 4, "Skipping member %s\n", th->targetFile); ahlog(AH, 4, "skipping tar member %s\n", th->targetFile);
id = atoi(th->targetFile); id = atoi(th->targetFile);
if ((TocIDRequired(AH, id, AH->ropt) & 2) != 0) if ((TocIDRequired(AH, id, AH->ropt) & 2) != 0)
@ -1202,7 +1202,7 @@ _tarGetHeader(ArchiveHandle *AH, TAR_MEMBER *th)
sscanf(&h[124], "%12o", &len); sscanf(&h[124], "%12o", &len);
sscanf(&h[148], "%8o", &sum); sscanf(&h[148], "%8o", &sum);
ahlog(AH, 3, "TOC Entry %s at %d (len=%d, chk=%d)\n", &name[0], hPos, len, sum); ahlog(AH, 3, "TOC Entry %s at %d (length %d, checksum %d)\n", &name[0], hPos, len, sum);
if (chk != sum) if (chk != sum)
die_horribly(AH, modulename, die_horribly(AH, modulename,

@ -22,7 +22,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.212 2001/06/27 21:21:37 petere Exp $ * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.213 2001/07/03 20:21:49 petere Exp $
* *
* Modifications - 6/10/96 - dave@bensoft.com - version 1.13.dhb * Modifications - 6/10/96 - dave@bensoft.com - version 1.13.dhb
* *
@ -314,10 +314,12 @@ help(const char *progname)
} }
static void void
exit_nicely(PGconn *conn) exit_nicely(void)
{ {
PQfinish(conn); PQfinish(g_conn);
if (g_verbose)
write_msg(NULL, "*** aborted because of error\n");
exit(1); exit(1);
} }
@ -344,7 +346,7 @@ dumpClasses_nodumpData(Archive *fout, char *oid, void *dctxv)
char copybuf[COPYBUFSIZ]; char copybuf[COPYBUFSIZ];
if (g_verbose) if (g_verbose)
fprintf(stderr, "%s dumping out the contents of table %s\n", g_comment_start, classname); write_msg(NULL, "dumping out the contents of table %s\n", classname);
if (oids == true) if (oids == true)
{ {
@ -381,7 +383,7 @@ dumpClasses_nodumpData(Archive *fout, char *oid, void *dctxv)
classname); classname);
write_msg(NULL, "Error message from server: %s", PQerrorMessage(g_conn)); write_msg(NULL, "Error message from server: %s", PQerrorMessage(g_conn));
write_msg(NULL, "The command was: %s\n", query); write_msg(NULL, "The command was: %s\n", query);
exit_nicely(g_conn); exit_nicely();
} }
else else
{ {
@ -392,7 +394,7 @@ dumpClasses_nodumpData(Archive *fout, char *oid, void *dctxv)
write_msg(NULL, "The server returned status %d when %d was expected.\n", write_msg(NULL, "The server returned status %d when %d was expected.\n",
PQresultStatus(res), PGRES_COPY_OUT); PQresultStatus(res), PGRES_COPY_OUT);
write_msg(NULL, "The command was: %s\n", query); write_msg(NULL, "The command was: %s\n", query);
exit_nicely(g_conn); exit_nicely();
} }
else else
{ {
@ -478,7 +480,7 @@ dumpClasses_nodumpData(Archive *fout, char *oid, void *dctxv)
write_msg(NULL, "Error message from server: %s", PQerrorMessage(g_conn)); write_msg(NULL, "Error message from server: %s", PQerrorMessage(g_conn));
write_msg(NULL, "The command was: %s\n", query); write_msg(NULL, "The command was: %s\n", query);
PQclear(res); PQclear(res);
exit_nicely(g_conn); exit_nicely();
} }
} }
@ -510,7 +512,7 @@ dumpClasses_dumpData(Archive *fout, char *oid, void *dctxv)
write_msg(NULL, "dumpClasses(): SQL command failed\n"); write_msg(NULL, "dumpClasses(): SQL command failed\n");
write_msg(NULL, "Error message from server: %s", PQerrorMessage(g_conn)); write_msg(NULL, "Error message from server: %s", PQerrorMessage(g_conn));
write_msg(NULL, "The command was: %s\n", q->data); write_msg(NULL, "The command was: %s\n", q->data);
exit_nicely(g_conn); exit_nicely();
} }
for (tuple = 0; tuple < PQntuples(res); tuple++) for (tuple = 0; tuple < PQntuples(res); tuple++)
{ {
@ -623,18 +625,12 @@ dumpClasses(const TableInfo *tblinfo, const int numTables, Archive *fout,
{ {
int i; int i;
char *all_only;
DataDumperPtr dumpFn; DataDumperPtr dumpFn;
DumpContext *dumpCtx; DumpContext *dumpCtx;
char *oidsPart; char *oidsPart;
char copyBuf[512]; char copyBuf[512];
char *copyStmt; char *copyStmt;
if (onlytable == NULL || (strlen(onlytable) == 0))
all_only = "all";
else
all_only = "only";
if (oids == true) if (oids == true)
oidsPart = "WITH OIDS "; oidsPart = "WITH OIDS ";
else else
@ -642,12 +638,12 @@ dumpClasses(const TableInfo *tblinfo, const int numTables, Archive *fout,
if (g_verbose) if (g_verbose)
fprintf(stderr, "%s preparing to dump out the contents of %s %d table%s/sequence%s %s\n", {
g_comment_start, all_only, if (onlytable == NULL || (strlen(onlytable) == 0))
(onlytable == NULL || (strlen(onlytable) == 0)) ? numTables : 1, write_msg(NULL, "preparing to dump the contents of all %d tables/sequences\n", numTables);
(onlytable == NULL || (strlen(onlytable) == 0)) ? "s" : "", else
(onlytable == NULL || (strlen(onlytable) == 0)) ? "s" : "", write_msg(NULL, "preparing to dump the contents of only one table/sequence\n");
g_comment_end); }
for (i = 0; i < numTables; i++) for (i = 0; i < numTables; i++)
{ {
@ -663,10 +659,11 @@ dumpClasses(const TableInfo *tblinfo, const int numTables, Archive *fout,
if (!onlytable || (strcmp(classname, onlytable) == 0) || (strlen(onlytable) == 0)) if (!onlytable || (strcmp(classname, onlytable) == 0) || (strlen(onlytable) == 0))
{ {
if (g_verbose) if (g_verbose)
fprintf(stderr, "%s preparing to dump out the contents of Table '%s' %s\n", write_msg(NULL, "preparing to dump the contents of table %s\n", classname);
g_comment_start, classname, g_comment_end);
/* becomeUser(fout, tblinfo[i].usename); */ #if 0
becomeUser(fout, tblinfo[i].usename);
#endif
dumpCtx = (DumpContext *) malloc(sizeof(DumpContext)); dumpCtx = (DumpContext *) malloc(sizeof(DumpContext));
dumpCtx->tblinfo = (TableInfo *) tblinfo; dumpCtx->tblinfo = (TableInfo *) tblinfo;
@ -921,7 +918,7 @@ main(int argc, char **argv)
case 'u': case 'u':
force_password = true; force_password = true;
username = simple_prompt("Username: ", 100, true); username = simple_prompt("User name: ", 100, true);
break; break;
case 'U': case 'U':
@ -981,7 +978,7 @@ main(int argc, char **argv)
if (dataOnly && schemaOnly) if (dataOnly && schemaOnly)
{ {
write_msg(NULL, "'Schema only' and 'data only' are incompatible options.\n"); write_msg(NULL, "The options \"schema only\" (-s) and \"data only\" (-a) cannot be used together.\n");
exit(1); exit(1);
} }
@ -1086,8 +1083,7 @@ main(int argc, char **argv)
setMaxOid(g_fout); setMaxOid(g_fout);
if (g_verbose) if (g_verbose)
fprintf(stderr, "%s last builtin oid is %u %s\n", write_msg(NULL, "last built-in oid is %u\n", g_last_builtin_oid);
g_comment_start, g_last_builtin_oid, g_comment_end);
tblinfo = dumpSchema(g_fout, &numTables, tablename, aclsSkip, oids, schemaOnly, dataOnly); tblinfo = dumpSchema(g_fout, &numTables, tablename, aclsSkip, oids, schemaOnly, dataOnly);
if (!schemaOnly) if (!schemaOnly)
@ -1163,7 +1159,7 @@ dumpDatabase(Archive *AH)
int i_dba; int i_dba;
if (g_verbose) if (g_verbose)
fprintf(stderr, "%s saving database definition\n", g_comment_start); write_msg(NULL, "saving database definition\n");
/* Get the dba */ /* Get the dba */
appendPQExpBuffer(dbQry, "select (select usename from pg_user where datdba = usesysid) as dba from pg_database" appendPQExpBuffer(dbQry, "select (select usename from pg_user where datdba = usesysid) as dba from pg_database"
@ -1177,7 +1173,7 @@ dumpDatabase(Archive *AH)
write_msg(NULL, "SQL command failed\n"); write_msg(NULL, "SQL command failed\n");
write_msg(NULL, "Error message from server: %s", PQerrorMessage(g_conn)); write_msg(NULL, "Error message from server: %s", PQerrorMessage(g_conn));
write_msg(NULL, "The command was: %s\n", dbQry->data); write_msg(NULL, "The command was: %s\n", dbQry->data);
exit_nicely(g_conn); exit_nicely();
} }
ntups = PQntuples(res); ntups = PQntuples(res);
@ -1185,14 +1181,14 @@ dumpDatabase(Archive *AH)
if (ntups <= 0) if (ntups <= 0)
{ {
write_msg(NULL, "missing pg_database entry for database \"%s\"\n", PQdb(g_conn)); write_msg(NULL, "missing pg_database entry for database \"%s\"\n", PQdb(g_conn));
exit_nicely(g_conn); exit_nicely();
} }
if (ntups != 1) if (ntups != 1)
{ {
write_msg(NULL, "query returned more than one (%d) pg_database entry for database \"%s\"\n", write_msg(NULL, "query returned more than one (%d) pg_database entry for database \"%s\"\n",
ntups, PQdb(g_conn)); ntups, PQdb(g_conn));
exit_nicely(g_conn); exit_nicely();
} }
appendPQExpBuffer(creaQry, "Create Database \"%s\";\n", PQdb(g_conn)); appendPQExpBuffer(creaQry, "Create Database \"%s\";\n", PQdb(g_conn));
@ -1232,7 +1228,7 @@ dumpBlobs(Archive *AH, char *junkOid, void *junkVal)
int blobOid; int blobOid;
if (g_verbose) if (g_verbose)
fprintf(stderr, "%s saving BLOBs\n", g_comment_start); write_msg(NULL, "saving BLOBs\n");
/* Cursor to get all BLOB tables */ /* Cursor to get all BLOB tables */
if (AH->remoteVersion >= 70100) if (AH->remoteVersion >= 70100)
@ -1246,7 +1242,7 @@ dumpBlobs(Archive *AH, char *junkOid, void *junkVal)
if (!res || PQresultStatus(res) != PGRES_COMMAND_OK) if (!res || PQresultStatus(res) != PGRES_COMMAND_OK)
{ {
write_msg(NULL, "dumpBlobs(): cursor declaration failed: %s", PQerrorMessage(g_conn)); write_msg(NULL, "dumpBlobs(): cursor declaration failed: %s", PQerrorMessage(g_conn));
exit_nicely(g_conn); exit_nicely();
} }
/* Fetch for cursor */ /* Fetch for cursor */
@ -1262,7 +1258,7 @@ dumpBlobs(Archive *AH, char *junkOid, void *junkVal)
{ {
write_msg(NULL, "dumpBlobs(): fetch from cursor failed: %s", write_msg(NULL, "dumpBlobs(): fetch from cursor failed: %s",
PQerrorMessage(g_conn)); PQerrorMessage(g_conn));
exit_nicely(g_conn); exit_nicely();
} }
/* Process the tuples, if any */ /* Process the tuples, if any */
@ -1275,7 +1271,7 @@ dumpBlobs(Archive *AH, char *junkOid, void *junkVal)
{ {
write_msg(NULL, "dumpBlobs(): could not open large object: %s", write_msg(NULL, "dumpBlobs(): could not open large object: %s",
PQerrorMessage(g_conn)); PQerrorMessage(g_conn));
exit_nicely(g_conn); exit_nicely();
} }
StartBlob(AH, blobOid); StartBlob(AH, blobOid);
@ -1288,7 +1284,7 @@ dumpBlobs(Archive *AH, char *junkOid, void *junkVal)
{ {
write_msg(NULL, "dumpBlobs(): error reading large object: %s", write_msg(NULL, "dumpBlobs(): error reading large object: %s",
PQerrorMessage(g_conn)); PQerrorMessage(g_conn));
exit_nicely(g_conn); exit_nicely();
} }
WriteData(AH, buf, cnt); WriteData(AH, buf, cnt);
@ -1372,7 +1368,7 @@ getTypes(int *numTypes)
PQresultStatus(res) != PGRES_TUPLES_OK) PQresultStatus(res) != PGRES_TUPLES_OK)
{ {
write_msg(NULL, "query to obtain list of data types failed: %s", PQerrorMessage(g_conn)); write_msg(NULL, "query to obtain list of data types failed: %s", PQerrorMessage(g_conn));
exit_nicely(g_conn); exit_nicely();
} }
ntups = PQntuples(res); ntups = PQntuples(res);
@ -1490,7 +1486,7 @@ getOperators(int *numOprs)
PQresultStatus(res) != PGRES_TUPLES_OK) PQresultStatus(res) != PGRES_TUPLES_OK)
{ {
write_msg(NULL, "query to obtain list of operators failed: %s", PQerrorMessage(g_conn)); write_msg(NULL, "query to obtain list of operators failed: %s", PQerrorMessage(g_conn));
exit_nicely(g_conn); exit_nicely();
} }
ntups = PQntuples(res); ntups = PQntuples(res);
@ -1853,9 +1849,9 @@ getAggregates(int *numAggs)
if (!res || if (!res ||
PQresultStatus(res) != PGRES_TUPLES_OK) PQresultStatus(res) != PGRES_TUPLES_OK)
{ {
write_msg(NULL, "query to obtain list of aggregate functions failed: %s\n", write_msg(NULL, "query to obtain list of aggregate functions failed: %s",
PQerrorMessage(g_conn)); PQerrorMessage(g_conn));
exit_nicely(g_conn); exit_nicely();
} }
ntups = PQntuples(res); ntups = PQntuples(res);
@ -1956,7 +1952,7 @@ getFuncs(int *numFuncs)
{ {
write_msg(NULL, "query to obtain list of functions failed: %s", write_msg(NULL, "query to obtain list of functions failed: %s",
PQerrorMessage(g_conn)); PQerrorMessage(g_conn));
exit_nicely(g_conn); exit_nicely();
} }
ntups = PQntuples(res); ntups = PQntuples(res);
@ -2004,7 +2000,7 @@ getFuncs(int *numFuncs)
{ {
write_msg(NULL, "failed sanity check: function %s has more than %d (namely %d) arguments\n", write_msg(NULL, "failed sanity check: function %s has more than %d (namely %d) arguments\n",
finfo[i].proname, FUNC_MAX_ARGS, finfo[i].nargs); finfo[i].proname, FUNC_MAX_ARGS, finfo[i].nargs);
exit(1); exit_nicely();
} }
parseNumericArray(PQgetvalue(res, i, i_proargtypes), parseNumericArray(PQgetvalue(res, i, i_proargtypes),
finfo[i].argtypes, finfo[i].argtypes,
@ -2099,7 +2095,7 @@ getTables(int *numTables, FuncInfo *finfo, int numFuncs)
{ {
write_msg(NULL, "query to obtain list of tables failed: %s", write_msg(NULL, "query to obtain list of tables failed: %s",
PQerrorMessage(g_conn)); PQerrorMessage(g_conn));
exit_nicely(g_conn); exit_nicely();
} }
ntups = PQntuples(res); ntups = PQntuples(res);
@ -2150,7 +2146,7 @@ getTables(int *numTables, FuncInfo *finfo, int numFuncs)
{ {
write_msg(NULL, "query to obtain definition of view \"%s\" failed: %s", write_msg(NULL, "query to obtain definition of view \"%s\" failed: %s",
tblinfo[i].relname, PQerrorMessage(g_conn)); tblinfo[i].relname, PQerrorMessage(g_conn));
exit_nicely(g_conn); exit_nicely();
} }
if (PQntuples(res2) != 1) if (PQntuples(res2) != 1)
@ -2161,14 +2157,14 @@ getTables(int *numTables, FuncInfo *finfo, int numFuncs)
else else
write_msg(NULL, "query to obtain definition of view \"%s\" returned more than one definition\n", write_msg(NULL, "query to obtain definition of view \"%s\" returned more than one definition\n",
tblinfo[i].relname); tblinfo[i].relname);
exit_nicely(g_conn); exit_nicely();
} }
if (PQgetisnull(res2, 0, 1)) if (PQgetisnull(res2, 0, 1))
{ {
write_msg(NULL, "query to obtain definition of view \"%s\" returned NULL oid\n", write_msg(NULL, "query to obtain definition of view \"%s\" returned NULL oid\n",
tblinfo[i].relname); tblinfo[i].relname);
exit_nicely(g_conn); exit_nicely();
} }
tblinfo[i].viewdef = strdup(PQgetvalue(res2, 0, 0)); tblinfo[i].viewdef = strdup(PQgetvalue(res2, 0, 0));
@ -2178,7 +2174,7 @@ getTables(int *numTables, FuncInfo *finfo, int numFuncs)
{ {
write_msg(NULL, "definition of view \"%s\" appears to be empty (length zero)\n", write_msg(NULL, "definition of view \"%s\" appears to be empty (length zero)\n",
tblinfo[i].relname); tblinfo[i].relname);
exit_nicely(g_conn); exit_nicely();
} }
} }
else else
@ -2201,10 +2197,8 @@ getTables(int *numTables, FuncInfo *finfo, int numFuncs)
int i2; int i2;
if (g_verbose) if (g_verbose)
fprintf(stderr, "%s finding CHECK constraints for relation: '%s' %s\n", write_msg(NULL, "finding CHECK constraints for table %s\n",
g_comment_start, tblinfo[i].relname);
tblinfo[i].relname,
g_comment_end);
resetPQExpBuffer(query); resetPQExpBuffer(query);
appendPQExpBuffer(query, "SELECT rcname, rcsrc from pg_relcheck " appendPQExpBuffer(query, "SELECT rcname, rcsrc from pg_relcheck "
@ -2225,7 +2219,7 @@ getTables(int *numTables, FuncInfo *finfo, int numFuncs)
PQresultStatus(res2) != PGRES_TUPLES_OK) PQresultStatus(res2) != PGRES_TUPLES_OK)
{ {
write_msg(NULL, "query to obtain check constraints failed: %s", PQerrorMessage(g_conn)); write_msg(NULL, "query to obtain check constraints failed: %s", PQerrorMessage(g_conn));
exit_nicely(g_conn); exit_nicely();
} }
ntups2 = PQntuples(res2); ntups2 = PQntuples(res2);
if (ntups2 > tblinfo[i].ncheck) if (ntups2 > tblinfo[i].ncheck)
@ -2233,7 +2227,7 @@ getTables(int *numTables, FuncInfo *finfo, int numFuncs)
write_msg(NULL, "expected %d check constraints on table \"%s\" but found %d\n", write_msg(NULL, "expected %d check constraints on table \"%s\" but found %d\n",
tblinfo[i].ncheck, tblinfo[i].relname, ntups2); tblinfo[i].ncheck, tblinfo[i].relname, ntups2);
write_msg(NULL, "(The system catalogs might be corrupted.)\n"); write_msg(NULL, "(The system catalogs might be corrupted.)\n");
exit_nicely(g_conn); exit_nicely();
} }
/* Set ncheck to the number of *non-inherited* CHECK constraints */ /* Set ncheck to the number of *non-inherited* CHECK constraints */
@ -2275,14 +2269,14 @@ getTables(int *numTables, FuncInfo *finfo, int numFuncs)
{ {
write_msg(NULL, "query to obtain primary key of table \"%s\" failed: %s", write_msg(NULL, "query to obtain primary key of table \"%s\" failed: %s",
tblinfo[i].relname, PQerrorMessage(g_conn)); tblinfo[i].relname, PQerrorMessage(g_conn));
exit_nicely(g_conn); exit_nicely();
} }
if (PQntuples(res2) > 1) if (PQntuples(res2) > 1)
{ {
write_msg(NULL, "query to obtain primary key of table \"%s\" produced more than one result\n", write_msg(NULL, "query to obtain primary key of table \"%s\" produced more than one result\n",
tblinfo[i].relname); tblinfo[i].relname);
exit_nicely(g_conn); exit_nicely();
} }
if (PQntuples(res2) == 1) if (PQntuples(res2) == 1)
@ -2332,7 +2326,7 @@ getTables(int *numTables, FuncInfo *finfo, int numFuncs)
{ {
write_msg(NULL, "query to obtain name of primary key of table \"%s\" failed: %s", write_msg(NULL, "query to obtain name of primary key of table \"%s\" failed: %s",
tblinfo[i].relname, PQerrorMessage(g_conn)); tblinfo[i].relname, PQerrorMessage(g_conn));
exit_nicely(g_conn); exit_nicely();
} }
n = PQntuples(res2); n = PQntuples(res2);
@ -2340,7 +2334,7 @@ getTables(int *numTables, FuncInfo *finfo, int numFuncs)
{ {
write_msg(NULL, "query to obtain name of primary key of table \"%s\" did not return exactly one result\n", write_msg(NULL, "query to obtain name of primary key of table \"%s\" did not return exactly one result\n",
tblinfo[i].relname); tblinfo[i].relname);
exit_nicely(g_conn); exit_nicely();
} }
/* Sanity check on LOJ */ /* Sanity check on LOJ */
@ -2348,7 +2342,7 @@ getTables(int *numTables, FuncInfo *finfo, int numFuncs)
{ {
write_msg(NULL, "name of primary key of table \"%s\" returned NULL value\n", write_msg(NULL, "name of primary key of table \"%s\" returned NULL value\n",
tblinfo[i].relname); tblinfo[i].relname);
exit_nicely(g_conn); exit_nicely();
} }
tblinfo[i].primary_key_name = tblinfo[i].primary_key_name =
@ -2356,7 +2350,7 @@ getTables(int *numTables, FuncInfo *finfo, int numFuncs)
if (tblinfo[i].primary_key_name == NULL) if (tblinfo[i].primary_key_name == NULL)
{ {
write_msg(NULL, "out of memory\n"); write_msg(NULL, "out of memory\n");
exit(1); exit_nicely();
} }
} }
else else
@ -2382,10 +2376,7 @@ getTables(int *numTables, FuncInfo *finfo, int numFuncs)
int i2; int i2;
if (g_verbose) if (g_verbose)
fprintf(stderr, "%s finding Triggers for relation: '%s' %s\n", write_msg(NULL, "finding triggers for table %s\n", tblinfo[i].relname);
g_comment_start,
tblinfo[i].relname,
g_comment_end);
resetPQExpBuffer(query); resetPQExpBuffer(query);
appendPQExpBuffer(query, appendPQExpBuffer(query,
@ -2402,14 +2393,14 @@ getTables(int *numTables, FuncInfo *finfo, int numFuncs)
PQresultStatus(res2) != PGRES_TUPLES_OK) PQresultStatus(res2) != PGRES_TUPLES_OK)
{ {
write_msg(NULL, "query to obtain list of triggers failed: %s", PQerrorMessage(g_conn)); write_msg(NULL, "query to obtain list of triggers failed: %s", PQerrorMessage(g_conn));
exit_nicely(g_conn); exit_nicely();
} }
ntups2 = PQntuples(res2); ntups2 = PQntuples(res2);
if (ntups2 != tblinfo[i].ntrig) if (ntups2 != tblinfo[i].ntrig)
{ {
write_msg(NULL, "expected %d triggers on table \"%s\" but found %d\n", write_msg(NULL, "expected %d triggers on table \"%s\" but found %d\n",
tblinfo[i].ntrig, tblinfo[i].relname, ntups2); tblinfo[i].ntrig, tblinfo[i].relname, ntups2);
exit_nicely(g_conn); exit_nicely();
} }
i_tgname = PQfnumber(res2, "tgname"); i_tgname = PQfnumber(res2, "tgname");
i_tgfoid = PQfnumber(res2, "tgfoid"); i_tgfoid = PQfnumber(res2, "tgfoid");
@ -2489,7 +2480,7 @@ getTables(int *numTables, FuncInfo *finfo, int numFuncs)
{ {
write_msg(NULL, "query to obtain procedure name for trigger \"%s\" failed: %s", write_msg(NULL, "query to obtain procedure name for trigger \"%s\" failed: %s",
tgname, PQerrorMessage(g_conn)); tgname, PQerrorMessage(g_conn));
exit_nicely(g_conn); exit_nicely();
} }
/* Sanity: Check we got only one tuple */ /* Sanity: Check we got only one tuple */
@ -2498,7 +2489,7 @@ getTables(int *numTables, FuncInfo *finfo, int numFuncs)
{ {
write_msg(NULL, "query to obtain procedure name for trigger \"%s\" did not return exactly one result\n", write_msg(NULL, "query to obtain procedure name for trigger \"%s\" did not return exactly one result\n",
tgname); tgname);
exit_nicely(g_conn); exit_nicely();
} }
tgfunc = strdup(PQgetvalue(r, 0, PQfnumber(r, "proname"))); tgfunc = strdup(PQgetvalue(r, 0, PQfnumber(r, "proname")));
@ -2561,7 +2552,7 @@ getTables(int *numTables, FuncInfo *finfo, int numFuncs)
{ {
write_msg(NULL, "query produced NULL referenced table name for trigger \"%s\" on table \"%s\" (oid was %s)\n", write_msg(NULL, "query produced NULL referenced table name for trigger \"%s\" on table \"%s\" (oid was %s)\n",
tgname, tblinfo[i].relname, tgconstrrelid); tgname, tblinfo[i].relname, tgconstrrelid);
exit_nicely(g_conn); exit_nicely();
} }
appendPQExpBuffer(query, " FROM %s", appendPQExpBuffer(query, " FROM %s",
@ -2593,7 +2584,7 @@ getTables(int *numTables, FuncInfo *finfo, int numFuncs)
PQgetvalue(res2, i2, i_tgargs), PQgetvalue(res2, i2, i_tgargs),
tgname, tgname,
tblinfo[i].relname); tblinfo[i].relname);
exit_nicely(g_conn); exit_nicely();
} }
p++; p++;
if (*p == '\\') if (*p == '\\')
@ -2679,7 +2670,7 @@ getInherits(int *numInherits)
{ {
write_msg(NULL, "query to obtain inheritance relationships failed: %s", write_msg(NULL, "query to obtain inheritance relationships failed: %s",
PQerrorMessage(g_conn)); PQerrorMessage(g_conn));
exit_nicely(g_conn); exit_nicely();
} }
ntups = PQntuples(res); ntups = PQntuples(res);
@ -2741,10 +2732,8 @@ getTableAttrs(TableInfo *tblinfo, int numTables)
* later * later
*/ */
if (g_verbose) if (g_verbose)
fprintf(stderr, "%s finding the attrs and types for table: '%s' %s\n", write_msg(NULL, "finding the columns and types for table %s\n",
g_comment_start, tblinfo[i].relname);
tblinfo[i].relname,
g_comment_end);
resetPQExpBuffer(q); resetPQExpBuffer(q);
@ -2781,7 +2770,7 @@ getTableAttrs(TableInfo *tblinfo, int numTables)
PQresultStatus(res) != PGRES_TUPLES_OK) PQresultStatus(res) != PGRES_TUPLES_OK)
{ {
write_msg(NULL, "query to get table columns failed: %s", PQerrorMessage(g_conn)); write_msg(NULL, "query to get table columns failed: %s", PQerrorMessage(g_conn));
exit_nicely(g_conn); exit_nicely();
} }
ntups = PQntuples(res); ntups = PQntuples(res);
@ -2814,7 +2803,7 @@ getTableAttrs(TableInfo *tblinfo, int numTables)
{ {
write_msg(NULL, "query produced NULL name for data type of column %d of table %s\n", write_msg(NULL, "query produced NULL name for data type of column %d of table %s\n",
j+1, tblinfo[i].relname); j+1, tblinfo[i].relname);
exit_nicely(g_conn); exit_nicely();
} }
tblinfo[i].attoids[j] = strdup(PQgetvalue(res, j, i_attoid)); tblinfo[i].attoids[j] = strdup(PQgetvalue(res, j, i_attoid));
@ -2834,10 +2823,8 @@ getTableAttrs(TableInfo *tblinfo, int numTables)
int numAttr; int numAttr;
if (g_verbose) if (g_verbose)
fprintf(stderr, "%s finding DEFAULT expression for attr: '%s' %s\n", write_msg(NULL, "finding DEFAULT expression for column %s\n",
g_comment_start, tblinfo[i].attnames[j]);
tblinfo[i].attnames[j],
g_comment_end);
resetPQExpBuffer(q); resetPQExpBuffer(q);
appendPQExpBuffer(q, "SELECT adsrc from pg_attrdef " appendPQExpBuffer(q, "SELECT adsrc from pg_attrdef "
@ -2849,7 +2836,7 @@ getTableAttrs(TableInfo *tblinfo, int numTables)
{ {
write_msg(NULL, "query to get column default value failed: %s", write_msg(NULL, "query to get column default value failed: %s",
PQerrorMessage(g_conn)); PQerrorMessage(g_conn));
exit_nicely(g_conn); exit_nicely();
} }
/* Sanity: Check we got only one tuple */ /* Sanity: Check we got only one tuple */
@ -2858,7 +2845,7 @@ getTableAttrs(TableInfo *tblinfo, int numTables)
{ {
write_msg(NULL, "query to get default value for column \"%s\" returned %d rows; expected 1\n", write_msg(NULL, "query to get default value for column \"%s\" returned %d rows; expected 1\n",
tblinfo[i].attnames[j], numAttr); tblinfo[i].attnames[j], numAttr);
exit_nicely(g_conn); exit_nicely();
} }
tblinfo[i].adef_expr[j] = strdup(PQgetvalue(res2, 0, PQfnumber(res2, "adsrc"))); tblinfo[i].adef_expr[j] = strdup(PQgetvalue(res2, 0, PQfnumber(res2, "adsrc")));
@ -2930,7 +2917,7 @@ getIndexes(int *numIndexes)
PQresultStatus(res) != PGRES_TUPLES_OK) PQresultStatus(res) != PGRES_TUPLES_OK)
{ {
write_msg(NULL, "query to obtain list of indexes failed: %s", PQerrorMessage(g_conn)); write_msg(NULL, "query to obtain list of indexes failed: %s", PQerrorMessage(g_conn));
exit_nicely(g_conn); exit_nicely();
} }
ntups = PQntuples(res); ntups = PQntuples(res);
@ -3011,7 +2998,7 @@ dumpComment(Archive *fout, const char *target, const char *oid)
{ {
write_msg(NULL, "query to get comment on oid %s failed: %s", write_msg(NULL, "query to get comment on oid %s failed: %s",
oid, PQerrorMessage(g_conn)); oid, PQerrorMessage(g_conn));
exit_nicely(g_conn); exit_nicely();
} }
/*** If a comment exists, build COMMENT ON statement ***/ /*** If a comment exists, build COMMENT ON statement ***/
@ -3066,7 +3053,7 @@ dumpDBComment(Archive *fout)
{ {
write_msg(NULL, "query to get database oid failed: %s", write_msg(NULL, "query to get database oid failed: %s",
PQerrorMessage(g_conn)); PQerrorMessage(g_conn));
exit_nicely(g_conn); exit_nicely();
} }
/*** If a comment exists, build COMMENT ON statement ***/ /*** If a comment exists, build COMMENT ON statement ***/
@ -3164,7 +3151,7 @@ dumpTypes(Archive *fout, FuncInfo *finfo, int numFuncs,
elemType = findTypeByOid(tinfo, numTypes, tinfo[i].typelem, zeroAsOpaque); elemType = findTypeByOid(tinfo, numTypes, tinfo[i].typelem, zeroAsOpaque);
if (elemType == NULL) if (elemType == NULL)
{ {
write_msg(NULL, "Notice: array type %s - type for elements (oid %s) is not dumped.\n", write_msg(NULL, "notice: array type %s - type for elements (oid %s) is not dumped\n",
tinfo[i].typname, tinfo[i].typelem); tinfo[i].typname, tinfo[i].typelem);
resetPQExpBuffer(q); resetPQExpBuffer(q);
resetPQExpBuffer(delq); resetPQExpBuffer(delq);
@ -3233,7 +3220,7 @@ dumpProcLangs(Archive *fout, FuncInfo *finfo, int numFuncs,
{ {
write_msg(NULL, "query to obtain list of procedural languages failed: %s", write_msg(NULL, "query to obtain list of procedural languages failed: %s",
PQerrorMessage(g_conn)); PQerrorMessage(g_conn));
exit_nicely(g_conn); exit_nicely();
} }
ntups = PQntuples(res); ntups = PQntuples(res);
@ -3261,7 +3248,7 @@ dumpProcLangs(Archive *fout, FuncInfo *finfo, int numFuncs,
{ {
write_msg(NULL, "handler procedure for procedural language %s not found\n", write_msg(NULL, "handler procedure for procedural language %s not found\n",
PQgetvalue(res, i, i_lanname)); PQgetvalue(res, i, i_lanname));
exit_nicely(g_conn); exit_nicely();
} }
dumpOneFunc(fout, finfo, fidx, tinfo, numTypes); dumpOneFunc(fout, finfo, fidx, tinfo, numTypes);
@ -3350,14 +3337,14 @@ dumpOneFunc(Archive *fout, FuncInfo *finfo, int i,
PQresultStatus(res) != PGRES_TUPLES_OK) PQresultStatus(res) != PGRES_TUPLES_OK)
{ {
write_msg(NULL, "query to get name of procedural language failed: %s", PQerrorMessage(g_conn)); write_msg(NULL, "query to get name of procedural language failed: %s", PQerrorMessage(g_conn));
exit_nicely(g_conn); exit_nicely();
} }
nlangs = PQntuples(res); nlangs = PQntuples(res);
if (nlangs != 1) if (nlangs != 1)
{ {
write_msg(NULL, "procedural language for function %s not found\n", finfo[i].proname); write_msg(NULL, "procedural language for function %s not found\n", finfo[i].proname);
exit_nicely(g_conn); exit_nicely();
} }
i_lanname = PQfnumber(res, "lanname"); i_lanname = PQfnumber(res, "lanname");
@ -3398,10 +3385,10 @@ dumpOneFunc(Archive *fout, FuncInfo *finfo, int i,
typname = findTypeByOid(tinfo, numTypes, finfo[i].argtypes[j], zeroAsOpaque); typname = findTypeByOid(tinfo, numTypes, finfo[i].argtypes[j], zeroAsOpaque);
if (typname == NULL) if (typname == NULL)
{ {
write_msg(NULL, "Notice: function \"%s\" not dumped\n", write_msg(NULL, "WARNING: function \"%s\" not dumped\n",
finfo[i].proname); finfo[i].proname);
write_msg(NULL, "Reason: data type name of argument %d (oid %s) not found\n", write_msg(NULL, "reason: data type name of argument %d (oid %s) not found\n",
j, finfo[i].argtypes[j]); j, finfo[i].argtypes[j]);
resetPQExpBuffer(q); resetPQExpBuffer(q);
resetPQExpBuffer(fn); resetPQExpBuffer(fn);
@ -3427,11 +3414,11 @@ dumpOneFunc(Archive *fout, FuncInfo *finfo, int i,
if (rettypename == NULL) if (rettypename == NULL)
{ {
write_msg(NULL, "Notice: function \"%s\" not dumped\n", write_msg(NULL, "WARNING: function \"%s\" not dumped\n",
finfo[i].proname); finfo[i].proname);
write_msg(NULL, "Reason: name of return data type (oid %s) not found\n", write_msg(NULL, "reason: name of return data type (oid %s) not found\n",
finfo[i].prorettype); finfo[i].prorettype);
resetPQExpBuffer(q); resetPQExpBuffer(q);
resetPQExpBuffer(fn); resetPQExpBuffer(fn);
resetPQExpBuffer(delqry); resetPQExpBuffer(delqry);
@ -3491,12 +3478,6 @@ void
dumpOprs(Archive *fout, OprInfo *oprinfo, int numOperators, dumpOprs(Archive *fout, OprInfo *oprinfo, int numOperators,
TypeInfo *tinfo, int numTypes) TypeInfo *tinfo, int numTypes)
{ {
#define OPR_NOTICE(arg) {\
fprintf(stderr, "Notice: operator \"%s\"(oid %s) is not dumped.\n",oprinfo[i].oprname, oprinfo[i].oid);\
fprintf(stderr, "Reason: " CppAsString(arg));\
fprintf (stderr, " (oid %s) not found.\n",oprinfo[i].arg);\
}
int i; int i;
PQExpBuffer q = createPQExpBuffer(); PQExpBuffer q = createPQExpBuffer();
PQExpBuffer delq = createPQExpBuffer(); PQExpBuffer delq = createPQExpBuffer();
@ -3544,7 +3525,10 @@ dumpOprs(Archive *fout, OprInfo *oprinfo, int numOperators,
oprinfo[i].oprleft, zeroAsOpaque); oprinfo[i].oprleft, zeroAsOpaque);
if (name == NULL) if (name == NULL)
{ {
OPR_NOTICE(oprleft); write_msg(NULL, "WARNING: operator \"%s\" (oid %s) not dumped\n",
oprinfo[i].oprname, oprinfo[i].oid);
write_msg(NULL, "reason: oprleft (oid %s) not found\n",
oprinfo[i].oprleft);
continue; continue;
} }
appendPQExpBuffer(leftarg, ",\n\tLEFTARG = %s ", name); appendPQExpBuffer(leftarg, ",\n\tLEFTARG = %s ", name);
@ -3557,7 +3541,10 @@ dumpOprs(Archive *fout, OprInfo *oprinfo, int numOperators,
oprinfo[i].oprright, zeroAsOpaque); oprinfo[i].oprright, zeroAsOpaque);
if (name == NULL) if (name == NULL)
{ {
OPR_NOTICE(oprright); write_msg(NULL, "WARNING: operator \"%s\" (oid %s) not dumped\n",
oprinfo[i].oprname, oprinfo[i].oid);
write_msg(NULL, "reason: oprright (oid %s) not found\n",
oprinfo[i].oprright);
continue; continue;
} }
appendPQExpBuffer(rightarg, ",\n\tRIGHTARG = %s ", name); appendPQExpBuffer(rightarg, ",\n\tRIGHTARG = %s ", name);
@ -3568,7 +3555,10 @@ dumpOprs(Archive *fout, OprInfo *oprinfo, int numOperators,
name = findOprByOid(oprinfo, numOperators, oprinfo[i].oprcom); name = findOprByOid(oprinfo, numOperators, oprinfo[i].oprcom);
if (name == NULL) if (name == NULL)
{ {
OPR_NOTICE(oprcom); write_msg(NULL, "WARNING: operator \"%s\" (oid %s) not dumped\n",
oprinfo[i].oprname, oprinfo[i].oid);
write_msg(NULL, "reason: oprcom (oid %s) not found\n",
oprinfo[i].oprcom);
continue; continue;
} }
appendPQExpBuffer(commutator, ",\n\tCOMMUTATOR = %s ", name); appendPQExpBuffer(commutator, ",\n\tCOMMUTATOR = %s ", name);
@ -3579,7 +3569,10 @@ dumpOprs(Archive *fout, OprInfo *oprinfo, int numOperators,
name = findOprByOid(oprinfo, numOperators, oprinfo[i].oprnegate); name = findOprByOid(oprinfo, numOperators, oprinfo[i].oprnegate);
if (name == NULL) if (name == NULL)
{ {
OPR_NOTICE(oprnegate); write_msg(NULL, "WARNING: operator \"%s\" (oid %s) not dumped\n",
oprinfo[i].oprname, oprinfo[i].oid);
write_msg(NULL, "reason: oprnegate (oid %s) not found\n",
oprinfo[i].oprnegate);
continue; continue;
} }
appendPQExpBuffer(negator, ",\n\tNEGATOR = %s ", name); appendPQExpBuffer(negator, ",\n\tNEGATOR = %s ", name);
@ -3596,7 +3589,10 @@ dumpOprs(Archive *fout, OprInfo *oprinfo, int numOperators,
name = findOprByOid(oprinfo, numOperators, oprinfo[i].oprlsortop); name = findOprByOid(oprinfo, numOperators, oprinfo[i].oprlsortop);
if (name == NULL) if (name == NULL)
{ {
OPR_NOTICE(oprlsortop); write_msg(NULL, "WARNING: operator \"%s\" (oid %s) not dumped\n",
oprinfo[i].oprname, oprinfo[i].oid);
write_msg(NULL, "reason: oprlsortop (oid %s) not found\n",
oprinfo[i].oprlsortop);
continue; continue;
} }
appendPQExpBuffer(sort1, ",\n\tSORT1 = %s ", name); appendPQExpBuffer(sort1, ",\n\tSORT1 = %s ", name);
@ -3607,7 +3603,10 @@ dumpOprs(Archive *fout, OprInfo *oprinfo, int numOperators,
name = findOprByOid(oprinfo, numOperators, oprinfo[i].oprrsortop); name = findOprByOid(oprinfo, numOperators, oprinfo[i].oprrsortop);
if (name == NULL) if (name == NULL)
{ {
OPR_NOTICE(oprrsortop); write_msg(NULL, "WARNING: operator \"%s\" (oid %s) not dumped\n",
oprinfo[i].oprname, oprinfo[i].oid);
write_msg(NULL, "reason: oprrsortop (oid %s) not found\n",
oprinfo[i].oprrsortop);
continue; continue;
} }
appendPQExpBuffer(sort2, ",\n\tSORT2 = %s ", name); appendPQExpBuffer(sort2, ",\n\tSORT2 = %s ", name);
@ -3649,16 +3648,6 @@ void
dumpAggs(Archive *fout, AggInfo *agginfo, int numAggs, dumpAggs(Archive *fout, AggInfo *agginfo, int numAggs,
TypeInfo *tinfo, int numTypes) TypeInfo *tinfo, int numTypes)
{ {
#define AGG_NOTICE(arg) {\
resetPQExpBuffer(q);\
appendPQExpBuffer(q, "-- Notice: aggregate \"%s\"(oid %s) is not dumped.\n",agginfo[i].aggname, agginfo[i].oid);\
appendPQExpBuffer(q, "-- Reason: " CppAsString(arg) );\
appendPQExpBuffer(q, " (oid %s) not found.\n",agginfo[i].arg);\
fprintf(stderr, q->data);\
ArchiveEntry(fout, agginfo[i].oid, aggSig->data, "WARNING", NULL,\
q->data, "" /* Del */, "", agginfo[i].usename, NULL, NULL);\
}
int i; int i;
PQExpBuffer q = createPQExpBuffer(); PQExpBuffer q = createPQExpBuffer();
PQExpBuffer delq = createPQExpBuffer(); PQExpBuffer delq = createPQExpBuffer();
@ -3681,11 +3670,12 @@ dumpAggs(Archive *fout, AggInfo *agginfo, int numAggs,
if (!agginfo[i].convertok) if (!agginfo[i].convertok)
{ {
write_msg(NULL, "WARNING: aggregate function %s could not be dumped correctly for this database version; ignored\n",
aggSig->data);
resetPQExpBuffer(q); resetPQExpBuffer(q);
appendPQExpBuffer(q, "-- WARNING: Aggregate %s could not be dumped correctly for this database version - ignored\n", appendPQExpBuffer(q, "-- WARNING: aggregate function %s could not be dumped correctly for this database version; ignored\n",
aggSig->data); aggSig->data);
fprintf(stderr, q->data);
ArchiveEntry(fout, agginfo[i].oid, aggSig->data, "WARNING", NULL, ArchiveEntry(fout, agginfo[i].oid, aggSig->data, "WARNING", NULL,
q->data, "" /* Del */, "", agginfo[i].usename, NULL, NULL); q->data, "" /* Del */, "", agginfo[i].usename, NULL, NULL);
continue; continue;
@ -3694,7 +3684,16 @@ dumpAggs(Archive *fout, AggInfo *agginfo, int numAggs,
name = findTypeByOid(tinfo, numTypes, agginfo[i].aggbasetype, zeroAsAny + useBaseTypeName); name = findTypeByOid(tinfo, numTypes, agginfo[i].aggbasetype, zeroAsAny + useBaseTypeName);
if (name == NULL) if (name == NULL)
{ {
AGG_NOTICE(aggbasetype); write_msg(NULL, "WARNING: aggregate function \"%s\" (oid %s) not dumped\n",
agginfo[i].aggname, agginfo[i].oid);
write_msg(NULL, "reason: aggbasetype (oid %s) not found\n",
agginfo[i].aggbasetype);
resetPQExpBuffer(q);
appendPQExpBuffer(q, "-- WARNING: aggregate function \"%s\" (oid %s) not dumped\n", agginfo[i].aggname, agginfo[i].oid);
appendPQExpBuffer(q, "-- reason: aggbasetype (oid %s) not found\n", agginfo[i].aggbasetype);
ArchiveEntry(fout, agginfo[i].oid, aggSig->data, "WARNING", NULL,
q->data, "" /* Del */, "", agginfo[i].usename, NULL, NULL);
continue; continue;
} }
appendPQExpBuffer(details, "BASETYPE = %s, ", name); appendPQExpBuffer(details, "BASETYPE = %s, ", name);
@ -3702,7 +3701,16 @@ dumpAggs(Archive *fout, AggInfo *agginfo, int numAggs,
name = findTypeByOid(tinfo, numTypes, agginfo[i].aggtranstype, zeroAsOpaque + useBaseTypeName); name = findTypeByOid(tinfo, numTypes, agginfo[i].aggtranstype, zeroAsOpaque + useBaseTypeName);
if (name == NULL) if (name == NULL)
{ {
AGG_NOTICE(aggtranstype); write_msg(NULL, "WARNING: aggregate function \"%s\" (oid %s) not dumped\n",
agginfo[i].aggname, agginfo[i].oid);
write_msg(NULL, "reason: aggtranstype (oid %s) not found\n",
agginfo[i].aggtranstype);
resetPQExpBuffer(q);
appendPQExpBuffer(q, "-- WARNING: aggregate function \"%s\" (oid %s) not dumped\n", agginfo[i].aggname, agginfo[i].oid);
appendPQExpBuffer(q, "-- reason: aggtranstype (oid %s) not found\n", agginfo[i].aggtranstype);
ArchiveEntry(fout, agginfo[i].oid, aggSig->data, "WARNING", NULL,
q->data, "" /* Del */, "", agginfo[i].usename, NULL, NULL);
continue; continue;
} }
appendPQExpBuffer(details, appendPQExpBuffer(details,
@ -3859,9 +3867,9 @@ dumpACL(Archive *fout, TableInfo tbinfo)
eqpos = strchr(tok, '='); eqpos = strchr(tok, '=');
if (!eqpos) if (!eqpos)
{ {
fprintf(stderr, "Could not parse ACL list ('%s') for '%s'...Exiting!\n", write_msg(NULL, "could not parse ACL list ('%s') for relation %s\n",
acls, tbinfo.relname); acls, tbinfo.relname);
exit_nicely(g_conn); exit_nicely();
} }
/* /*
@ -4102,7 +4110,7 @@ dumpTables(Archive *fout, TableInfo *tblinfo, int numTables,
{ {
write_msg(NULL, "dumpTables(): failed sanity check, could not find index (%s) for primary key constraint\n", write_msg(NULL, "dumpTables(): failed sanity check, could not find index (%s) for primary key constraint\n",
tblinfo[i].pkIndexOid); tblinfo[i].pkIndexOid);
exit_nicely(g_conn); exit_nicely();
} }
consDef = getPKconstraint(&tblinfo[i], &indinfo[k]); consDef = getPKconstraint(&tblinfo[i], &indinfo[k]);
@ -4226,7 +4234,7 @@ getAttrName(int attrnum, TableInfo *tblInfo)
} }
write_msg(NULL, "getAttrName(): invalid column number %d for table %s\n", write_msg(NULL, "getAttrName(): invalid column number %d for table %s\n",
attrnum, tblInfo->relname); attrnum, tblInfo->relname);
exit_nicely(g_conn); exit_nicely();
return NULL; /* keep compiler quiet */ return NULL; /* keep compiler quiet */
} }
@ -4262,29 +4270,29 @@ dumpIndexes(Archive *fout, IndInfo *indinfo, int numIndexes,
{ {
write_msg(NULL, "dumpIndexes(): failed sanity check, table %s was not found\n", write_msg(NULL, "dumpIndexes(): failed sanity check, table %s was not found\n",
indinfo[i].indrelname); indinfo[i].indrelname);
exit(1); exit_nicely();
} }
/* Handle PK indexes */ /* Handle PK indexes */
if (strcmp(indinfo[i].indisprimary, "t") == 0) if (strcmp(indinfo[i].indisprimary, "t") == 0)
{ {
/* #if 0
* ***PK: Enable this code when ALTER TABLE supports PK constraints. *** /* PK: Enable this code when ALTER TABLE supports PK constraints. */
*
* PQExpBuffer consDef = getPKconstraint(&tblinfo[tableInd], &indinfo[i]); PQExpBuffer consDef = getPKconstraint(&tblinfo[tableInd], &indinfo[i]);
*
* resetPQExpBuffer(attlist); resetPQExpBuffer(attlist);
*
* appendPQExpBuffer(attlist, "Alter Table %s Add %s;", appendPQExpBuffer(attlist, "Alter Table %s Add %s;",
* fmtId(tblinfo[tableInd].relname, force_quotes), fmtId(tblinfo[tableInd].relname, force_quotes),
* consDef->data); consDef->data);
*
* ArchiveEntry(fout, indinfo[i].oid, tblinfo[tableInd].primary_key_name, "CONSTRAINT", NULL, ArchiveEntry(fout, indinfo[i].oid, tblinfo[tableInd].primary_key_name,
* attlist->data, "", "CONSTRAINT", NULL, attlist->data, "",
* "", tblinfo[tableInd].usename, NULL, NULL); "", tblinfo[tableInd].usename, NULL, NULL);
*
* destroyPQExpBuffer(consDef); destroyPQExpBuffer(consDef);
*/ #endif
/* /*
* Don't need to do anything else for this system-generated * Don't need to do anything else for this system-generated
@ -4316,7 +4324,7 @@ dumpIndexes(Archive *fout, IndInfo *indinfo, int numIndexes,
{ {
write_msg(NULL, "query to get function name of oid %s failed: %s", write_msg(NULL, "query to get function name of oid %s failed: %s",
indinfo[i].indproc, PQerrorMessage(g_conn)); indinfo[i].indproc, PQerrorMessage(g_conn));
exit_nicely(g_conn); exit_nicely();
} }
/* Sanity: Check we got only one tuple */ /* Sanity: Check we got only one tuple */
@ -4325,7 +4333,7 @@ dumpIndexes(Archive *fout, IndInfo *indinfo, int numIndexes,
{ {
write_msg(NULL, "query to get function name of oid %s returned %d rows; expected 1\n", write_msg(NULL, "query to get function name of oid %s returned %d rows; expected 1\n",
indinfo[i].indproc, numFuncs); indinfo[i].indproc, numFuncs);
exit_nicely(g_conn); exit_nicely();
} }
funcname = strdup(PQgetvalue(res, 0, PQfnumber(res, "proname"))); funcname = strdup(PQgetvalue(res, 0, PQfnumber(res, "proname")));
@ -4350,7 +4358,7 @@ dumpIndexes(Archive *fout, IndInfo *indinfo, int numIndexes,
{ {
write_msg(NULL, "query to get operator class name of oid %u failed: %s", write_msg(NULL, "query to get operator class name of oid %u failed: %s",
indclass, PQerrorMessage(g_conn)); indclass, PQerrorMessage(g_conn));
exit_nicely(g_conn); exit_nicely();
} }
/* Sanity: Check we got only one tuple */ /* Sanity: Check we got only one tuple */
@ -4359,7 +4367,7 @@ dumpIndexes(Archive *fout, IndInfo *indinfo, int numIndexes,
{ {
write_msg(NULL, "query to get operator class name of oid %u returned %d rows; expected 1\n", write_msg(NULL, "query to get operator class name of oid %u returned %d rows; expected 1\n",
indclass, numRows); indclass, numRows);
exit_nicely(g_conn); exit_nicely();
} }
classname[nclass] = strdup(PQgetvalue(res, 0, PQfnumber(res, "opcname"))); classname[nclass] = strdup(PQgetvalue(res, 0, PQfnumber(res, "opcname")));
@ -4370,7 +4378,7 @@ dumpIndexes(Archive *fout, IndInfo *indinfo, int numIndexes,
{ {
write_msg(NULL, "There must be exactly one OpClass for functional index \"%s\".\n", write_msg(NULL, "There must be exactly one OpClass for functional index \"%s\".\n",
indinfo[i].indexrelname); indinfo[i].indexrelname);
exit_nicely(g_conn); exit_nicely();
} }
/* convert attribute numbers into attribute list */ /* convert attribute numbers into attribute list */
@ -4394,7 +4402,7 @@ dumpIndexes(Archive *fout, IndInfo *indinfo, int numIndexes,
{ {
write_msg(NULL, "no operator class found for column \"%s\" of index \"%s\"\n", write_msg(NULL, "no operator class found for column \"%s\" of index \"%s\"\n",
attname, indinfo[i].indexrelname); attname, indinfo[i].indexrelname);
exit_nicely(g_conn); exit_nicely();
} }
resetPQExpBuffer(id1); resetPQExpBuffer(id1);
resetPQExpBuffer(id2); resetPQExpBuffer(id2);
@ -4535,7 +4543,7 @@ setMaxOid(Archive *fout)
PQresultStatus(res) != PGRES_COMMAND_OK) PQresultStatus(res) != PGRES_COMMAND_OK)
{ {
write_msg(NULL, "could not create pgdump_oid table: %s", PQerrorMessage(g_conn)); write_msg(NULL, "could not create pgdump_oid table: %s", PQerrorMessage(g_conn));
exit_nicely(g_conn); exit_nicely();
} }
PQclear(res); PQclear(res);
res = PQexec(g_conn, "INSERT INTO pgdump_oid VALUES (0)"); res = PQexec(g_conn, "INSERT INTO pgdump_oid VALUES (0)");
@ -4543,13 +4551,13 @@ setMaxOid(Archive *fout)
PQresultStatus(res) != PGRES_COMMAND_OK) PQresultStatus(res) != PGRES_COMMAND_OK)
{ {
write_msg(NULL, "could not insert into pgdump_oid table: %s", PQerrorMessage(g_conn)); write_msg(NULL, "could not insert into pgdump_oid table: %s", PQerrorMessage(g_conn));
exit_nicely(g_conn); exit_nicely();
} }
max_oid = atol(PQoidStatus(res)); max_oid = atol(PQoidStatus(res));
if (max_oid == 0) if (max_oid == 0)
{ {
write_msg(NULL, "inserted invalid oid\n"); write_msg(NULL, "inserted invalid oid\n");
exit_nicely(g_conn); exit_nicely();
} }
PQclear(res); PQclear(res);
res = PQexec(g_conn, "DROP TABLE pgdump_oid;"); res = PQexec(g_conn, "DROP TABLE pgdump_oid;");
@ -4557,12 +4565,11 @@ setMaxOid(Archive *fout)
PQresultStatus(res) != PGRES_COMMAND_OK) PQresultStatus(res) != PGRES_COMMAND_OK)
{ {
write_msg(NULL, "could not drop pgdump_oid table: %s", PQerrorMessage(g_conn)); write_msg(NULL, "could not drop pgdump_oid table: %s", PQerrorMessage(g_conn));
exit_nicely(g_conn); exit_nicely();
} }
PQclear(res); PQclear(res);
if (g_verbose) if (g_verbose)
fprintf(stderr, "%s maximum system oid is %u %s\n", write_msg(NULL, "maximum system oid is %u\n", max_oid);
g_comment_start, max_oid, g_comment_end);
snprintf(sql, 1024, snprintf(sql, 1024,
"CREATE TEMPORARY TABLE pgdump_oid (dummy int4);\n" "CREATE TEMPORARY TABLE pgdump_oid (dummy int4);\n"
"COPY pgdump_oid WITH OIDS FROM stdin;\n" "COPY pgdump_oid WITH OIDS FROM stdin;\n"
@ -4597,18 +4604,18 @@ findLastBuiltinOid_V71(const char *dbname)
PQresultStatus(res) != PGRES_TUPLES_OK) PQresultStatus(res) != PGRES_TUPLES_OK)
{ {
write_msg(NULL, "error in finding the last system oid: %s", PQerrorMessage(g_conn)); write_msg(NULL, "error in finding the last system oid: %s", PQerrorMessage(g_conn));
exit_nicely(g_conn); exit_nicely();
} }
ntups = PQntuples(res); ntups = PQntuples(res);
if (ntups < 1) if (ntups < 1)
{ {
write_msg(NULL, "missing pg_database entry for this database\n"); write_msg(NULL, "missing pg_database entry for this database\n");
exit_nicely(g_conn); exit_nicely();
} }
if (ntups > 1) if (ntups > 1)
{ {
write_msg(NULL, "found more than one pg_database entry for this database\n"); write_msg(NULL, "found more than one pg_database entry for this database\n");
exit_nicely(g_conn); exit_nicely();
} }
last_oid = atooid(PQgetvalue(res, 0, PQfnumber(res, "datlastsysoid"))); last_oid = atooid(PQgetvalue(res, 0, PQfnumber(res, "datlastsysoid")));
PQclear(res); PQclear(res);
@ -4635,18 +4642,18 @@ findLastBuiltinOid_V70(void)
PQresultStatus(res) != PGRES_TUPLES_OK) PQresultStatus(res) != PGRES_TUPLES_OK)
{ {
write_msg(NULL, "error in finding the template1 database: %s", PQerrorMessage(g_conn)); write_msg(NULL, "error in finding the template1 database: %s", PQerrorMessage(g_conn));
exit_nicely(g_conn); exit_nicely();
} }
ntups = PQntuples(res); ntups = PQntuples(res);
if (ntups < 1) if (ntups < 1)
{ {
write_msg(NULL, "could not find template1 database entry in the pg_database table\n"); write_msg(NULL, "could not find template1 database entry in the pg_database table\n");
exit_nicely(g_conn); exit_nicely();
} }
if (ntups > 1) if (ntups > 1)
{ {
write_msg(NULL, "found more than one template1 database entry in the pg_database table\n"); write_msg(NULL, "found more than one template1 database entry in the pg_database table\n");
exit_nicely(g_conn); exit_nicely();
} }
last_oid = atooid(PQgetvalue(res, 0, PQfnumber(res, "oid"))); last_oid = atooid(PQgetvalue(res, 0, PQfnumber(res, "oid")));
PQclear(res); PQclear(res);
@ -4677,21 +4684,21 @@ dumpSequence(Archive *fout, TableInfo tbinfo, const bool schemaOnly, const bool
if (!res || PQresultStatus(res) != PGRES_TUPLES_OK) if (!res || PQresultStatus(res) != PGRES_TUPLES_OK)
{ {
write_msg(NULL, "query to get data of sequence \"%s\" failed: %s", tbinfo.relname, PQerrorMessage(g_conn)); write_msg(NULL, "query to get data of sequence \"%s\" failed: %s", tbinfo.relname, PQerrorMessage(g_conn));
exit_nicely(g_conn); exit_nicely();
} }
if (PQntuples(res) != 1) if (PQntuples(res) != 1)
{ {
write_msg(NULL, "query to get data of sequence \"%s\" returned %d rows (expected 1)\n", write_msg(NULL, "query to get data of sequence \"%s\" returned %d rows (expected 1)\n",
tbinfo.relname, PQntuples(res)); tbinfo.relname, PQntuples(res));
exit_nicely(g_conn); exit_nicely();
} }
if (strcmp(PQgetvalue(res, 0, 0), tbinfo.relname) != 0) if (strcmp(PQgetvalue(res, 0, 0), tbinfo.relname) != 0)
{ {
write_msg(NULL, "query to get data of sequence \"%s\" returned name \"%s\"\n", write_msg(NULL, "query to get data of sequence \"%s\" returned name \"%s\"\n",
tbinfo.relname, PQgetvalue(res, 0, 0)); tbinfo.relname, PQgetvalue(res, 0, 0));
exit_nicely(g_conn); exit_nicely();
} }
@ -4764,8 +4771,7 @@ dumpTriggers(Archive *fout, const char *tablename,
j; j;
if (g_verbose) if (g_verbose)
fprintf(stderr, "%s dumping out triggers %s\n", write_msg(NULL, "dumping out triggers\n");
g_comment_start, g_comment_end);
for (i = 0; i < numTables; i++) for (i = 0; i < numTables; i++)
{ {
@ -4799,8 +4805,7 @@ dumpRules(Archive *fout, const char *tablename,
int i_rulename; int i_rulename;
if (g_verbose) if (g_verbose)
fprintf(stderr, "%s dumping out rules %s\n", write_msg(NULL, "dumping out rules\n");
g_comment_start, g_comment_end);
/* /*
* For each table we dump * For each table we dump
@ -4834,7 +4839,7 @@ dumpRules(Archive *fout, const char *tablename,
{ {
write_msg(NULL, "query to get rules associated with table \"%s\" failed: %s", write_msg(NULL, "query to get rules associated with table \"%s\" failed: %s",
tblinfo[t].relname, PQerrorMessage(g_conn)); tblinfo[t].relname, PQerrorMessage(g_conn));
exit_nicely(g_conn); exit_nicely();
} }
nrules = PQntuples(res); nrules = PQntuples(res);

@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $Id: pg_dump.h,v 1.64 2001/06/27 21:21:37 petere Exp $ * $Id: pg_dump.h,v 1.65 2001/07/03 20:21:50 petere Exp $
* *
* Modifications - 6/12/96 - dave@bensoft.com - version 1.13.dhb.2 * Modifications - 6/12/96 - dave@bensoft.com - version 1.13.dhb.2
* *
@ -275,5 +275,6 @@ extern void dumpTables(Archive *fout, TableInfo *tbinfo, int numTables,
extern void dumpIndexes(Archive *fout, IndInfo *indinfo, int numIndexes, extern void dumpIndexes(Archive *fout, IndInfo *indinfo, int numIndexes,
TableInfo *tbinfo, int numTables, const char *tablename); TableInfo *tbinfo, int numTables, const char *tablename);
extern const char *fmtId(const char *identifier, bool force_quotes); extern const char *fmtId(const char *identifier, bool force_quotes);
extern void exit_nicely(void);
#endif /* PG_DUMP_H */ #endif /* PG_DUMP_H */

@ -34,7 +34,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_restore.c,v 1.21 2001/06/27 21:21:37 petere Exp $ * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_restore.c,v 1.22 2001/07/03 20:21:50 petere Exp $
* *
* Modifications - 28-Jun-2000 - pjw@rhyme.com.au * Modifications - 28-Jun-2000 - pjw@rhyme.com.au
* *
@ -248,7 +248,7 @@ main(int argc, char **argv)
case 'u': case 'u':
opts->requirePassword = true; opts->requirePassword = true;
opts->username = simple_prompt("Username: ", 100, true); opts->username = simple_prompt("User name: ", 100, true);
break; break;
case 'U': case 'U':

@ -12,7 +12,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $Id: c.h,v 1.95 2001/06/03 14:53:56 petere Exp $ * $Id: c.h,v 1.96 2001/07/03 20:21:50 petere Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -73,6 +73,8 @@
#else #else
#define gettext(x) (x) #define gettext(x) (x)
#endif #endif
#define gettext_noop(x) (x)
/* ---------------------------------------------------------------- /* ----------------------------------------------------------------
* Section 1: hacks to cope with non-ANSI C compilers * Section 1: hacks to cope with non-ANSI C compilers

Loading…
Cancel
Save