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

Problem with SELECT on large negative INT4

From: Nicolas Huillard <nhuillard(at)ghs(dot)fr>
To: "'pgsql-general(at)hub(dot)org'" <pgsql-general(at)hub(dot)org>, "'pgsql-sql(at)hub(dot)org'" <pgsql-sql(at)hub(dot)org>
Subject: Problem with SELECT on large negative INT4
Date: 2000-01-27 12:37:08
Message-ID: 01BF68CB.9C1C3F90@agen.int.ghs (view raw or flat)
Thread:
Lists: pgsql-generalpgsql-hackerspgsql-sql
I have a DB with is updated using MS Access. Primary keys are Int4 with default random values ("NuméroAuto" + "Aléatoire" in Access).
The DB is migrated as-is in Postgres, with tbl_prod.cle_prod field containing values from -2057496808 to 2139583719.
When I SELECT in the table, using the INT4 cle_prod value, PG doesn't find the tuple. When I SELECT using the VARCHAR(10) ref_prod value, PG finds the tuple, and show the right value for the cle_prod filed : the same as the one I SELECTed for...

This sounds like the long negative integer values given in PSQL is not converted correctly while executing.
Using a long positive integer value, all works like a charm...

Below is the queries type sto sho what append.
I'm using Postgres 6.5.2 from the RPMs.

Nicolas Huillard




gest=> select cle_prod, ref_prod from tbl_prod where ref_prod='4866VC';
   cle_prod|ref_prod
-----------+--------
-2057496808|4866VC  
(1 row)

gest=> select cle_prod, ref_prod from tbl_prod where cle_prod = -2057496808;
cle_prod|ref_prod
--------+--------
(0 rows)

gest=> \d tbl_prod
Table    = tbl_prod
+----------------------------------+----------------------------------+-------+
|              Field               |              Type                | Length|
+----------------------------------+----------------------------------+-------+
| cle_prod                         | int4 not null default nextval('" |     4 |
| ref_prod                         | varchar() not null               |    10 |
...
+----------------------------------+----------------------------------+-------+
Index:    tbl_prod_pkey

gest=> select version();
version                                                       
--------------------------------------------------------------
PostgreSQL 6.5.2 on i486-pc-linux-gnu, compiled by gcc 2.7.2.3
(1 row)

gest=> 


Responses

pgsql-hackers by date

Next:From: Peter EisentrautDate: 2000-01-27 12:50:00
Subject: Re: ORDBMS
Previous:From: Michael MeskesDate: 2000-01-27 12:19:30
Subject: Re: [HACKERS] CVS problem

pgsql-sql by date

Next:From: Don BaccusDate: 2000-01-27 16:23:32
Subject: Re: [HACKERS] Ars Digita and PostgreSQL
Previous:From: Chris BitmeadDate: 2000-01-27 05:41:01
Subject: Ars Digita and PostgreSQL

pgsql-general by date

Next:From: Sarah OfficerDate: 2000-01-27 16:02:02
Subject: Re: [ADMIN] ugly name clash
Previous:From: Nicolas HuillardDate: 2000-01-27 11:39:00
Subject: Problem with search on INT4

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