aboutsummaryrefslogtreecommitdiff
path: root/src/backend/optimizer/plan
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/optimizer/plan')
-rw-r--r--src/backend/optimizer/plan/createplan.c25
-rw-r--r--src/backend/optimizer/plan/initsplan.c5
-rw-r--r--src/backend/optimizer/plan/subselect.c28
3 files changed, 36 insertions, 22 deletions
diff --git a/src/backend/optimizer/plan/createplan.c b/src/backend/optimizer/plan/createplan.c
index 4069ed66e58..bfb97bc1eb5 100644
--- a/src/backend/optimizer/plan/createplan.c
+++ b/src/backend/optimizer/plan/createplan.c
@@ -10,7 +10,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/plan/createplan.c,v 1.100 2000/11/12 00:36:58 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/plan/createplan.c,v 1.101 2000/11/16 22:30:24 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -396,17 +396,19 @@ create_indexscan_plan(Query *root,
HeapTuple indexTuple;
Form_pg_index index;
- indexTuple = SearchSysCacheTuple(INDEXRELID,
- ObjectIdGetDatum(lfirsti(ixid)),
- 0, 0, 0);
+ indexTuple = SearchSysCache(INDEXRELID,
+ ObjectIdGetDatum(lfirsti(ixid)),
+ 0, 0, 0);
if (!HeapTupleIsValid(indexTuple))
elog(ERROR, "create_plan: index %u not found", lfirsti(ixid));
index = (Form_pg_index) GETSTRUCT(indexTuple);
if (index->indislossy)
{
lossy = true;
+ ReleaseSysCache(indexTuple);
break;
}
+ ReleaseSysCache(indexTuple);
}
/*
@@ -904,18 +906,19 @@ fix_indxqual_references(List *indexquals, IndexPath *index_path)
Form_pg_index index;
/* Get the relam from the index's pg_class entry */
- indexTuple = SearchSysCacheTuple(RELOID,
- ObjectIdGetDatum(indexid),
- 0, 0, 0);
+ indexTuple = SearchSysCache(RELOID,
+ ObjectIdGetDatum(indexid),
+ 0, 0, 0);
if (!HeapTupleIsValid(indexTuple))
elog(ERROR, "fix_indxqual_references: index %u not found in pg_class",
indexid);
relam = ((Form_pg_class) GETSTRUCT(indexTuple))->relam;
+ ReleaseSysCache(indexTuple);
/* Need the index's pg_index entry for other stuff */
- indexTuple = SearchSysCacheTuple(INDEXRELID,
- ObjectIdGetDatum(indexid),
- 0, 0, 0);
+ indexTuple = SearchSysCache(INDEXRELID,
+ ObjectIdGetDatum(indexid),
+ 0, 0, 0);
if (!HeapTupleIsValid(indexTuple))
elog(ERROR, "fix_indxqual_references: index %u not found in pg_index",
indexid);
@@ -927,6 +930,8 @@ fix_indxqual_references(List *indexquals, IndexPath *index_path)
relam,
index));
+ ReleaseSysCache(indexTuple);
+
indexids = lnext(indexids);
}
return fixed_quals;
diff --git a/src/backend/optimizer/plan/initsplan.c b/src/backend/optimizer/plan/initsplan.c
index acee58b7f07..3bea06e2af6 100644
--- a/src/backend/optimizer/plan/initsplan.c
+++ b/src/backend/optimizer/plan/initsplan.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/plan/initsplan.c,v 1.51 2000/09/29 18:21:33 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/plan/initsplan.c,v 1.52 2000/11/16 22:30:25 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -31,6 +31,7 @@
#include "parser/parse_oper.h"
#include "parser/parse_type.h"
#include "utils/lsyscache.h"
+#include "utils/syscache.h"
static void mark_baserels_for_outer_join(Query *root, Relids rels,
@@ -636,6 +637,8 @@ process_implied_equality(Query *root, Node *item1, Node *item2,
BOOLOID); /* operator result type */
clause->args = makeList2(item1, item2);
+ ReleaseSysCache(eq_operator);
+
/*
* Note: we mark the qual "pushed down" to ensure that it can never be
* taken for an original JOIN/ON clause. We also claim it is an outer-
diff --git a/src/backend/optimizer/plan/subselect.c b/src/backend/optimizer/plan/subselect.c
index 296164acb89..c36e7fe7b81 100644
--- a/src/backend/optimizer/plan/subselect.c
+++ b/src/backend/optimizer/plan/subselect.c
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/plan/subselect.c,v 1.44 2000/10/26 21:36:09 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/plan/subselect.c,v 1.45 2000/11/16 22:30:25 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -23,7 +23,7 @@
#include "optimizer/subselect.h"
#include "parser/parse_expr.h"
#include "parser/parse_oper.h"
-#include "utils/lsyscache.h"
+#include "utils/syscache.h"
Index PlannerQueryLevel; /* level of current query */
@@ -271,8 +271,11 @@ make_subplan(SubLink *slink)
pfree(var); /* var is only needed for new_param */
Assert(IsA(oper, Oper));
- tup = get_operator_tuple(oper->opno);
- Assert(HeapTupleIsValid(tup));
+ tup = SearchSysCache(OPEROID,
+ ObjectIdGetDatum(oper->opno),
+ 0, 0, 0);
+ if (! HeapTupleIsValid(tup))
+ elog(ERROR, "cache lookup failed for operator %u", oper->opno);
opform = (Form_pg_operator) GETSTRUCT(tup);
/*
@@ -283,6 +286,8 @@ make_subplan(SubLink *slink)
exprType(lefthand), opform->oprleft);
right = make_operand("", (Node *) prm,
prm->paramtype, opform->oprright);
+ ReleaseSysCache(tup);
+
newoper = lappend(newoper,
make_opclause(oper,
(Var *) left,
@@ -401,15 +406,14 @@ make_subplan(SubLink *slink)
Node *left,
*right;
- /*
- * XXX really ought to fill in constlen and constbyval
- * correctly, but right now ExecEvalExpr won't look at them...
- */
- con = makeConst(te->resdom->restype, 0, 0, true, 0, 0, 0);
+ con = makeNullConst(te->resdom->restype);
Assert(IsA(oper, Oper));
- tup = get_operator_tuple(oper->opno);
- Assert(HeapTupleIsValid(tup));
+ tup = SearchSysCache(OPEROID,
+ ObjectIdGetDatum(oper->opno),
+ 0, 0, 0);
+ if (! HeapTupleIsValid(tup))
+ elog(ERROR, "cache lookup failed for operator %u", oper->opno);
opform = (Form_pg_operator) GETSTRUCT(tup);
/*
@@ -420,6 +424,8 @@ make_subplan(SubLink *slink)
exprType(lefthand), opform->oprleft);
right = make_operand("", (Node *) con,
con->consttype, opform->oprright);
+ ReleaseSysCache(tup);
+
newoper = lappend(newoper,
make_opclause(oper,
(Var *) left,