someone please explain this regex behaviour

From: Martin Leja <Martin(dot)Leja(at)unix-ag(dot)uni-siegen(dot)de>
To: pgsql-general(at)postgresql(dot)org
Subject: someone please explain this regex behaviour
Date: 2001-01-27 23:13:06
Message-ID: 4.3.2.7.2.20010127235532.02bd90d8@vmax.unix-ag.uni-siegen.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

consider the following simple example, where i want to select a path by
using a where clause with the case insensitive operator "~*". Everything is
ok where i get a result of one row, but i don't understand the results with
0 rows:

backup=> select version();
version
-------------------------------------------------------------
PostgreSQL 6.5.3 on i686-pc-linux-gnu, compiled by gcc 2.95.2
(1 row)

backup=> create table foo (path varchar(300));
CREATE
backup=> insert into foo (path) values ('/My');
INSERT 29400 1
backup=> select path from foo where path ~* '/My';
path
----
/My
(1 row)

backup=> select path from foo where path ~* '^/My';
path
----
/My
(1 row)

backup=> select path from foo where path ~* '^/my';
path
----
(0 rows)

backup=> select path from foo where path ~* '/my';
path
----
/My
(1 row)

backup=> select path from foo where path ~* '/mY';
path
----
/My
(1 row)

backup=> select path from foo where path ~* '^/mY';
path
----
(0 rows)

Why e.g. does the statement "select path from foo where path ~* '^/my';"
not return the only entry "/My"? Can someone explain this?
--
Regards, martin(at)unix-ag(dot)org

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Peter Eisentraut 2001-01-27 23:33:49 Re: Setting logfile location with pg_ctl and postgres.conf
Previous Message Mitch Vincent 2001-01-27 23:04:51 varchar => int