Re: Unsigned int functions - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Unsigned int functions
Date
Msg-id 23707.985895500@sss.pgh.pa.us
Whole thread Raw
In response to Unsigned int functions  (Adriaan Joubert <a.joubert@albourne.com>)
Responses Re: Unsigned int functions  (Bruce Momjian <pgman@candle.pha.pa.us>)
List pgsql-hackers
Adriaan Joubert <a.joubert@albourne.com> writes:
> Question is: should I add these functions? Are we looking at too much
> bloat, i.e. should I replace the (uint2,uint4) combinations with
> (int4,uint2) and (int4,uint4)? Lots of combinations are possible, but I
> do not have a good feel for the trade-offs. 

My guess is that we ought to avoid bloating the system with
cross-datatype functions.  I know there are some already for int2*int4
and so forth, but I'd like to see those go away in favor of a smarter
type promotion scheme --- ie, the parser should be able to figure out
that it ought to do int2_var * uint4_var asuint4_mul(uint4(int2_var), uint4_var)
A cross-datatype function ought to exist only if it can usefully do
something different from an implicit promotion.

Aside from bloating the system, providing a plethora of functions also
tends to confuse the ambiguous-function-call resolution mechanism.
See discussion of a few days ago wherein the parser could resolve an
ambiguous situation involving varchar, but could not resolve the same
situation with text, because there are too many possibilities for
coercion of text to something else.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Adriaan Joubert
Date:
Subject: Unsigned int functions
Next
From: Bruce Momjian
Date:
Subject: Re: Unsigned int functions