Re: Like vs '=' bug with indexing - Mailing list pgsql-hackers

From m w
Subject Re: Like vs '=' bug with indexing
Date
Msg-id 20010203221601.55463.qmail@web12406.mail.yahoo.com
Whole thread Raw
In response to Re: Like vs '=' bug with indexing  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Like vs '=' bug with indexing  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
--- Tom Lane <tgl@sss.pgh.pa.us> wrote:
> m w <mttf2000@yahoo.com> writes:
> > Here is the problem: Depending on whether there is
> an
> > index or not, 'like' behaves differently.
> 
> Please provide a complete, self-contained example
> with which
> we can reproduce the problem.

I am trying to create a test function and some data
that reproduces the problem easily, but I think I know
what it is.

It is a two bug issue. I had a bug in my code in that
I added the "\0" to the end of my strings when I
converted from a C string to a postgres "text" object.


I think this exposes a bug in postgres where either
index or table scans (I'm not sure which just yet)
treat a zero differently than a non-zero in a varchar.

It looks as if some section of code is using the zero
to terminate a string and another section of code is
not. So at some point data which should be the same
differes either on length of data, or the trailing
zero compared to an uninitialized byte.

Removing the terminating zero from the postgres string
fixes the problem, but, if I understand postgres well
enough, this should not make a difference, and should
be reported as a bug anyway.


__________________________________________________
Get personalized email addresses from Yahoo! Mail - only $35 
a year!  http://personal.mail.yahoo.com/


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: 7.1 beta 3 CHANGES FOR QNX
Next
From: Tom Lane
Date:
Subject: Re: Like vs '=' bug with indexing