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

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Mathieu Fenniak <hjoiiv(at)mathieu(dot)fenniak(dot)net>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #4436: (E'\\' LIKE E'\\') => f
Date: 2008-09-24 16:07:06
Message-ID: 200809241607.m8OG76w23363@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Mathieu Fenniak wrote:
>
> The following bug has been logged online:
>
> Bug reference: 4436
> Logged by: Mathieu Fenniak
> Email address: hjoiiv(at)mathieu(dot)fenniak(dot)net
> PostgreSQL version: 8.3.3
> Operating system: Linux x86-64
> Description: (E'\\' LIKE E'\\') => f
> Details:
>
> I noticed that (SELECT E'\\' LIKE E'\\') returns false, where I would expect
> it to return true. I asked on the #postgresql/freenode IRC channel, and
> nobody had a good explanation for this return value, suggesting it may be a
> minor bug.

I believe this is caused because backslash is the default escape
character for LIKE, so you need:

test=> SELECT E'\\' LIKE E'\\\\';
?column?
----------
t
(1 row)

or change the escape character:

test=> SELECT E'\\' LIKE E'\\' escape 'a';
?column?
----------
t
(1 row)

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2008-09-24 17:34:14 Re: Postgres won't start and doesn't generate any messages.
Previous Message Mathieu Fenniak 2008-09-24 16:00:52 BUG #4436: (E'\\' LIKE E'\\') => f