Re: Bug #821: bug when using between or <= on varchar fields

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: <t(dot)piszczek(at)tallence(dot)com>, <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: Bug #821: bug when using between or <= on varchar fields
Date: 2002-11-19 17:31:08
Message-ID: 20021119092925.C67330-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Tue, 19 Nov 2002 pgsql-bugs(at)postgresql(dot)org wrote:

> Thomas Piszczek (t(dot)piszczek(at)tallence(dot)com) reports a bug with a severity of 3
> The lower the number the more severe it is.
>
> Short Description
> bug when using between or <= on varchar fields
>
> Long Description
> I just recognized that when using between or <= and >= on varchar
> fields postgresql behaves quite strange. If i search for users in my
> user table which does contain last_name entries beginning with o or p
> and have an sql that searches for "lower(last_name)>='k' and
> lower(last_name)<='o'" i get all results between k and n, but no
> "o-entries". If i do a "lower(last_name)>='k' and lower(last_name)<=p
> it works. I then get all results between k and o(no p's).
> Using "between 'k' and 'o'" behaves just the same.
> I think this is a bug(i'm using postgresql 7.2.3 on suse linux 8.1 with php 4.2.3)

The only entry that should give you is one that was equal to 'o', not ones
starting with 'o'. If you want that then you want to get a substring of
one letter for the comparison.

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Weber Gerhard 2002-11-20 08:31:58 version for sun cobalt qube 3
Previous Message pgsql-bugs 2002-11-19 17:25:45 Bug #821: bug when using between or <= on varchar fields