Re: How to escape apostrophes when apostrophes already used to escape something else

From: "Albe Laurenz" <laurenz(dot)albe(at)wien(dot)gv(dot)at>
To: "Stefan Schwarzer *EXTERN*" <stefan(dot)schwarzer(at)grid(dot)unep(dot)ch>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: How to escape apostrophes when apostrophes already used to escape something else
Date: 2010-02-05 13:29:37
Message-ID: D960CB61B694CF459DCFB4B0128514C20393814D@exadv11.host.magwien.gv.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Stefan Schwarzer wrote:
> probably not too complicated, but although googling my way through
> many pages, I don't find the solution.
>
> I have a query which uses already an apostrophe to escape something
> else:
>
> $query = "SELECT
> *
> FROM
> crosstab('SELECT
[...]
> (c.name = ''Cote
d'Ivoire'' )
> ORDER BY
> 1,2;', 3) AS ct(name
varchar, y_1960 numeric)
>
> Now, "Cote d'Ivoire" needs to be escaped too. But how can I achieve
> this?

In your case, by using ''Cote d''''Ivoire''.

Yours,
Laurenz Albe

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Grzegorz Jaśkiewicz 2010-02-05 13:39:21 Re: How to escape apostrophes when apostrophes already used to escape something else
Previous Message manugarciac 2010-02-05 12:57:36 Idle in Transaction