Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit af1b72d

Browse files
committed
#ifdef out pg_dump's check on whether a sequence's sequence_name field
matches the sequence name from pg_class. This fails if the sequence has been renamed, and seems rather pointless in any case. Also improve a couple of error messages about inconsistencies.
1 parent 04cb9a6 commit af1b72d

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

src/bin/pg_dump/pg_dump.c

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
*
2323
*
2424
* IDENTIFICATION
25-
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.241 2002/02/11 00:18:20 tgl Exp $
25+
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.242 2002/02/27 20:59:05 tgl Exp $
2626
*
2727
*-------------------------------------------------------------------------
2828
*/
@@ -2426,8 +2426,12 @@ getTables(int *numTables, FuncInfo *finfo, int numFuncs, const char *tablename)
24262426
n = PQntuples(res2);
24272427
if (n != 1)
24282428
{
2429-
write_msg(NULL, "query to obtain name of primary key of table \"%s\" did not return exactly one result\n",
2430-
tblinfo[i].relname);
2429+
if (n == 0)
2430+
write_msg(NULL, "query to obtain name of primary key of table \"%s\" returned no rows\n",
2431+
tblinfo[i].relname);
2432+
else
2433+
write_msg(NULL, "query to obtain name of primary key of table \"%s\" returned %d rows\n",
2434+
tblinfo[i].relname, n);
24312435
exit_nicely();
24322436
}
24332437

@@ -2573,8 +2577,12 @@ getTables(int *numTables, FuncInfo *finfo, int numFuncs, const char *tablename)
25732577
numFuncs = PQntuples(r);
25742578
if (numFuncs != 1)
25752579
{
2576-
write_msg(NULL, "query to obtain procedure name for trigger \"%s\" did not return exactly one result\n",
2577-
tgname);
2580+
if (numFuncs == 0)
2581+
write_msg(NULL, "query to obtain procedure name for trigger \"%s\" (procedure OID %s) returned no rows\n",
2582+
tgname, tgfuncoid);
2583+
else
2584+
write_msg(NULL, "query to obtain procedure name for trigger \"%s\" (procedure OID %s) returned %d rows\n",
2585+
tgname, tgfuncoid, numFuncs);
25782586
exit_nicely();
25792587
}
25802588

@@ -4736,12 +4744,15 @@ dumpSequence(Archive *fout, TableInfo tbinfo, const bool schemaOnly, const bool
47364744
exit_nicely();
47374745
}
47384746

4747+
/* Disable this check: it fails if sequence has been renamed */
4748+
#ifdef NOT_USED
47394749
if (strcmp(PQgetvalue(res, 0, 0), tbinfo.relname) != 0)
47404750
{
47414751
write_msg(NULL, "query to get data of sequence \"%s\" returned name \"%s\"\n",
47424752
tbinfo.relname, PQgetvalue(res, 0, 0));
47434753
exit_nicely();
47444754
}
4755+
#endif
47454756

47464757
last = PQgetvalue(res, 0, 1);
47474758
incby = PQgetvalue(res, 0, 2);

0 commit comments

Comments
 (0)