Re: Operators on ranges with a domain subtype do not implicitly cast operands of the domain's base type

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Operators on ranges with a domain subtype do not implicitly cast operands of the domain's base type
Дата
Msg-id 978146.1655411199@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Operators on ranges with a domain subtype do not implicitly cast operands of the domain's base type  (Daniel Popowich <dpopowich@artandlogic.com>)
Ответы Re: Operators on ranges with a domain subtype do not implicitly cast operands of the domain's base type  (Daniel Popowich <dpopowich@artandlogic.com>)
Список pgsql-general
Daniel Popowich <dpopowich@artandlogic.com> writes:
>     -- domain with underlying type of integer (what constraints we might
>     -- place on the integer values are not germane to the issue so they're
>     -- left out).
>     create domain zzzint integer;

>     -- a range on our domain
>     create type zzzrange as range (subtype = zzzint);

Why is this a good idea?

ISTM the subtype of a range type shouldn't really be a domain.
The range type depends very fundamentally on the ordering properties
of the subtype, so trying to put some abstraction in there seems a
bit misguided.  Moreover, there are a whole bunch of weird semantics
issues that arise if the domain tries to restrict the set of allowed
values.  For instance, if the domain disallows "3" (maybe it allows
only even integers) then what does a range (2,10) really mean?
Should we be expected to figure out that it's effectively [4,10)?
What pitfalls does that create for, say, multirange operators?

You could usefully make a domain over the range type and put some
restrictions at that level, perhaps.

            regards, tom lane



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

Предыдущее
От: Daniel Popowich
Дата:
Сообщение: Operators on ranges with a domain subtype do not implicitly cast operands of the domain's base type
Следующее
От: Bryn Llewellyn
Дата:
Сообщение: Re: Operators on ranges with a domain subtype do not implicitly cast operands of the domain's base type