Skip site navigation (1) Skip section navigation (2)

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

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Mathieu Fenniak <hjoiiv(at)mathieu(dot)fenniak(dot)net>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #4436: (E'\\' LIKE E'\\') => f
Date: 2008-09-25 20:57:52
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-bugs
Tom Lane wrote:
> Bruce Momjian <bruce(at)momjian(dot)us> 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
> character.

Yes, I think we should throw an error;  the original query looked odd to
me too.

  Bruce Momjian  <bruce(at)momjian(dot)us>

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

In response to


pgsql-bugs by date

Next:From: Alex HunsakerDate: 2008-09-25 22:05:04
Subject: Re: Incorrect "invalid AM/PM string" error from to_timestamp
Previous:From: Simon RiggsDate: 2008-09-25 18:50:39
Subject: Re: [ADMIN] Postgres Stats after Crash Recovery

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group