From 7f6776e50ab97801e080b80f43a6a15675f2595f Mon Sep 17 00:00:00 2001 From: Sandro Santilli Date: Tue, 11 Nov 2003 10:14:57 +0000 Subject: [PATCH] Added support for PG74 git-svn-id: http://svn.osgeo.org/postgis/trunk@353 b70326c6-7e19-0410-871a-916f4a2858ee --- postgis_estimate.c | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/postgis_estimate.c b/postgis_estimate.c index 1a3da700e..e8d81b539 100644 --- a/postgis_estimate.c +++ b/postgis_estimate.c @@ -11,6 +11,9 @@ * ********************************************************************** * $Log$ + * Revision 1.7 2003/11/11 10:14:57 strk + * Added support for PG74 + * * Revision 1.6 2003/07/25 17:08:37 pramsey * Moved Cygwin endian define out of source files into postgis.h common * header file. @@ -540,9 +543,9 @@ get_restriction_var(List *args, /* Ignore any binary-compatible relabeling */ if (IsA(left, RelabelType)) - left = ((RelabelType *) left)->arg; + left = (Node *)((RelabelType *) left)->arg; if (IsA(right, RelabelType)) - right = ((RelabelType *) right)->arg; + right = (Node *)((RelabelType *) right)->arg; /* Look for the var */ @@ -719,7 +722,10 @@ genericcostestimate2(Query *root, RelOptInfo *rel, { double numIndexTuples; double numIndexPages; - List *selectivityQuals = indexQuals; + List *selectivityQuals = indexQuals; +#if USE_VERSION >= 74 + QualCost index_qual_cost; +#endif //elog(NOTICE,"in genericcostestimate"); @@ -749,7 +755,11 @@ genericcostestimate2(Query *root, RelOptInfo *rel, /* Estimate the fraction of main-table tuples that will be visited */ *indexSelectivity = clauselist_selectivity(root, selectivityQuals, - lfirsti(rel->relids)); +#if USE_VERSION < 74 + lfirsti(rel->relids)); +#else + rel->relid, JOIN_INNER); +#endif /* * Estimate the number of tuples that will be visited. We do it in @@ -805,9 +815,18 @@ genericcostestimate2(Query *root, RelOptInfo *rel, * the scan. */ +#if USE_VERSION < 74 *indexStartupCost = 0; *indexTotalCost = numIndexPages + - (cpu_index_tuple_cost + cost_qual_eval(indexQuals)) * numIndexTuples; + (cpu_index_tuple_cost + cost_qual_eval(indexQuals)) * + numIndexTuples; +#else + cost_qual_eval(&index_qual_cost, indexQuals); + *indexStartupCost = index_qual_cost.startup; + *indexTotalCost = numIndexPages + + (cpu_index_tuple_cost + index_qual_cost.per_tuple) * + numIndexTuples; +#endif //elog(NOTICE,"cpu_index_tuple_cost = %lf, cost_qual_eval(indexQuals)) = %lf",