diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2000-12-22 19:21:37 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2000-12-22 19:21:37 +0000 |
commit | 046848c2729ef81c25fe4f6fdc216e4f085da21d (patch) | |
tree | a4f80827b363caa283c080c09efbb315a68abb17 | |
parent | 1b555ce791bd25feab0d60ef167b0e7c0ffa7a09 (diff) | |
download | postgresql-046848c2729ef81c25fe4f6fdc216e4f085da21d.tar.gz postgresql-046848c2729ef81c25fe4f6fdc216e4f085da21d.zip |
Improve error message for case where DROP TABLE is rejected because
table has a child table.
-rw-r--r-- | src/backend/catalog/heap.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/backend/catalog/heap.c b/src/backend/catalog/heap.c index 3da6d82d4d0..b2d2566bf3f 100644 --- a/src/backend/catalog/heap.c +++ b/src/backend/catalog/heap.c @@ -8,7 +8,7 @@ * * * 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 @@ -61,6 +61,7 @@ #include "utils/builtins.h" #include "utils/catcache.h" #include "utils/fmgroids.h" +#include "utils/lsyscache.h" #include "utils/relcache.h" #include "utils/syscache.h" #include "utils/temprel.h" @@ -970,12 +971,16 @@ RelationRemoveInheritance(Relation relation) if (HeapTupleIsValid(tuple)) { Oid subclass = ((Form_pg_inherits) GETSTRUCT(tuple))->inhrelid; + char *subclassname; - heap_endscan(scan); - heap_close(catalogRelation, RowExclusiveLock); - - elog(ERROR, "Relation '%u' inherits '%s'", - subclass, RelationGetRelationName(relation)); + subclassname = get_rel_name(subclass); + /* Just in case get_rel_name fails... */ + if (subclassname) + elog(ERROR, "Relation \"%s\" inherits from \"%s\"", + subclassname, RelationGetRelationName(relation)); + else + elog(ERROR, "Relation %u inherits from \"%s\"", + subclass, RelationGetRelationName(relation)); } heap_endscan(scan); |