Re: is this a bug or I am blind? - Mailing list pgsql-general

From Greg Stark
Subject Re: is this a bug or I am blind?
Date
Msg-id 87lkymc9fg.fsf@stark.xeocode.com
Whole thread Raw
In response to Re: is this a bug or I am blind?  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: is this a bug or I am blind?
List pgsql-general
Tom Lane <tgl@sss.pgh.pa.us> writes:

> Non-self-consistent comparison results can lead to an index that is
> either actually or effectively corrupt (because index searches proceed
> down the wrong tree path and thus fail to find items that should be
> found).  So the observation that only index searches fail is consistent
> with this idea.

I wondered if there were some simple tests Postgres could do to notice the
problem and report it. Checking to make sure strcoll(a,b) = -strcoll(b,a) for
example.

But then I thought of another idea. What if Postgres just used strxfrm()
instead of strcoll everywhere? Then it ought to never produce inconsistent
results. At least if strxfrm() doesn't just return randomly varying results
for the same inputs. I suspect the worst case in practice is that strxfrm()
will return the same data for just about every input string, which would
hopefully be noticed by the user. But at least wouldn't cause corrupted
indexes.

--
greg

pgsql-general by date:

Previous
From: Michelle Konzack
Date:
Subject: Re: 7.4.5 vs 8.0 on Debian/sparc
Next
From: Tom Lane
Date:
Subject: Re: is this a bug or I am blind?