Re: [HACKERS] Bug in LIKE ? - Mailing list pgsql-hackers

From Oleg Bartunov
Subject Re: [HACKERS] Bug in LIKE ?
Date
Msg-id Pine.GSO.3.96.SK.990607165622.17331B-100000@ra
Whole thread Raw
In response to Re: [HACKERS] Bug in LIKE ?  (Daniele Orlandi <daniele@orlandi.com>)
Responses Re: [HACKERS] Bug in LIKE ?
List pgsql-hackers
On Mon, 7 Jun 1999, Daniele Orlandi wrote:

> Date: Mon, 07 Jun 1999 14:27:46 +0200
> From: Daniele Orlandi <daniele@orlandi.com>
> To: The Hermit Hacker <scrappy@hub.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@sai.msu.su, http://www.sai.msu.su/~megera/
phone: +007(095)939-16-83, +007(095)939-23-83




pgsql-hackers by date:

Previous
From: Daniele Orlandi
Date:
Subject: Re: [HACKERS] Bug in LIKE ?
Next
From: Bruce Momjian
Date:
Subject: Re: [HACKERS] postgresql-v6.5beta2.tar.gz ...