From: Tom Lane Date: Fri, 9 Jun 2000 03:17:13 +0000 (+0000) Subject: Cause inheritance patch to meet minimum coding standards (no gcc X-Git-Tag: REL7_1_BETA~1161 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ce7746201b81ba57c0145b631013b13f00a0537a;p=postgresql Cause inheritance patch to meet minimum coding standards (no gcc warnings). --- diff --git a/src/backend/optimizer/plan/planner.c b/src/backend/optimizer/plan/planner.c index 91ce6f99c1..c19cc7814e 100644 --- a/src/backend/optimizer/plan/planner.c +++ b/src/backend/optimizer/plan/planner.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/optimizer/plan/planner.c,v 1.81 2000/06/09 01:44:14 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/optimizer/plan/planner.c,v 1.82 2000/06/09 03:17:13 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -23,6 +23,7 @@ #include "optimizer/clauses.h" #include "optimizer/internal.h" #include "optimizer/paths.h" +#include "optimizer/plancat.h" #include "optimizer/planmain.h" #include "optimizer/planner.h" #include "optimizer/prep.h" diff --git a/src/backend/optimizer/util/plancat.c b/src/backend/optimizer/util/plancat.c index 42a2fb416a..a34e8251fb 100644 --- a/src/backend/optimizer/util/plancat.c +++ b/src/backend/optimizer/util/plancat.c @@ -10,9 +10,9 @@ * * IDENTIFICATION <<<<<<< plancat.c - * $Header: /cvsroot/pgsql/src/backend/optimizer/util/plancat.c,v 1.54 2000/06/09 01:44:16 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/optimizer/util/plancat.c,v 1.55 2000/06/09 03:17:12 tgl Exp $ ======= - * $Header: /cvsroot/pgsql/src/backend/optimizer/util/plancat.c,v 1.54 2000/06/09 01:44:16 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/optimizer/util/plancat.c,v 1.55 2000/06/09 03:17:12 tgl Exp $ >>>>>>> 1.53 * *------------------------------------------------------------------------- @@ -292,13 +292,18 @@ find_inheritance_children(Oid inhparent) * Currently has_subclass is only used as an efficiency hack, so this * is ok. */ -bool has_subclass(Oid relationId) +bool +has_subclass(Oid relationId) { - HeapTuple tuple = - SearchSysCacheTuple(RELOID, - ObjectIdGetDatum(relationId), - 0, 0, 0); - return ((Form_pg_class) GETSTRUCT(tuple))->relhassubclass; + HeapTuple tuple = + SearchSysCacheTuple(RELOID, + ObjectIdGetDatum(relationId), + 0, 0, 0); + + if (!HeapTupleIsValid(tuple)) + elog(ERROR, "has_subclass: Relation %u not found", + relationId); + return ((Form_pg_class) GETSTRUCT(tuple))->relhassubclass; } #ifdef NOT_USED diff --git a/src/include/optimizer/plancat.h b/src/include/optimizer/plancat.h index 745d8dc73e..a5c09f4935 100644 --- a/src/include/optimizer/plancat.h +++ b/src/include/optimizer/plancat.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2000, PostgreSQL, Inc * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: plancat.h,v 1.18 2000/04/12 17:16:42 momjian Exp $ + * $Id: plancat.h,v 1.19 2000/06/09 03:17:11 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -24,6 +24,8 @@ extern List *find_secondary_indexes(Query *root, Index relid); extern List *find_inheritance_children(Oid inhparent); +extern bool has_subclass(Oid relationId); + extern Selectivity restriction_selectivity(Oid functionObjectId, Oid operatorObjectId, Oid relationObjectId,