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" would
> give the wrong answers. And generally speaking, if the argument
> isn't a constant then you're not going to be able to be sure that
> it doesn't produce NULL.
I was suspecting that it would not be possible. So we can peek at the
constructor parameters, but we won't know the actual value until execution.
> I guess you could produce something like
>
> indxvar >= coalesce(argument, minimum-value-of-type)
>
> in cases where the data type has an identifiable minimum resp.
> maximum value, but that'd make the whole affair annoyingly
> data-type-specific. Not sure it's worth going there.
>
I was hoping it was possible to rely on the existing range mechanics for
handling the data types. Along the lines of adding nodes dependent on
the result of the constructor call.
But if there is no opportunity to make a dynamic expression suitable for
the index, then I guess it won't be possible to make a really useful
support function for range types.
Thanks for the input.
Regards,
Kim Johan Andersson