Re: Help please - completely baffled by quoting

From: "Tim Robinson" <tim(dot)robinson(at)blueyonder(dot)co(dot)uk>
To: <pgsql-general(at)postgresql(dot)org>
Subject: Re: Help please - completely baffled by quoting
Date: 2004-06-20 15:40:05
Message-ID: 007501c456dc$dcd7a390$0200a8c0@bart
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> -----Original Message-----
> From: Peter Eisentraut [mailto:peter_e(at)gmx(dot)net]
> Sent: 20 June 2004 14:07
> To: Tim Robinson; pgsql-general(at)postgresql(dot)org
> Subject: Re: [GENERAL] Help please - completely baffled by quoting
>
>
> Tim Robinson wrote:
> > select * from temp where a like 'a\\\'%'
> >
> > this should return all strings starting with a\' but it returns
> > nothing!!!
>
> \ is also the quoting character of LIKE, in addition to being
> a quoting
> character on the string literal level. If you want all strings
> starting with a\' then use something like:
>
> a LIKE 'a\\\'%' ESCAPE '!'
>
> where '!' selects some other escape character for LIKE that
> doesn't get
> in the way. The documentation on LIKE contains the details on this
> mechanism.
>

or..
a LIKE 'a\\\\\'%'

thanks, I get it now :)

--- Tim

In response to

Browse pgsql-general by date

  From Date Subject
Next Message kumar mcmillan 2004-06-20 15:44:03 pivot table sql -- COUNT() not working as expected
Previous Message Bruce Momjian 2004-06-20 13:32:53 Re: Relocation error pg_dumpall undefined symbol get_progname