Re: Support functions for range types

Поиск
Список
Период
Сортировка
От Kim Johan Andersson
Тема Re: Support functions for range types
Дата
Msg-id 313e94ac-1c29-6a61-f09b-1389af012306@kimmet.dk
обсуждение исходный текст
Ответ на Re: Support functions for range types  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Support functions for range types  (Laurenz Albe <laurenz.albe@cybertec.at>)
Список pgsql-general
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



В списке pgsql-general по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Support functions for range types
Следующее
От: Laurenz Albe
Дата:
Сообщение: Re: Support functions for range types