Skip to content

Commit 28bcc34

Browse files
committed
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.
1 parent e7fb9f1 commit 28bcc34

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/bin/pg_dump/pg_dump.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* by PostgreSQL
1313
*
1414
* IDENTIFICATION
15-
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump.c,v 1.403 2005/02/22 04:39:35 momjian Exp $
15+
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump.c,v 1.404 2005/03/14 18:57:33 tgl Exp $
1616
*
1717
*-------------------------------------------------------------------------
1818
*/
@@ -3154,6 +3154,13 @@ getRules(int *numRules)
31543154
ruleinfo[i].dobj.name = strdup(PQgetvalue(res, i, i_rulename));
31553155
ruletableoid = atooid(PQgetvalue(res, i, i_ruletable));
31563156
ruleinfo[i].ruletable = findTableByOid(ruletableoid);
3157+
if (ruleinfo[i].ruletable == NULL)
3158+
{
3159+
write_msg(NULL, "failed sanity check, parent table OID %u of pg_rewrite entry OID %u not found\n",
3160+
ruletableoid,
3161+
ruleinfo[i].dobj.catId.oid);
3162+
exit_nicely();
3163+
}
31573164
ruleinfo[i].dobj.namespace = ruleinfo[i].ruletable->dobj.namespace;
31583165
ruleinfo[i].ev_type = *(PQgetvalue(res, i, i_ev_type));
31593166
ruleinfo[i].is_instead = *(PQgetvalue(res, i, i_is_instead)) == 't';

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy