regex (not) matching null string
От | David M. Kaplan |
---|---|
Тема | regex (not) matching null string |
Дата | |
Msg-id | 3D10F11C.9070606@ucdavis.edu обсуждение исходный текст |
Ответы |
Re: regex (not) matching null string
Re: regex (not) matching null string |
Список | 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
В списке pgsql-bugs по дате отправления: