aboutsummaryrefslogtreecommitdiff
path: root/src/backend/parser/parse_expr.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2011-07-06 14:53:16 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2011-07-06 14:53:42 -0400
commitcb1cc305bc349338f75a549c36041b4c91cf779f (patch)
treef0bcbdd58dd7d7d77ed856e970f4cb9a78cfc922 /src/backend/parser/parse_expr.c
parentf8bd267d35503109255c99eae96c86ba8ba1b56f (diff)
downloadpostgresql-cb1cc305bc349338f75a549c36041b4c91cf779f.tar.gz
postgresql-cb1cc305bc349338f75a549c36041b4c91cf779f.zip
Remove assumptions that not-equals operators cannot be in any opclass.
get_op_btree_interpretation assumed this in order to save some duplication of code, but it's not true in general anymore because we added <> support to btree_gist. (We still assume it for btree opclasses, though.) Also, essentially the same logic was baked into predtest.c. Get rid of that duplication by generalizing get_op_btree_interpretation so that it can be used by predtest.c. Per bug report from Denis de Bernardy and investigation by Jeff Davis, though I didn't use Jeff's patch exactly as-is. Back-patch to 9.1; we do not support this usage before that.
Diffstat (limited to 'src/backend/parser/parse_expr.c')
-rw-r--r--src/backend/parser/parse_expr.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/backend/parser/parse_expr.c b/src/backend/parser/parse_expr.c
index 08f0439e7ed..65d03adc494 100644
--- a/src/backend/parser/parse_expr.c
+++ b/src/backend/parser/parse_expr.c
@@ -2170,8 +2170,7 @@ make_row_comparison_op(ParseState *pstate, List *opname,
List *opfamilies;
ListCell *l,
*r;
- List **opfamily_lists;
- List **opstrat_lists;
+ List **opinfo_lists;
Bitmapset *strats;
int nopers;
int i;
@@ -2241,8 +2240,7 @@ make_row_comparison_op(ParseState *pstate, List *opname,
* containing the operators, and see which interpretations (strategy
* numbers) exist for each operator.
*/
- opfamily_lists = (List **) palloc(nopers * sizeof(List *));
- opstrat_lists = (List **) palloc(nopers * sizeof(List *));
+ opinfo_lists = (List **) palloc(nopers * sizeof(List *));
strats = NULL;
i = 0;
foreach(l, opexprs)
@@ -2251,17 +2249,18 @@ make_row_comparison_op(ParseState *pstate, List *opname,
Bitmapset *this_strats;
ListCell *j;
- get_op_btree_interpretation(opno,
- &opfamily_lists[i], &opstrat_lists[i]);
+ opinfo_lists[i] = get_op_btree_interpretation(opno);
/*
- * convert strategy number list to a Bitmapset to make the
+ * convert strategy numbers into a Bitmapset to make the
* intersection calculation easy.
*/
this_strats = NULL;
- foreach(j, opstrat_lists[i])
+ foreach(j, opinfo_lists[i])
{
- this_strats = bms_add_member(this_strats, lfirst_int(j));
+ OpBtreeInterpretation *opinfo = lfirst(j);
+
+ this_strats = bms_add_member(this_strats, opinfo->strategy);
}
if (i == 0)
strats = this_strats;
@@ -2309,14 +2308,15 @@ make_row_comparison_op(ParseState *pstate, List *opname,
for (i = 0; i < nopers; i++)
{
Oid opfamily = InvalidOid;
+ ListCell *j;
- forboth(l, opfamily_lists[i], r, opstrat_lists[i])
+ foreach(j, opinfo_lists[i])
{
- int opstrat = lfirst_int(r);
+ OpBtreeInterpretation *opinfo = lfirst(j);
- if (opstrat == rctype)
+ if (opinfo->strategy == rctype)
{
- opfamily = lfirst_oid(l);
+ opfamily = opinfo->opfamily_id;
break;
}
}