Wednesday, September 24, 2008

Re: [BUGS] BUG #4436: (E'\\' LIKE E'\\') => f

Bruce Momjian <> writes:
> Mathieu Fenniak wrote:
>> I noticed that (SELECT E'\\' LIKE E'\\') returns false,

> I believe this is caused because backslash is the default escape
> character for LIKE, so you need:
> test=> SELECT E'\\' LIKE E'\\\\';

Yeah. The given case is actually an invalid LIKE pattern. I wonder
whether we should make LIKE throw error for an invalid pattern.
You get an error for the corresponding case in regex:

regression=# select E'\\' ~ E'\\';
ERROR: invalid regular expression: invalid escape \ sequence

but IIRC the LIKE code just silently ignores a trailing escape

regards, tom lane

Sent via pgsql-bugs mailing list (
To make changes to your subscription:

No comments: