Re: DOMAINs and CASTs - Mailing list pgsql-hackers

From Jaime Casanova
Subject Re: DOMAINs and CASTs
Date
Msg-id BANLkTik46G=KRKgdVYru+VxZaViC0cZacQ@mail.gmail.com
Whole thread Raw
In response to Re: DOMAINs and CASTs  (Darren Duncan <darren@darrenduncan.net>)
Responses Re: DOMAINs and CASTs  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
On Sun, May 15, 2011 at 2:13 AM, Darren Duncan <darren@darrenduncan.net> wrote:
>
>  ('1800-01-01 00:00:00'::timestamp)::int
>
> Now, since all values of a DOMAIN are also values of the base type the
> DOMAIN is defined as being a subset of, then the sub-expression within the
> parenthesis denotes a value that is both a timestamp and a datetime at the
> same time.
>
> So, if a generic "CAST(timestamp as int)" is already defined, and you define
> a "CAST(datetime as int)", then what should the above code (correct for
> misspelling) do, or should it fail?
>

Obviously it should run the cast from timestamp to int, why it will
run a cast from a domain?
the other way should be allowed, though... a cast from datetime to int
should first look for cast function using the domain and if it don't
find it then with base type

--
Jaime Casanova         www.2ndQuadrant.com
Professional PostgreSQL: Soporte y capacitación de PostgreSQL


pgsql-hackers by date:

Previous
From: Darren Duncan
Date:
Subject: Re: DOMAINs and CASTs
Next
From: Robert Haas
Date:
Subject: Re: Reducing overhead of frequent table locks