Re: [HACKERS] Bug in LIKE ?

From: Oleg Bartunov <oleg(at)sai(dot)msu(dot)su>
To: Daniele Orlandi <daniele(at)orlandi(dot)com>, pgsql-hackers(at)hub(dot)org
Cc: The Hermit Hacker <scrappy(at)hub(dot)org>
Subject: Re: [HACKERS] Bug in LIKE ?
Date: 1999-06-07 13:00:11
Message-ID: Pine.GSO.3.96.SK.990607165622.17331B-100000@ra
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, 7 Jun 1999, Daniele Orlandi wrote:

> Date: Mon, 07 Jun 1999 14:27:46 +0200
> From: Daniele Orlandi <daniele(at)orlandi(dot)com>
> To: The Hermit Hacker <scrappy(at)hub(dot)org>
> Subject: Re: [HACKERS] Bug in LIKE ?
>
>
> > If I understand this correctly, IMHO, this would be asking for '^Sigma'
> > with at least one character after the 'a' ...
>
> Uhm.... I think the problem is a little worse:
>
> create table a ( b varchar(32) );
> insert into a values ( 'foo' );
> insert into a values ( 'bar' );
> insert into a values ( 'foobar' );
> insert into a values ( 'foobar2' );
>
> PostgreSQL 6.4.2
>
> tacacs=> select * from a where b like 'foo%';
> b
> -------
> foo
> foobar
> foobar2
> (3 rows)
>
> PostgreSQL 6.5beta2
>
> tacacs=> select * from a where b like 'foo%';
> b
> -
> (0 rows)
>
> tacacs=> select * from a where b like '%foo';
> b
> ---
> foo
> (1 row)
>
> tacacs=> select * from a where b ~ '^foo';
> b
> -------
> foo
> foobar
> foobar2
> (3 rows)
>

Hmm, just tried on current 6.5 from cvs:
test=> select version();
version
------------------------------------------------------------------------
PostgreSQL 6.5.0 on i586-pc-linux-gnulibc1, compiled by gcc egcs-2.91.66
(1 row)

test=> select * from a where b like 'foo%';
b
-------
foo
foobar
foobar2
(3 rows)

test=> select * from a where b like '%foo';
b
---
foo
(1 row)

test=> select * from a where b ~ '^foo';
b
-------
foo
foobar
foobar2
(3 rows)

Regards,
Oleg

> Bye.
>
> --
> Daniele
>
> -------------------------------------------------------------------------------
> Daniele Orlandi - Utility Line Italia - http://www.orlandi.com
> Via Mezzera 29/A - 20030 - Seveso (MI) - Italy
> -------------------------------------------------------------------------------
>
>
>

_____________________________________________________________
Oleg Bartunov, sci.researcher, hostmaster of AstroNet,
Sternberg Astronomical Institute, Moscow University (Russia)
Internet: oleg(at)sai(dot)msu(dot)su, http://www.sai.msu.su/~megera/
phone: +007(095)939-16-83, +007(095)939-23-83

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 1999-06-07 13:18:47 Re: [HACKERS] postgresql-v6.5beta2.tar.gz ...
Previous Message Daniele Orlandi 1999-06-07 12:27:46 Re: [HACKERS] Bug in LIKE ?