On May 24, 2011, at 10:11 AM, Tom Lane wrote:

> regression=# select negate(42::pos);
> ERROR:  return type mismatch in function declared to return pos
> DETAIL:  Actual return type is integer.
> CONTEXT:  SQL function "negate" during inlining
> 
> If we smashed to base type then this issue would go away.

+1

> On the other hand it feels like we'd be taking yet another step away
> from allowing domains to be usefully used in function declarations.
> I can't put my finger on any concrete consequence of that sort, since
> what we're talking about here is ANYELEMENT/ANYARRAY functions not
> functions declared to take domains --- but it sure seems like this
> would put domains even further away from the status of first-class
> citizenship in the type system.

I agree. It sure seems to me like DOMAINs should act exactly like any other 
type. I know that has improved over time, and superficially at least, the above 
will make it seem like more like than it does with the error. But maybe it's 
time to re-think how domains are implemented? (Not for 9.1, mind.) I mean, why 
*don't* they act like first class types?

Best,

David


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to