Skip to content

Commit c99ddfc

Browse files
committed
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...
1 parent 91868e7 commit c99ddfc

File tree

1 file changed

+5
-15
lines changed

1 file changed

+5
-15
lines changed

src/backend/optimizer/util/predtest.c

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*
1010
*
1111
* IDENTIFICATION
12-
* $PostgreSQL: pgsql/src/backend/optimizer/util/predtest.c,v 1.11 2006/12/23 00:43:11 tgl Exp $
12+
* $PostgreSQL: pgsql/src/backend/optimizer/util/predtest.c,v 1.12 2006/12/28 19:53:05 tgl Exp $
1313
*
1414
*-------------------------------------------------------------------------
1515
*/
@@ -1131,7 +1131,7 @@ static const StrategyNumber BT_refute_table[6][6] = {
11311131
};
11321132

11331133

1134-
/*----------
1134+
/*
11351135
* btree_predicate_proof
11361136
* Does the predicate implication or refutation test for a "simple clause"
11371137
* predicate and a "simple clause" restriction, when both are simple
@@ -1152,7 +1152,6 @@ static const StrategyNumber BT_refute_table[6][6] = {
11521152
* the operators are too. As of 8.0 it's possible for opfamilies to contain
11531153
* operators that are merely stable, and we dare not make deductions with
11541154
* these.)
1155-
*----------
11561155
*/
11571156
static bool
11581157
btree_predicate_proof(Expr *predicate, Node *clause, bool refute_it)
@@ -1274,15 +1273,9 @@ btree_predicate_proof(Expr *predicate, Node *clause, bool refute_it)
12741273
/*
12751274
* Try to find a btree opfamily containing the needed operators.
12761275
*
1277-
* XXX this needs work!!!!!!!!!!!!!!!!!!!!!!!
1278-
*
12791276
* We must find a btree opfamily that contains both operators, else the
1280-
* implication can't be determined. Also, the pred_op has to be of
1281-
* default subtype (implying left and right input datatypes are the same);
1282-
* otherwise it's unsafe to put the pred_const on the left side of the
1283-
* test. Also, the opfamily must contain a suitable test operator matching
1284-
* the clause_const's type (which we take to mean that it has the same
1285-
* subtype as the original clause_operator).
1277+
* implication can't be determined. Also, the opfamily must contain a
1278+
* suitable test operator taking the pred_const and clause_const datatypes.
12861279
*
12871280
* If there are multiple matching opfamilies, assume we can use any one to
12881281
* 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)
13211314
Form_pg_amop pred_form = (Form_pg_amop) GETSTRUCT(pred_tuple);
13221315
HeapTuple clause_tuple;
13231316

1324-
/* must be btree */
1317+
/* Must be btree */
13251318
if (pred_form->amopmethod != BTREE_AM_OID)
13261319
continue;
1327-
/* predicate operator must be default within this opfamily */
1328-
if (pred_form->amoplefttype != pred_form->amoprighttype)
1329-
continue;
13301320

13311321
/* Get the predicate operator's btree strategy number */
13321322
opfamily_id = pred_form->amopfamily;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy