Skip to content

Commit 1dad2a5

Browse files
committed
Fix order of parameters in BRIN minmax-multi calls
The BRIN minmax-multi consistent function incorrectly assumed it can lookup an operator, and then swap the arguments to get the commutator. For example <(a,b) would be called as <(b,a) to get >(a,b). This works when the arguments are of the same type, but with cross-type opclasses this fails. We can't swap <(float4,float8) arguments, for example. Fixed by passing arguments in the right order. Discussion: https://postgr.es/m/CAJKUy5jLZFLCxyxfT%3DMfK5mtPfSzHA1rVLowR-j4RRsFVvKm7A%40mail.gmail.com
1 parent e1fbe11 commit 1dad2a5

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/backend/access/brin/brin_minmax_multi.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2606,16 +2606,16 @@ brin_minmax_multi_consistent(PG_FUNCTION_ARGS)
26062606
* value in the array.
26072607
*/
26082608
cmpFn = minmax_multi_get_strategy_procinfo(bdesc, attno, subtype,
2609-
BTLessStrategyNumber);
2610-
compar = FunctionCall2Coll(cmpFn, colloid, value, minval);
2609+
BTGreaterStrategyNumber);
2610+
compar = FunctionCall2Coll(cmpFn, colloid, minval, value);
26112611

26122612
/* smaller than the smallest value in this range */
26132613
if (DatumGetBool(compar))
26142614
break;
26152615

26162616
cmpFn = minmax_multi_get_strategy_procinfo(bdesc, attno, subtype,
2617-
BTGreaterStrategyNumber);
2618-
compar = FunctionCall2Coll(cmpFn, colloid, value, maxval);
2617+
BTLessStrategyNumber);
2618+
compar = FunctionCall2Coll(cmpFn, colloid, maxval, value);
26192619

26202620
/* larger than the largest value in this range */
26212621
if (DatumGetBool(compar))

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