Skip site navigation (1) Skip section navigation (2)

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

From: "Jaime Casanova" <jcasanov(at)systemguards(dot)com(dot)ec>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
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 14:13:39
Message-ID: 3073cc9b0809070713s1df16d8dlb3be457b3584ba5c@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-patches
On Sun, Sep 7, 2008 at 2:41 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> "Jaime Casanova" <jcasanov(at)systemguards(dot)com(dot)ec> writes:
>> contrib_regression=# select * from t1 where f1 > 35;
>> ERROR:  unsupported type: 16486
>
> 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. don't know what to suggest here? a
column in pg_type that identifies it? a hook?

    switch (typid)
    {
        case BOOLOID:
            return (double) DatumGetBool(value);
        case INT2OID:
            return (double) DatumGetInt16(value);
        case INT4OID:
            return (double) DatumGetInt32(value);
        case INT8OID:
            return (double) DatumGetInt64(value);
        case FLOAT4OID:
            return (double) DatumGetFloat4(value);
        case FLOAT8OID:
            return (double) DatumGetFloat8(value);
        case NUMERICOID:
            /* Note: out-of-range values will be clamped to +-HUGE_VAL */
            return (double)
                DatumGetFloat8(DirectFunctionCall1(numeric_float8_no_overflow,
                                                   value));
        case OIDOID:
        case REGPROCOID:
        case REGPROCEDUREOID:
        case REGOPEROID:
        case REGOPERATOROID:
        case REGCLASSOID:
        case REGTYPEOID:
        case REGCONFIGOID:
        case REGDICTIONARYOID:
            /* we can treat OIDs as integers... */
            return (double) DatumGetObjectId(value);
    }

    /*
     * Can't get here unless someone tries to use scalarltsel/scalargtsel on
     * an operator with one numeric and one non-numeric operand.
     */
    elog(ERROR, "unsupported type: %u", typid);
    return 0;



-- 
Atentamente,
Jaime Casanova
Soporte y capacitación de PostgreSQL
Asesoría y desarrollo de sistemas
Guayaquil - Ecuador
Cel. (593) 87171157

In response to

Responses

pgsql-patches by date

Next:From: Tom LaneDate: 2008-09-07 16:07:18
Subject: Re: [PgFoundry] Unsigned Data Types [1 of 2]
Previous:From: David RowleyDate: 2008-09-07 11:04:35
Subject: Re: [PATCHES] TODO item: Implement Boyer-Moore searching (First time hacker)

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group