提交 af1b72d8 编写于 作者: T Tom Lane

#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.
上级 04cb9a6a
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.241 2002/02/11 00:18:20 tgl Exp $ * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.242 2002/02/27 20:59:05 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -2426,8 +2426,12 @@ getTables(int *numTables, FuncInfo *finfo, int numFuncs, const char *tablename) ...@@ -2426,8 +2426,12 @@ getTables(int *numTables, FuncInfo *finfo, int numFuncs, const char *tablename)
n = PQntuples(res2); n = PQntuples(res2);
if (n != 1) if (n != 1)
{ {
write_msg(NULL, "query to obtain name of primary key of table \"%s\" did not return exactly one result\n", if (n == 0)
tblinfo[i].relname); write_msg(NULL, "query to obtain name of primary key of table \"%s\" returned no rows\n",
tblinfo[i].relname);
else
write_msg(NULL, "query to obtain name of primary key of table \"%s\" returned %d rows\n",
tblinfo[i].relname, n);
exit_nicely(); exit_nicely();
} }
...@@ -2573,8 +2577,12 @@ getTables(int *numTables, FuncInfo *finfo, int numFuncs, const char *tablename) ...@@ -2573,8 +2577,12 @@ getTables(int *numTables, FuncInfo *finfo, int numFuncs, const char *tablename)
numFuncs = PQntuples(r); numFuncs = PQntuples(r);
if (numFuncs != 1) if (numFuncs != 1)
{ {
write_msg(NULL, "query to obtain procedure name for trigger \"%s\" did not return exactly one result\n", if (numFuncs == 0)
tgname); write_msg(NULL, "query to obtain procedure name for trigger \"%s\" (procedure OID %s) returned no rows\n",
tgname, tgfuncoid);
else
write_msg(NULL, "query to obtain procedure name for trigger \"%s\" (procedure OID %s) returned %d rows\n",
tgname, tgfuncoid, numFuncs);
exit_nicely(); exit_nicely();
} }
...@@ -4736,12 +4744,15 @@ dumpSequence(Archive *fout, TableInfo tbinfo, const bool schemaOnly, const bool ...@@ -4736,12 +4744,15 @@ dumpSequence(Archive *fout, TableInfo tbinfo, const bool schemaOnly, const bool
exit_nicely(); exit_nicely();
} }
/* Disable this check: it fails if sequence has been renamed */
#ifdef NOT_USED
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(); exit_nicely();
} }
#endif
last = PQgetvalue(res, 0, 1); last = PQgetvalue(res, 0, 1);
incby = PQgetvalue(res, 0, 2); incby = PQgetvalue(res, 0, 2);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册