Search Postgresql Archives

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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Daniel Popowich <dpopowich@xxxxxxxxxxxxxxx> 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





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux