Re: Quotes, double quotes...

Поиск
Список
Период
Сортировка
От hubert depesz lubaczewski
Тема Re: Quotes, double quotes...
Дата
Msg-id 20130930064815.GB18650@depesz.com
обсуждение исходный текст
Ответ на Quotes, double quotes...  (António M. Rodrigues <amcrgrodrigues@gmail.com>)
Список pgsql-general
On nie, wrz 29, 2013 at 02:09:54 +0100, António M. Rodrigues wrote:
> The code is the following:
>
> -----------------------------------------------------
> DO $$
> DECLARE
>     i integer;
> BEGIN
> FOR i IN (select nn from numeros)
> LOOP
> EXECUTE
> 'create table contagio' || i || ' as
> SELECT *
>  FROM pgr_drivingdistance("


" character is not for strings - it's for identifiers.

if you want to have string within string you have following options:
a. multiply ' - i.e. use '' (not ")
b. use $ quotation

so you can:
execute 'whatever ''sub string'' anything ';
or
execute 'whatever $sub$sub string$sub$';

depesz

--
The best thing about modern society is how easy it is to avoid contact with it.
                                                             http://depesz.com/


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

Предыдущее
От: Adrian Klaver
Дата:
Сообщение: Re: Trouble installing psycopg2
Следующее
От: Albe Laurenz
Дата:
Сообщение: Re: logging statements in PostgreSQL