Sunday, September 7, 2008

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

"Jaime Casanova" <> writes:
> On Sun, Sep 7, 2008 at 2:41 AM, Tom Lane <> 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

Sent via pgsql-patches mailing list (
To make changes to your subscription:

No comments: