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

Поиск
Список
Период
Сортировка
От Stefan Schwarzer
Тема How to escape apostrophes when apostrophes already used to escape something else
Дата
Msg-id 39ADEF4E-E903-463C-9D31-C01C4E05407E@grid.unep.ch
обсуждение исходный текст
Ответы Re: How to escape apostrophes when apostrophes already used to escape something else  (Grzegorz Jaśkiewicz <gryzman@gmail.com>)
Re: How to escape apostrophes when apostrophes already used to escape something else  ("Albe Laurenz" <laurenz.albe@wien.gv.at>)
Re: How to escape apostrophes when apostrophes already used to escape something else  (Sam Mason <sam@samason.me.uk>)
Список pgsql-general
Hi there,

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
                        COALESCE(c.name, '''') AS name,
                        d.year_start AS year,
                        d.value AS value
                    FROM
                        co2_total_cdiac AS d
                    RIGHT JOIN
                        countries_view AS c ON c.id = d.id_country
                    WHERE
                        (d.year_start = 1960 ) AND
                        (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?

Thanks for any hints.

Stef

Вложения

В списке pgsql-general по дате отправления:

Предыдущее
От: dipti shah
Дата:
Сообщение: Re: SSL connection option from client side?
Следующее
От: Grzegorz Jaśkiewicz
Дата:
Сообщение: Re: How to escape apostrophes when apostrophes already used to escape something else