Re: Support functions for range types

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Support functions for range types
Дата
Msg-id 2714336.1664117031@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Support functions for range types  (Kim Johan Andersson <kimjand@kimmet.dk>)
Ответы Re: Support functions for range types  (Kim Johan Andersson <kimjand@kimmet.dk>)
Список pgsql-general
Kim Johan Andersson <kimjand@kimmet.dk> 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 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 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.

            regards, tom lane



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

Предыдущее
От: Kim Johan Andersson
Дата:
Сообщение: Support functions for range types
Следующее
От: Kim Johan Andersson
Дата:
Сообщение: Re: Support functions for range types