Re: DOMAINs and CASTs

From: "Gelman" <igny03(at)verizon(dot)net>
To: <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: DOMAINs and CASTs
Date: 2011-05-15 01:56:05
Message-ID: 0177D96950FE45E6B6C325D3A67E91E1@Igel01
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


----- Original Message -----
From: "Darren Duncan" <darren(at)darrenduncan(dot)net>
To: "Jaime Casanova" <jaime(at)2ndquadrant(dot)com>
Cc: "PostgreSQL-development" <pgsql-hackers(at)postgresql(dot)org>
Sent: Saturday, May 14, 2011 9:46 PM
Subject: Re: [HACKERS] DOMAINs and CASTs

> Darren Duncan wrote:
>> I think it would be best that the generic cast syntax only be useable for
>> casts defined on the base type, and if you want a domain-specific one you
>> should use the function syntax such as your datetime2int().
>>
>> That way it is easier for users to predict what behavior will occur, and
>> implementation will be easier too.
>
> Replying to myself, I offer another alternative:
>
> What you ask for is indeed supported, but that if for a given input value
> more than one cast applies to it, particularly for 2 overlapping domains,
> then which cast is invoked is undefined, so for example the DBMS may just
> use the first one it finds.
>
> It is then up to the user to ensure that when they define casts over
> domains that they just define ones that either produce the same outputs
> for the same overlapping inputs (the best answer) or they ensure that they
> don't overlap in their input domains.
>
> -- Darren Duncan
>
> --
> Sent via pgsql-hackers mailing list (pgsql-hackers(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-hackers

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Gelman 2011-05-15 01:56:17 Fw: DOMAINs and CASTs
Previous Message Darren Duncan 2011-05-15 01:46:58 Re: DOMAINs and CASTs