Re: Unsigned int functions

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Adriaan Joubert <a(dot)joubert(at)albourne(dot)com>
Cc: Postgresql <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Unsigned int functions
Date: 2001-03-29 19:51:40
Message-ID: 23707.985895500@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Adriaan Joubert <a(dot)joubert(at)albourne(dot)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 as
uint4_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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alfred Perlstein 2001-03-29 19:57:30 Re: [ADMIN] Re: Re: [PORTS] pgmonitor and Solaris
Previous Message Adriaan Joubert 2001-03-29 19:16:09 Unsigned int functions