Support functions for range types

2022-09-25 Thread Kim Johan Andersson
I was surprised by the poor performance when I first tried to use range types. What I expected was that the following two queries would be equivalent (see attached script): postgres=# EXPLAIN ANALYZE SELECT some_number FROM integer_test WHERE some_number BETWEEN -2 AND 2; QUERY PLAN

Re: Support functions for range types

2022-09-25 Thread Tom Lane
Kim Johan Andersson writes: > So my question here is, how to go about handling the more interesting > cases, where we are passed a FuncExpr (instead of a Const)? > Is it even possible to return something useful in this case? Doesn't look like it to me. You could check whether the RHS is a range

Re: Support functions for range types

2022-09-25 Thread Kim Johan Andersson
On 25-09-2022 16:43, Tom Lane wrote: Doesn't look like it to me. You could check whether the RHS is a range constructor function call, but there's a big semantic problem: int4_range(NULL, ...) converts to a range with an infinite bound, not a null bound. So translating that to "indxvar >= NULL