Re: Domains versus polymorphic functions, redux

Поиск
Список
Период
Сортировка
От Peter Eisentraut
Тема Re: Domains versus polymorphic functions, redux
Дата
Msg-id 1307366035.20678.10.camel@fsopti579.F-Secure.com
обсуждение исходный текст
Ответ на Re: Domains versus polymorphic functions, redux  ("Kevin Grittner" <Kevin.Grittner@wicourts.gov>)
Ответы Re: Domains versus polymorphic functions, redux  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
On fre, 2011-06-03 at 13:53 -0500, Kevin Grittner wrote:
> Another long-range nicety would be something which I have seen in
> some other databases, and which is consistent with the inheritance
> theme, is that you can't compare or assign dissimilar domains -- an
> error is thrown. So if you try to join from the eye color column in
> a person table to the key of a hair color table, you get an error
> unless you explicitly cast one or both of them to the common type. 

What you are looking for is the SQL feature called "distinct types".
The makers of the SQL standard have sort of deprecated domains in favor
of distinct types, because distinct types address your sort of use case
better, and prescribing the behavior of domains becomes weirder and
weirder as the type system becomes more complex.  Which is pretty much
the same experience we've been having over the years.



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

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: Re: [PATCH] Bug in XPATH() if expression returns a scalar value
Следующее
От: Robert Haas
Дата:
Сообщение: Re: reducing the overhead of frequent table locks - now, with WIP patch