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

From Ryan Bradetich
Subject Re: [PgFoundry] Unsigned Data Types [1 of 2]
Date
Msg-id e739902b0809082008p6c694a20ufd526d1ce5d46750@mail.gmail.com
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]  ("Jaime Casanova" <jcasanov@systemguards.com.ec>)
List pgsql-patches
Hello Jaime,

> why i need the cast in this case? even if the cast is really necesary
> (the message seems realy ugly)
>
> contrib_regression=# select * from t1 where f1 > 35;
> ERROR:  unsupported type: 16486
>
> contrib_regression=# select * from t1 where f1 > 35::uint4;
>  f1
> -----
>  36
>  37
>  38

Can you send me the test case that generates this error?
My regression tests do not include a table t1 so I was not able
to reproduce this error directly.

I was unable to reproduce this error by guessing.
I tried the following tests:

contrib_regression=# create table t1 (f1 int4 not null);
CREATE TABLE
contrib_regression=# insert into t1 values (1), (5), (10), (20);
INSERT 0 4
contrib_regression=# select * from t1 where f1 > 7;
 f1
----
 10
 20
(2 rows)

contrib_regression=# drop table t1;
DROP TABLE
contrib_regression=# create table t1 (f1 uint4 not null);
CREATE TABLE
contrib_regression=# insert into t1 values (1), (5), (10), (20);
INSERT 0 4
contrib_regression=# select * from t1 where f1 > 7;
 f1
----
 10
 20
(2 rows)

contrib_regression=# drop table t1;
DROP TABLE
contrib_regression=# create table t1 (f1 numeric not null);
CREATE TABLE
contrib_regression=# insert into t1 values (1), (5), (10), (20);
INSERT 0 4
contrib_regression=# select * from t1 where f1 > 7;
 f1
----
 10
 20
(2 rows)

contrib_regression=# drop table t1;
DROP TABLE
contrib_regression=# create table t1 (f1 int4 primary key);
NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index
"t1_pkey" for table "t1"
CREATE TABLE
contrib_regression=# insert into t1 select * from generate_series(1, 100000);
INSERT 0 100000
contrib_regression=# analyze t1;
ANALYZE
contrib_regression=# explain select f1 from t1 where f1 > 99998;
                            QUERY PLAN
-------------------------------------------------------------------
 Index Scan using t1_pkey on t1  (cost=0.00..8.43 rows=10 width=4)
   Index Cond: (f1 > 99998)
(2 rows)

contrib_regression=# select f1 from t1 where f1 > 99998;
   f1
--------
  99999
 100000
(2 rows)


My testing shows this is working correctly.  I am very interested in
your test case
to help me figure out what I am missing!

Thanks!

- Ryan

pgsql-patches by date:

Previous
From: "David Rowley"
Date:
Subject: Re: [HACKERS] TODO item: Implement Boyer-Moore searching (First time hacker)
Next
From: "Jaime Casanova"
Date:
Subject: Re: [PgFoundry] Unsigned Data Types [1 of 2]