mirror of
https://git.postgresql.org/git/postgresql.git
synced 2025-01-18 18:44:06 +08:00
Make pg_dump emit a useful error message, instead of just dumping core,
if it finds a pg_rewrite entry for which there is no pg_class entry. Per report from Andrew Slobodyanyk.
This commit is contained in:
parent
e7fb9f18bf
commit
28bcc344b5
@ -12,7 +12,7 @@
|
|||||||
* by PostgreSQL
|
* by PostgreSQL
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump.c,v 1.403 2005/02/22 04:39:35 momjian Exp $
|
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump.c,v 1.404 2005/03/14 18:57:33 tgl Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -3154,6 +3154,13 @@ getRules(int *numRules)
|
|||||||
ruleinfo[i].dobj.name = strdup(PQgetvalue(res, i, i_rulename));
|
ruleinfo[i].dobj.name = strdup(PQgetvalue(res, i, i_rulename));
|
||||||
ruletableoid = atooid(PQgetvalue(res, i, i_ruletable));
|
ruletableoid = atooid(PQgetvalue(res, i, i_ruletable));
|
||||||
ruleinfo[i].ruletable = findTableByOid(ruletableoid);
|
ruleinfo[i].ruletable = findTableByOid(ruletableoid);
|
||||||
|
if (ruleinfo[i].ruletable == NULL)
|
||||||
|
{
|
||||||
|
write_msg(NULL, "failed sanity check, parent table OID %u of pg_rewrite entry OID %u not found\n",
|
||||||
|
ruletableoid,
|
||||||
|
ruleinfo[i].dobj.catId.oid);
|
||||||
|
exit_nicely();
|
||||||
|
}
|
||||||
ruleinfo[i].dobj.namespace = ruleinfo[i].ruletable->dobj.namespace;
|
ruleinfo[i].dobj.namespace = ruleinfo[i].ruletable->dobj.namespace;
|
||||||
ruleinfo[i].ev_type = *(PQgetvalue(res, i, i_ev_type));
|
ruleinfo[i].ev_type = *(PQgetvalue(res, i, i_ev_type));
|
||||||
ruleinfo[i].is_instead = *(PQgetvalue(res, i, i_is_instead)) == 't';
|
ruleinfo[i].is_instead = *(PQgetvalue(res, i, i_is_instead)) == 't';
|
||||||
|
Loading…
Reference in New Issue
Block a user