From: | "David M(dot) Kaplan" <dmkaplan(at)ucdavis(dot)edu> |
---|---|
To: | pgsql-bugs(at)postgresql(dot)org |
Subject: | regex (not) matching null string |
Date: | 2002-06-19 21:01:16 |
Message-ID: | 3D10F11C.9070606@ucdavis.edu |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
I have found that !~ and !~* do not match the null string even when one
would expect them to. I am not sure if this is how it is supposed to
work or if this is an error. If this is how it works, I can't figure
out where it is states in the documentation.
Let me give an example. Suppose we have a table "t" that look as follows:
# SELECT * FROM t;
n | s
---+---
1 | a
2 | b
3 |
4 | d
(4 rows)
Now consider the following query results:
# SELECT * FROM t where s ~* 'a';
n | s
---+---
1 | a
(1 row)
This works as expected (by me).
# SELECT * FROM t where s !~* 'a';
n | s
---+---
2 | b
4 | d
(2 rows)
This is not what I would have expected. Instead, I thought the result
would be:
# SELECT * FROM t where s !~* 'a'; --- This does not happen!!
n | s
---+---
2 | b
3 |
4 | d
(3 rows)
It seems to me that !~* should just be the inverse of ~*, but this does
not seem to be the case.
David
From | Date | Subject | |
---|---|---|---|
Next Message | Josemar Dias Ferreira | 2002-06-20 01:09:21 | INITDB hanging on Win2000/CygWin (PGSQL 7.2.1). |
Previous Message | Попов Андрей | 2002-06-19 13:06:13 | I have problem with pg_dump in PostgreSQL 7.1.2 |