SELECT with regular pattern '~' delivers wrong output

From: Fabio Nanni <f(dot)nanni(at)albourne(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: SELECT with regular pattern '~' delivers wrong output
Date: 2001-02-08 10:55:48
Message-ID: 3A827B34.6640B434@albourne.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-ports

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)

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Mike Howard 2001-02-08 15:59:38 Referencial integerity problem
Previous Message Tom Lane 2001-02-08 04:39:51 Re: Problem displaying functions and views in 7.1b3

Browse pgsql-ports by date

  From Date Subject
Next Message Jeff Lu 2001-02-08 18:26:39 database creation failed
Previous Message Jason Tishler 2001-02-08 02:32:17 Re: Win98/Cygwin make failure