Re: Help please - completely baffled by quoting - Mailing list pgsql-general

From Peter Eisentraut
Subject Re: Help please - completely baffled by quoting
Date
Msg-id 200406201506.38447.peter_e@gmx.net
Whole thread Raw
In response to Help please - completely baffled by quoting  ("Tim Robinson" <tim.robinson@blueyonder.co.uk>)
Responses Re: Help please - completely baffled by quoting
List pgsql-general
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.


pgsql-general by date:

Previous
From: "Tim Robinson"
Date:
Subject: Help please - completely baffled by quoting
Next
From: Tom Lane
Date:
Subject: Re: pg_proc_proname_args_nsp_index error