Re: [PgFoundry] Unsigned Data Types [1 of 2]

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Jaime Casanova" <jcasanov(at)systemguards(dot)com(dot)ec>
Cc: "Ryan Bradetich" <rbradetich(at)gmail(dot)com>, pgsql-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: [PgFoundry] Unsigned Data Types [1 of 2]
Date: 2008-09-07 16:07:18
Message-ID: 14575.1220803638@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

"Jaime Casanova" <jcasanov(at)systemguards(dot)com(dot)ec> writes:
> On Sun, Sep 7, 2008 at 2:41 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)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

In response to

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Ryan Bradetich 2008-09-08 06:14:43 Re: [PgFoundry] Unsigned Data Types [1 of 2]
Previous Message Jaime Casanova 2008-09-07 14:13:39 Re: [PgFoundry] Unsigned Data Types [1 of 2]