RE: [GENERAL] Problem with SELECT on large negative INT4

From: "Hiroshi Inoue" <Inoue(at)tpf(dot)co(dot)jp>
To: "Nicolas Huillard" <nhuillard(at)ghs(dot)fr>
Cc: <pgsql-general(at)hub(dot)org>, <pgsql-sql(at)hub(dot)org>
Subject: RE: [GENERAL] Problem with SELECT on large negative INT4
Date: 2000-01-27 16:30:57
Message-ID: NDBBIJLOILGIKBGDINDFAEGLCCAA.Inoue@tpf.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers pgsql-sql

> -----Original Message-----
> From: owner-pgsql-general(at)postgresql(dot)org
> [mailto:owner-pgsql-general(at)postgresql(dot)org]On Behalf Of Nicolas Huillard
>
> 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.
>

Could you try the follwoing patch ?

Regards.

Hiroshi Inoue

*** nbtcompare.c 2000/01/11 03:33:34 1.3
--- nbtcompare.c 2000/01/19 05:42:06
***************
*** 34,40 ****
int32
btint4cmp(int32 a, int32 b)
{
! return a - b;
}

int32
--- 34,45 ----
int32
btint4cmp(int32 a, int32 b)
{
! if (a > b)
! return 1;
! else if (a == b)
! return 0;
! else
! return -1;
}

int32

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Bruce Bantos 2000-01-27 16:35:02 backup/maintenance scripts?
Previous Message Kaj-Michael Lang 2000-01-27 16:30:06 LockReplace: xid table corrupted and LockRelease: locktable lookup failed, no lock

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2000-01-27 16:37:24 Re: [SQL] RE: [GENERAL] Problem with SELECT on large negative INT4
Previous Message Hiroshi Inoue 2000-01-27 16:30:54 RE: [HACKERS] Sure enough, SI buffer overrun is broken

Browse pgsql-sql by date

  From Date Subject
Next Message Bruce Momjian 2000-01-27 16:37:24 Re: [SQL] RE: [GENERAL] Problem with SELECT on large negative INT4
Previous Message Don Baccus 2000-01-27 16:23:32 Re: [HACKERS] Ars Digita and PostgreSQL