Skip site navigation (1) Skip section navigation (2)

Re: Distinct types

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: pgsql-hackers(at)postgresql(dot)org, "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov>
Subject: Re: Distinct types
Date: 2008-11-01 20:38:06
Message-ID: 17750.1225571886@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-hackers
Peter Eisentraut <peter_e(at)gmx(dot)net> writes:
> On Friday 31 October 2008 17:01:05 Kevin Grittner wrote:
>> (1)  Can you compare a literal of the base type?

> No, unless you create additional casts or operators.

>> (2)  Can you explicitly cast to the base type?

> There is an implicit AS ASSIGNMENT cast between the base type and the distinct 
> type in each direction.

Hmm ... so out-of-the-box, a distinct type would have no applicable
functions/operators whatsoever.  You couldn't even create an index on
it.  This seems a bit too impoverished to be useful.  And given the
known gotchas with creating functions/operators on domains, I'm not
convinced someone could fix the problem by creating specialized
functions for their distinct type.  Even if they could fix it,
having to set up a custom btree opclass in order to have an index
seems to take this out of the "easy to use" category.

			regards, tom lane

In response to

Responses

pgsql-hackers by date

Next:From: Vladimir SitnikovDate: 2008-11-01 20:43:40
Subject: Re: contrib/pg_stat_statements v2
Previous:From: Peter EisentrautDate: 2008-11-01 20:22:00
Subject: Re: Distinct types

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group