Re: [PgFoundry] Unsigned Data Types [1 of 2] - Mailing list pgsql-patches

From Tom Lane
Subject Re: [PgFoundry] Unsigned Data Types [1 of 2]
Date
Msg-id 14575.1220803638@sss.pgh.pa.us
Whole thread Raw
In response to Re: [PgFoundry] Unsigned Data Types [1 of 2]  ("Jaime Casanova" <jcasanov@systemguards.com.ec>)
Responses Re: [PgFoundry] Unsigned Data Types [1 of 2]  ("Ryan Bradetich" <rbradetich@gmail.com>)
List pgsql-patches
"Jaime Casanova" <jcasanov@systemguards.com.ec> writes:
> On Sun, Sep 7, 2008 at 2:41 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> That obviously isn't supposed to happen.  Where's it coming from
>> exactly?

> convert_numeric_to_scalar() in src/backend/utils/adt/selfuncs.c

> the problem seems to be that we are asking for each type of numeric
> and of course that doesn't know nothing about unsigned integers so its
> treating it as a non-numeric.

Ah.  The scalarltsel/scalargtsel stuff has always been a bit bogus for
cross-type comparisons; it assumes it will know both or neither of the
two datatypes.  So you can get away with using those functions for
uint > uint (although they won't be very bright about it); but using
them for uint > int fails outright.

If you read the comments around that stuff it leaves quite a lot to be
desired, but I don't really have better ideas at the moment.  The best
near-term solution for the uint module is probably not to rely on
scalarltsel/scalargtsel for uint comparisons, but to make its own
selectivity functions that know the uint types plus whatever standard
types you want to have comparisons with.

            regards, tom lane

pgsql-patches by date:

Previous
From: "Jaime Casanova"
Date:
Subject: Re: [PgFoundry] Unsigned Data Types [1 of 2]
Next
From: "Ryan Bradetich"
Date:
Subject: Re: [PgFoundry] Unsigned Data Types [1 of 2]