Received: from sd.tpf.co.jp (sd.tpf.co.jp [210.161.239.34]) by hub.org (8.9.3/8.9.3) with ESMTP id LAA95247; Thu, 27 Jan 2000 11:30:14 -0500 (EST) (envelope-from Inoue@tpf.co.jp) Received: from mcadnote1 (ppm108.noc.fukui.nsk.ne.jp [210.161.188.27]) by sd.tpf.co.jp (2.5 Build 2640 (Berkeley 8.8.6)/8.8.4) with SMTP id BAA07817; Fri, 28 Jan 2000 01:29:59 +0900 From: "Hiroshi Inoue" To: "Nicolas Huillard" Cc: , Subject: RE: [GENERAL] Problem with SELECT on large negative INT4 Date: Fri, 28 Jan 2000 01:30:57 +0900 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0) Importance: Normal In-Reply-To: <01BF68CB.9C1C3F90@agen.int.ghs> X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 > -----Original Message----- > From: owner-pgsql-general@postgresql.org > [mailto:owner-pgsql-general@postgresql.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