Re: Domains versus polymorphic functions, redux - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: Domains versus polymorphic functions, redux
Date
Msg-id 1307366035.20678.10.camel@fsopti579.F-Secure.com
Whole thread Raw
In response to Re: Domains versus polymorphic functions, redux  ("Kevin Grittner" <Kevin.Grittner@wicourts.gov>)
Responses Re: Domains versus polymorphic functions, redux
List 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 by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: [PATCH] Bug in XPATH() if expression returns a scalar value
Next
From: Robert Haas
Date:
Subject: Re: reducing the overhead of frequent table locks - now, with WIP patch