Re: Unsigned int functions - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: Unsigned int functions
Date
Msg-id 200103292003.PAA00501@candle.pha.pa.us
Whole thread Raw
In response to Re: Unsigned int functions  (Tom Lane <tgl@sss.pgh.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 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.

A larger question is whether unsigned types really add much to the
system vs. the bloat.  We already have unsigned int4 as oid.  Also,
unsigned doubles the space of the type, but if a value doesn't fit in
32k, what are the odds it will fit in 64k.  I am not sure unsigned
optimzations for space really are significant in SQL.

--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
853-3000+  If your life is a hard drive,     |  830 Blythe Avenue +  Christ can be your backup.        |  Drexel Hill,
Pennsylvania19026
 


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Unsigned int functions
Next
From: Alfred Perlstein
Date:
Subject: Re: [ADMIN] Re: Re: [PORTS] pgmonitor and Solaris