Commit 046848c2 authored by Tom Lane's avatar Tom Lane

Improve error message for case where DROP TABLE is rejected because

table has a child table.
parent 1b555ce7
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.152 2000/11/16 22:30:17 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.153 2000/12/22 19:21:37 tgl Exp $
* *
* *
* INTERFACE ROUTINES * INTERFACE ROUTINES
...@@ -61,6 +61,7 @@ ...@@ -61,6 +61,7 @@
#include "utils/builtins.h" #include "utils/builtins.h"
#include "utils/catcache.h" #include "utils/catcache.h"
#include "utils/fmgroids.h" #include "utils/fmgroids.h"
#include "utils/lsyscache.h"
#include "utils/relcache.h" #include "utils/relcache.h"
#include "utils/syscache.h" #include "utils/syscache.h"
#include "utils/temprel.h" #include "utils/temprel.h"
...@@ -970,11 +971,15 @@ RelationRemoveInheritance(Relation relation) ...@@ -970,11 +971,15 @@ RelationRemoveInheritance(Relation relation)
if (HeapTupleIsValid(tuple)) if (HeapTupleIsValid(tuple))
{ {
Oid subclass = ((Form_pg_inherits) GETSTRUCT(tuple))->inhrelid; Oid subclass = ((Form_pg_inherits) GETSTRUCT(tuple))->inhrelid;
char *subclassname;
heap_endscan(scan); subclassname = get_rel_name(subclass);
heap_close(catalogRelation, RowExclusiveLock); /* Just in case get_rel_name fails... */
if (subclassname)
elog(ERROR, "Relation '%u' inherits '%s'", elog(ERROR, "Relation \"%s\" inherits from \"%s\"",
subclassname, RelationGetRelationName(relation));
else
elog(ERROR, "Relation %u inherits from \"%s\"",
subclass, RelationGetRelationName(relation)); subclass, RelationGetRelationName(relation));
} }
heap_endscan(scan); heap_endscan(scan);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment