Improve upcasting for INT range and multi range types

Поиск
Список
Период
Сортировка
От Federico
Тема Improve upcasting for INT range and multi range types
Дата
Msg-id CAN19dyc8ey8_di+Lbsoh4et1d85Caaq2w4VTPcPNMYP-QVOsDg@mail.gmail.com
обсуждение исходный текст
Ответы Re: Improve upcasting for INT range and multi range types  (jian he <jian.universality@gmail.com>)
Список pgsql-hackers
Hi,

Postgresql seems to be missing upcasting when doing INT range and
multi-range operation, for example when checking if an int4 is inside
an int8 range.
Some non working example are the following

    SELECT 2::INT4 <@ '[1, 4)'::INT8RANGE
    -- ERROR: operator does not exist: integer <@ int8range

    SELECT 1::INT4 <@ '{[1, 4),[6,19)}'::INT8MULTIRANGE
    -- ERROR: operator does not exist: integer <@ int8multirange

    SELECT 1::INT2 <@ '{[1, 4),[6,19)}'::INT4MULTIRANGE
    -- ERROR: operator does not exist: smallint <@ int4multirange

    SELECT '[2, 3]'::INT4RANGE <@ '[1, 42)'::INT8RANGE
    -- ERROR: operator does not exist: int4range <@ int8range

    SELECT 2::INT8 <@ '[1, 4)'::INT4RANGE
    -- ERROR: operator does not exist: bigint <@ int4range

etc.

In all these cases the smaller integer type can be upcasted to the
larger integer type.

Posted here since it doesn't seem like a bug, just a missing feature.

Thanks for reading
    Federico



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

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: Proposal to add page headers to SLRU pages
Следующее
От: Jeff Davis
Дата:
Сообщение: Re: CREATE FUNCTION ... SEARCH { DEFAULT | SYSTEM | SESSION }