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

From: "Ryan Bradetich" <rbradetich(at)gmail(dot)com>
To: "Jaime Casanova" <jcasanov(at)systemguards(dot)com(dot)ec>
Cc: pgsql-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: [PgFoundry] Unsigned Data Types [1 of 2]
Date: 2008-09-09 03:08:12
Message-ID: e739902b0809082008p6c694a20ufd526d1ce5d46750@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Jaime Casanova 2008-09-09 05:54:23 Re: [PgFoundry] Unsigned Data Types [1 of 2]
Previous Message David Rowley 2008-09-08 19:19:35 Re: [HACKERS] TODO item: Implement Boyer-Moore searching (First time hacker)