aboutsummaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2000-08-13 02:50:35 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2000-08-13 02:50:35 +0000
commit37168b8da43d9a6f7471cf757119ece6c96fb2b9 (patch)
treece7059e77ac05a045f9de7c6272c7e1c8210d96a /src/include
parent766fb7f707f9527be219353f5f970aab3d786554 (diff)
downloadpostgresql-37168b8da43d9a6f7471cf757119ece6c96fb2b9.tar.gz
postgresql-37168b8da43d9a6f7471cf757119ece6c96fb2b9.zip
Clean up handling of variable-free qual clauses. System now does the
right thing with variable-free clauses that contain noncachable functions, such as 'WHERE random() < 0.5' --- these are evaluated once per potential output tuple. Expressions that contain only Params are now candidates to be indexscan quals --- for example, 'var = ($1 + 1)' can now be indexed. Cope with RelabelType nodes atop potential indexscan variables --- this oversight prevents 7.0.* from recognizing some potentially indexscanable situations.
Diffstat (limited to 'src/include')
-rw-r--r--src/include/executor/nodeNestloop.h4
-rw-r--r--src/include/nodes/execnodes.h4
-rw-r--r--src/include/optimizer/clauses.h10
-rw-r--r--src/include/utils/lsyscache.h25
4 files changed, 25 insertions, 18 deletions
diff --git a/src/include/executor/nodeNestloop.h b/src/include/executor/nodeNestloop.h
index b1242b0da0d..42e3fae8335 100644
--- a/src/include/executor/nodeNestloop.h
+++ b/src/include/executor/nodeNestloop.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: nodeNestloop.h,v 1.12 2000/01/26 05:58:05 momjian Exp $
+ * $Id: nodeNestloop.h,v 1.13 2000/08/13 02:50:20 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -16,7 +16,7 @@
#include "nodes/plannodes.h"
-extern TupleTableSlot *ExecNestLoop(NestLoop *node, Plan *parent);
+extern TupleTableSlot *ExecNestLoop(NestLoop *node);
extern bool ExecInitNestLoop(NestLoop *node, EState *estate, Plan *parent);
extern int ExecCountSlotsNestLoop(NestLoop *node);
extern void ExecEndNestLoop(NestLoop *node);
diff --git a/src/include/nodes/execnodes.h b/src/include/nodes/execnodes.h
index a9ef6e78ae3..6e691c1d786 100644
--- a/src/include/nodes/execnodes.h
+++ b/src/include/nodes/execnodes.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: execnodes.h,v 1.45 2000/08/06 04:26:29 tgl Exp $
+ * $Id: execnodes.h,v 1.46 2000/08/13 02:50:24 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -380,6 +380,7 @@ typedef struct CommonScanState
* NumScanKeys array of no of keys in each Skey struct
* RuntimeKeyInfo array of array of flags for Skeys evaled at runtime
* RuntimeContext expr context for evaling runtime Skeys
+ * RuntimeKeysReady true if runtime Skeys have been computed
* RelationDescs ptr to array of relation descriptors
* ScanDescs ptr to array of scan descriptors
* ----------------
@@ -394,6 +395,7 @@ typedef struct IndexScanState
int *iss_NumScanKeys;
int **iss_RuntimeKeyInfo;
ExprContext *iss_RuntimeContext;
+ bool iss_RuntimeKeysReady;
RelationPtr iss_RelationDescs;
IndexScanDescPtr iss_ScanDescs;
HeapTupleData iss_htup;
diff --git a/src/include/optimizer/clauses.h b/src/include/optimizer/clauses.h
index 946a9b0586f..1b2bcd92055 100644
--- a/src/include/optimizer/clauses.h
+++ b/src/include/optimizer/clauses.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: clauses.h,v 1.37 2000/05/30 04:24:57 tgl Exp $
+ * $Id: clauses.h,v 1.38 2000/08/13 02:50:26 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -53,7 +53,13 @@ extern bool contain_subplans(Node *clause);
extern List *pull_subplans(Node *clause);
extern void check_subplans_for_ungrouped_vars(Node *clause, Query *query);
-extern List *pull_constant_clauses(List *quals, List **constantQual);
+extern bool contain_noncachable_functions(Node *clause);
+
+extern bool is_pseudo_constant_clause(Node *clause);
+
+extern List *pull_constant_clauses(List *quals,
+ List **noncachableQual,
+ List **constantQual);
extern void clause_get_relids_vars(Node *clause, Relids *relids, List **vars);
extern int NumRelids(Node *clause);
diff --git a/src/include/utils/lsyscache.h b/src/include/utils/lsyscache.h
index 5c6c09ccbc3..9c105576ae2 100644
--- a/src/include/utils/lsyscache.h
+++ b/src/include/utils/lsyscache.h
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: lsyscache.h,v 1.24 2000/06/08 22:37:58 momjian Exp $
+ * $Id: lsyscache.h,v 1.25 2000/08/13 02:50:31 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -15,7 +15,7 @@
#include "access/htup.h"
-extern bool op_class(Oid opid, Oid opclass, Oid amopid);
+extern bool op_class(Oid opno, Oid opclass, Oid amopid);
extern char *get_attname(Oid relid, AttrNumber attnum);
extern AttrNumber get_attnum(Oid relid, char *attname);
extern Oid get_atttype(Oid relid, AttrNumber attnum);
@@ -23,21 +23,20 @@ extern bool get_attisset(Oid relid, char *attname);
extern int32 get_atttypmod(Oid relid, AttrNumber attnum);
extern double get_attdisbursion(Oid relid, AttrNumber attnum,
double min_estimate);
-extern RegProcedure get_opcode(Oid opid);
-extern char *get_opname(Oid opid);
-extern bool op_mergejoinable(Oid opid, Oid ltype, Oid rtype,
+extern RegProcedure get_opcode(Oid opno);
+extern char *get_opname(Oid opno);
+extern bool op_mergejoinable(Oid opno, Oid ltype, Oid rtype,
Oid *leftOp, Oid *rightOp);
-extern Oid op_hashjoinable(Oid opid, Oid ltype, Oid rtype);
-extern Oid get_commutator(Oid opid);
+extern Oid op_hashjoinable(Oid opno, Oid ltype, Oid rtype);
+extern bool op_iscachable(Oid opno);
extern HeapTuple get_operator_tuple(Oid opno);
-extern Oid get_negator(Oid opid);
-extern RegProcedure get_oprrest(Oid opid);
-extern RegProcedure get_oprjoin(Oid opid);
+extern Oid get_commutator(Oid opno);
+extern Oid get_negator(Oid opno);
+extern RegProcedure get_oprrest(Oid opno);
+extern RegProcedure get_oprjoin(Oid opno);
extern Oid get_func_rettype(Oid funcid);
+extern bool func_iscachable(Oid funcid);
extern char *get_rel_name(Oid relid);
-extern struct varlena *get_relstub(Oid relid, int no, bool *islast);
-extern Oid get_ruleid(char *rulename);
-extern Oid get_eventrelid(Oid ruleid);
extern int16 get_typlen(Oid typid);
extern bool get_typbyval(Oid typid);
extern Datum get_typdefault(Oid typid);