SELECT with regular pattern '~' delivers wrong output - Mailing list pgsql-bugs

From Fabio Nanni
Subject SELECT with regular pattern '~' delivers wrong output
Date
Msg-id 3A827B34.6640B434@albourne.com
Whole thread Raw
Responses Re: SELECT with regular pattern '~' delivers wrong output
Re: SELECT with regular pattern '~' delivers wrong output
List pgsql-bugs
Hi,
I just found the strange behaviour reported below; I was expecting the
same response from the last two queries...

thanks
Fabio


LONG DESCRIPTION:
A SELECT with regular patterns (~) won't give you the right rows.

CODE SAMPLE:
select version();
-- OUTPUT:
--                              version
---------------------------------------------------------------------
-- PostgreSQL 7.1beta4 on alphaev67-dec-osf4.0f, compiled by cc -std
--(1 row)


create table cities (name text);

insert into cities values ('Alhambra');
insert into cities values ('Jackson');
insert into cities values ('Jacksonville');
insert into cities values ('Zurich');

select * from cities ;
-- OUTPUT:
--     name
-----------------
-- Alhambra
-- Jackson
-- Jacksonville
-- Zurich
--(4 rows)




select name from cities where name !~ '^A|^B|^C|^[D-I]|^[J][a-c]+kson'
order by name;
-- OUTPUT:
--  name
----------
-- Zurich
--(1 row)




select name from cities where name !~
'^A|^B|^C|^D|^[E-I]|^[J][a-c]+kson' order by name;
-- OUTPUT:
--     name
----------------
-- Alhambra
-- Jackson
-- Jacksonville
-- Zurich
--(4 rows)

pgsql-bugs by date:

Previous
From: Josh Berkus
Date:
Subject: Bug Report for 7.1 Beta 3
Next
From: "Jake Newren"
Date:
Subject: View refuses to work after system reboot