aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2006-12-28 19:53:05 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2006-12-28 19:53:05 +0000
commitc99ddfc43de7d69d903d150a8d372b020371d49a (patch)
tree701cb73a2cd33ae1b7d0cfd11ec72388708bb063 /src
parent91868e7df07185de4cf5511203009779d3463416 (diff)
downloadpostgresql-c99ddfc43de7d69d903d150a8d372b020371d49a.tar.gz
postgresql-c99ddfc43de7d69d903d150a8d372b020371d49a.zip
Enable btree_predicate_proof() to make proofs involving cross-data-type
predicate operators. The hard stuff turns out to be already done in the previous commit, we need merely open the floodgates...
Diffstat (limited to 'src')
-rw-r--r--src/backend/optimizer/util/predtest.c20
1 files changed, 5 insertions, 15 deletions
diff --git a/src/backend/optimizer/util/predtest.c b/src/backend/optimizer/util/predtest.c
index 5f81cae4e85..7506125dd97 100644
--- a/src/backend/optimizer/util/predtest.c
+++ b/src/backend/optimizer/util/predtest.c
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/optimizer/util/predtest.c,v 1.11 2006/12/23 00:43:11 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/optimizer/util/predtest.c,v 1.12 2006/12/28 19:53:05 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -1131,7 +1131,7 @@ static const StrategyNumber BT_refute_table[6][6] = {
};
-/*----------
+/*
* btree_predicate_proof
* Does the predicate implication or refutation test for a "simple clause"
* predicate and a "simple clause" restriction, when both are simple
@@ -1152,7 +1152,6 @@ static const StrategyNumber BT_refute_table[6][6] = {
* the operators are too. As of 8.0 it's possible for opfamilies to contain
* operators that are merely stable, and we dare not make deductions with
* these.)
- *----------
*/
static bool
btree_predicate_proof(Expr *predicate, Node *clause, bool refute_it)
@@ -1274,15 +1273,9 @@ btree_predicate_proof(Expr *predicate, Node *clause, bool refute_it)
/*
* Try to find a btree opfamily containing the needed operators.
*
- * XXX this needs work!!!!!!!!!!!!!!!!!!!!!!!
- *
* We must find a btree opfamily that contains both operators, else the
- * implication can't be determined. Also, the pred_op has to be of
- * default subtype (implying left and right input datatypes are the same);
- * otherwise it's unsafe to put the pred_const on the left side of the
- * test. Also, the opfamily must contain a suitable test operator matching
- * the clause_const's type (which we take to mean that it has the same
- * subtype as the original clause_operator).
+ * implication can't be determined. Also, the opfamily must contain a
+ * suitable test operator taking the pred_const and clause_const datatypes.
*
* If there are multiple matching opfamilies, assume we can use any one to
* determine the logical relationship of the two operators and the correct
@@ -1321,12 +1314,9 @@ btree_predicate_proof(Expr *predicate, Node *clause, bool refute_it)
Form_pg_amop pred_form = (Form_pg_amop) GETSTRUCT(pred_tuple);
HeapTuple clause_tuple;
- /* must be btree */
+ /* Must be btree */
if (pred_form->amopmethod != BTREE_AM_OID)
continue;
- /* predicate operator must be default within this opfamily */
- if (pred_form->amoplefttype != pred_form->amoprighttype)
- continue;
/* Get the predicate operator's btree strategy number */
opfamily_id = pred_form->amopfamily;