From: 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: [SQL] RE: [GENERAL] Problem with SELECT on large negative INT4
Date: Fri, 28 Jan 2000 22:41:43 +0100
Message-ID: <01BF69E0.DA513890@agen.int.ghs> (raw)
Thank to everybody, I recompiled Postgres and tested it on the same DB : the offending SELECT worked, without any index regeneration. Maybe the order in which the items where inserted in the table (using COPY, before creating the index) made it working.
I only had problems with the source RPMs : I installed it (6.5.2), added a patch file for this, recompiled, but wasn't able to get brand new RPM package for installing on my other machines...
What I did for testing my compilation with the fresh "postgres" binary, is installing it in /usr/bin, in place of the other one. Is it the only think to do, or will there be side effects if I don't install more binaries ?
Maybe Lamar Owen could help me getting a fresh patched RPM ?
Nicolas Huillard
-----Message d'origine-----
De: Tom Lane [SMTP:tgl@sss.pgh.pa.us]
Date: vendredi 28 janvier 2000 05:49
À: John Brothers
Cc: pgsql-general@hub.org; pgsql-sql@hub.org
Objet: Re: [SQL] RE: [GENERAL] Problem with SELECT on large negative INT4
John Brothers <johnbr@mindspring.com> writes:
> I don't think that patch will work - Hiroshi whipped up that patch for
> me a week ago for a different problem - we have a table with duplicate
> primary keys, which seems to be an arithmetic overflow problem because
> the index key values can be both very large positive and very large
> negative numbers.
Actually, if Nicolas' table contains both very large positive and very
large negative integers, then his index could be messed up pretty badly.
What Hiroshi saw (and I missed :-() was that btint4cmp can fail and
return a result of the wrong sign if the difference between two integers
overflows. Since index sorting depends critically on the assumption
that the comparator always returns consistent results (a < b and b < c
must imply a < c, but this can fail if a - c overflows), you could have
an out-of-order index. And then probes into the index could fail to
find items they should find ... which is exactly the complained-of
symptom.
Hiroshi neglected to mention that you'd probably need to drop and
recreate the index after applying the patch; if it's indeed out of
order, just patching the comparator bug isn't enough to fix it.
regards, tom lane
************
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: nhuillard@ghs.fr, pgsql-general@hub.org, pgsql-sql@hub.org
Subject: Re: [SQL] RE: [GENERAL] Problem with SELECT on large negative INT4
In-Reply-To: <01BF69E0.DA513890@agen.int.ghs>
References: <01BF69E0.DA513890@agen.int.ghs>
* 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