pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: John Brothers <johnbr@mindspring.com>
To: Nicolas Huillard <nhuillard@ghs.fr>
To: 'pgsql-general@hub.org' <pgsql-general@hub.org>
To: 'pgsql-sql@hub.org' <pgsql-sql@hub.org>
Subject: Re: [GENERAL] Problem with SELECT on large negative INT4
Date: Thu, 27 Jan 2000 22:48:39 -0500
Message-ID: <4.1.20000127224614.00c96190@pop.mindspring.com> (raw)
In-Reply-To: <01BF68CB.9C1C3F90@agen.int.ghs>

We have the same problem with 64-bit integers - and it isn't just
psql - the same problem exists in jdbc.

Anyways, to fix it, we did the following:

'-11233232322233232323232321232'::int8

whenever we did any operation on the large field.

you may want to try 

'-2057496808|'::int4

in the same manner.



At 01:37 PM 1/27/00 +0100, Nicolas Huillard wrote:
>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=> 
>
>
>************

------------
johnbr@incanta.net

        



view thread (18+ messages)  latest in thread

Message-ID: <4.1.20000127224614.00c96190@pop.mindspring.com>
Permalink:  ../4.1.20000127224614.00c96190@pop.mindspring.com/
Also on:    postgresql.org/message-id/4.1.20000127224614.00c96190@pop.mindspring.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: johnbr@mindspring.com, nhuillard@ghs.fr, pgsql-general@hub.org, pgsql-sql@hub.org
  Subject: Re: [GENERAL] Problem with SELECT on large negative INT4
  In-Reply-To: <4.1.20000127224614.00c96190@pop.mindspring.com>
  References: <01BF68CB.9C1C3F90@agen.int.ghs> <4.1.20000127224614.00c96190@pop.mindspring.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox