Re: Like vs '=' bug with indexing

From: m w <mttf2000(at)yahoo(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Like vs '=' bug with indexing
Date: 2001-02-03 22:16:01
Message-ID: 20010203221601.55463.qmail@web12406.mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


--- Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> m w <mttf2000(at)yahoo(dot)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/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2001-02-03 22:27:49 Re: Like vs '=' bug with indexing
Previous Message Tom Lane 2001-02-03 20:49:33 Re: 7.1 beta 3 CHANGES FOR QNX