From: | David G Johnston <david(dot)g(dot)johnston(at)gmail(dot)com> |
---|---|
To: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: Questions on domain on composite / casts ignoring domains |
Date: | 2014-10-21 01:18:38 |
Message-ID: | 1413854318303-5823763.post@n5.nabble.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Jim Nasby-5 wrote
> I'm trying to create what amounts to a new type. This would be rather easy
> if I could perform a CHECK on a composite type, which I could do if I
> could create a domain on top of a composite. Is there any reason in
> particular that hasn't been done?
>
> As an alternative, I tried accomplishing this with a straight domain. That
> would work, except for this:
>
> WARNING: cast will be ignored because the source data type is a domain
>
> Why do we ignore casts from domains to other data types? I'm guessing
> because it's simply not what domains were meant for?
A domain is a base type with a constraint. When you cast you already know
the existing value is valid and the system simply uses the cast available
for the base type instead. i.e., You cannot have a domain with a different
cast rule than the base type over which it is defined.
Likely the lack of capability is simply a matter of complexity in the face
of somewhat uncommon usage and limited resources.
David J.
--
View this message in context: http://postgresql.1045698.n5.nabble.com/Questions-on-domain-on-composite-casts-ignoring-domains-tp5823745p5823763.html
Sent from the PostgreSQL - hackers mailing list archive at Nabble.com.
From | Date | Subject | |
---|---|---|---|
Next Message | Jim Nasby | 2014-10-21 01:26:05 | Re: Inconsistencies in documentation of row-level locking |
Previous Message | Jim Nasby | 2014-10-21 00:57:00 | Re: Trailing comma support in SELECT statements |