escape
escape
От:
"Jean-Yves F. Barbier" <12ukwn@gmail.com>
Дата:
debian sid
pg 8.4.4-1
===============
Hi list,
I read the docs about escaping, but I can't find any other manner to escape
than a backslash or to double the single quote:
SELECT metaphone('O\'CONNOR') or SELECT metaphone('O''CONNOR')
The doc's talking about E, but SELECT metaphone(E'O'CONNOR') fail.
standard_conforming_strings = off is commented out, so I guess it is off
by defaut.
Is there another way to escape characters that migh trigger an error?
JY
--
Shit Happens.
Re: escape
От:
Jasen Betts <jasen@xnet.co.nz>
Дата:
On 2010-06-26, Jean-Yves F. Barbier <12ukwn@gmail.com> wrote:
> debian sid
> pg 8.4.4-1
>===============
> Hi list,
>
> I read the docs about escaping, but I can't find any other manner to escape
> than a backslash or to double the single quote:
> SELECT metaphone('O\'CONNOR') or SELECT metaphone('O''CONNOR')
>
> The doc's talking about E, but SELECT metaphone(E'O'CONNOR') fail.
if you use \ as an escape in the string you should use E at the start.
E'O\'CONNOR'
Re: escape
От:
"Jean-Yves F. Barbier" <12ukwn@gmail.com>
Дата:
Le 27 Jun 2010 12:08:05 GMT,
Jasen Betts a écrit :
> On 2010-06-26, Jean-Yves F. Barbier <12ukwn@gmail.com> wrote:
> > debian sid
> > pg 8.4.4-1
> >===============
> > Hi list,
> >
> > I read the docs about escaping, but I can't find any other manner to
> > escape than a backslash or to double the single quote:
> > SELECT metaphone('O\'CONNOR') or SELECT metaphone('O''CONNOR')
> >
> > The doc's talking about E, but SELECT metaphone(E'O'CONNOR') fail.
>
> if you use \ as an escape in the string you should use E at the start.
>
> E'O\'CONNOR'
Thanks, Jasen (doc wasn't very clear.)
But I also would like to know if there is another way to escape my string
(and especially if there is a builtin or a manner to do that into PG, to
avoid doing that in the program.)
JY
--
A male mathematician is someone who can count to twenty-one without
unzipping his fly.
Re: escape
От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
"Jean-Yves F. Barbier" <12ukwn@gmail.com> writes: > But I also would like to know if there is another way to escape my string No --- PG has too many string quoting conventions already; we aren't likely to add more. What you should be looking for is a way for your code to avoid dealing directly with the quoting rules. You might be able to use out-of-line parameter values, or use a subroutine provided by your PG client library to convert the string into properly quoted form. You haven't said what client-side programming environment you're using so it's hard to be more specific than that. regards, tom lane