Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 046848c

Browse files
committed
Improve error message for case where DROP TABLE is rejected because
table has a child table.
1 parent 1b555ce commit 046848c

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

src/backend/catalog/heap.c

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.152 2000/11/16 22:30:17 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.153 2000/12/22 19:21:37 tgl Exp $
1212
*
1313
*
1414
* INTERFACE ROUTINES
@@ -61,6 +61,7 @@
6161
#include "utils/builtins.h"
6262
#include "utils/catcache.h"
6363
#include "utils/fmgroids.h"
64+
#include "utils/lsyscache.h"
6465
#include "utils/relcache.h"
6566
#include "utils/syscache.h"
6667
#include "utils/temprel.h"
@@ -970,12 +971,16 @@ RelationRemoveInheritance(Relation relation)
970971
if (HeapTupleIsValid(tuple))
971972
{
972973
Oid subclass = ((Form_pg_inherits) GETSTRUCT(tuple))->inhrelid;
974+
char *subclassname;
973975

974-
heap_endscan(scan);
975-
heap_close(catalogRelation, RowExclusiveLock);
976-
977-
elog(ERROR, "Relation '%u' inherits '%s'",
978-
subclass, RelationGetRelationName(relation));
976+
subclassname = get_rel_name(subclass);
977+
/* Just in case get_rel_name fails... */
978+
if (subclassname)
979+
elog(ERROR, "Relation \"%s\" inherits from \"%s\"",
980+
subclassname, RelationGetRelationName(relation));
981+
else
982+
elog(ERROR, "Relation %u inherits from \"%s\"",
983+
subclass, RelationGetRelationName(relation));
979984
}
980985
heap_endscan(scan);
981986

0 commit comments

Comments
 (0)