PG_MODULE_MAGIC;
-/*
- * WHERE caluse optimization level
- */
-#define EVAL_QUAL_LOCAL 0 /* evaluate none in foreign, all in local */
-#define EVAL_QUAL_BOTH 1 /* evaluate some in foreign, all in local */
-#define EVAL_QUAL_FOREIGN 2 /* evaluate some in foreign, rest in local */
-
-#define OPTIMIZE_WHERE_CLAUSE EVAL_QUAL_FOREIGN
-
extern Datum postgresql_fdw_handler(PG_FUNCTION_ARGS);
/*
/*
* Scanning multiple relations in a ForeignScan node is not supported.
*/
- prefix = false;
-#if 0
prefix = list_length(estate->es_range_table) > 1;
-#endif
/* The alias of relation is used in both SELECT clause and FROM clause. */
aliasname_q = quote_identifier(rte->eref->aliasname);
* The Plan.qual is never changed, so multiple use of the Plan with
* PREPARE/EXECUTE work properly.
*/
-#if OPTIMIZE_WHERE_CLAUSE > EVAL_QUAL_LOCAL
if (scanstate->ss.ps.plan->qual)
{
List *local_qual = NIL;
else
local_qual = lappend(local_qual, state);
}
-#if OPTIMIZE_WHERE_CLAUSE == EVAL_QUAL_FOREIGN
+
/*
* If the optimization level is EVAL_QUAL_FOREIGN, replace the original
* qual with the list of ExprStates which should be evaluated in the
* local server.
*/
scanstate->ss.ps.qual = local_qual;
-#endif
/*
* Deparse quals to be evaluated in the foreign server if any.
list_free(foreign_expr);
}
}
-#endif
elog(DEBUG1, "deparsed SQL is \"%s\"", sql.data);