*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.2 1996/07/30 07:45:27 scrappy Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.3 1996/09/10 06:48:01 scrappy Exp $
*
*-------------------------------------------------------------------------
*/
dest = queryDesc->dest;
destination = (void (*)()) DestToFunction(dest);
+#ifdef INDEXSCAN_PATCH
+ /*
+ * If the plan is an index scan and some of the scan key are
+ * function arguments rescan the indices after the parameter
+ * values have been stored in the execution state. DZ - 27-8-1996
+ */
+ if ((nodeTag(plan) == T_IndexScan) &&
+ (((IndexScan *)plan)->indxstate->iss_RuntimeKeyInfo != NULL)) {
+ ExprContext *econtext;
+ econtext = ((IndexScan *)plan)->scan.scanstate->cstate.cs_ExprContext;
+ ExecIndexReScan((IndexScan *)plan, econtext, plan);
+ }
+#endif
+
switch(feature) {
case EXEC_RUN:
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/path/indxpath.c,v 1.2 1996/07/19 07:13:26 scrappy Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/path/indxpath.c,v 1.3 1996/09/10 06:48:12 scrappy Exp $
*
*-------------------------------------------------------------------------
*/
/*
* Check for standard s-argable clause
*/
+#ifdef INDEXSCAN_PATCH
+ /* Handle also function parameters. DZ - 27-8-1996 */
+ if ((rightop && IsA(rightop,Const)) ||
+ (rightop && IsA(rightop,Param)))
+#else
if (rightop && IsA(rightop,Const))
+#endif
{
restrict_op = ((Oper*)((Expr*)clause)->oper)->opno;
isIndexable =
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/plan/createplan.c,v 1.2 1996/08/26 06:31:15 scrappy Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/plan/createplan.c,v 1.3 1996/09/10 06:48:32 scrappy Exp $
*
*-------------------------------------------------------------------------
*/
}
} else if(IsA(clause,Const)) {
return(clause);
+#ifdef INDEXSCAN_PATCH
+ } else if(IsA(clause,Param)) {
+ /* Function parameter used as index scan arg. DZ - 27-8-1996 */
+ return(clause);
+#endif
} else if(is_opclause(clause) &&
is_funcclause((Node*)get_leftop((Expr*)clause)) &&
((Func*)((Expr*)get_leftop((Expr*)clause))->oper)->funcisindex){
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/util/clauses.c,v 1.2 1996/07/25 20:36:46 scrappy Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/util/clauses.c,v 1.3 1996/09/10 06:48:41 scrappy Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
*flag = (_SELEC_CONSTANT_RIGHT_ | _SELEC_NOT_CONSTANT_);
}
+#ifdef INDEXSCAN_PATCH
+ } else if (is_opclause(clause) && IsA(left,Var) && IsA(right,Param)) {
+ /* Function parameter used as index scan arg. DZ - 27-8-1996 */
+ *relid = left->varno;
+ *attno = left->varattno;
+ *constval = 0;
+ *flag = (_SELEC_NOT_CONSTANT_);
+#endif
}else if (is_opclause(clause) &&
is_funcclause((Node*)left) &&
IsA(right,Const)) {
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.6 1996/08/19 13:37:49 scrappy Exp $
+ * $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.7 1996/09/10 06:48:52 scrappy Exp $
*
* NOTES
* this is the "main" module of the postgres backend and
ShowUsage();
}
plan_list = lappend(plan_list, plan);
+#ifdef INDEXSCAN_PATCH
+ /* ----------------
+ * Print plan if debugging.
+ * This has been moved here to get debugging output
+ * also for queries in functions. DZ - 27-8-1996
+ * ----------------
+ */
+ if ( DebugPrintPlan == true ) {
+ printf("\nPlan is :\n");
+ nodeDisplay(plan);
+ printf("\n");
+ }
+#endif
}
}
plan = (Plan *) lfirst(plan_list);
plan_list = lnext(plan_list);
+#ifdef INDEXSCAN_PATCH
+ /*
+ * Print moved in pg_plan. DZ - 27-8-1996
+ */
+#else
/* ----------------
* print plan if debugging
* ----------------
nodeDisplay(plan);
printf("\n");
}
+#endif
/* ----------------
* execute the plan
*/
if (IsUnderPostmaster == false) {
puts("\nPOSTGRES backend interactive interface");
- puts("$Revision: 1.6 $ $Date: 1996/08/19 13:37:49 $");
+ puts("$Revision: 1.7 $ $Date: 1996/09/10 06:48:52 $");
}
/* ----------------