"Eric Noriega" <[EMAIL PROTECTED]> writes:
> db=# select 'tab' similar to 'a|b';
>  ?column?
> ----------
>  t

Yeah, this is a bug ... the cause can be seen by looking at the
underlying similar_escape() function, which converts a SIMILAR TO
pattern into a POSIX regex pattern:

regression=# select similar_escape('(a|b)', null);
 similar_escape
----------------
 ^(a|b)$
(1 row)

regression=# select similar_escape('a|b', null);
 similar_escape
----------------
 ^a|b$
(1 row)

regression=#

I believe that in the second case, ^ and $ bind more tightly than |
per POSIX rules.  So we need to put parens around the pattern to
prevent that.

Thanks for the report!

                        regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

Reply via email to