Re: anonymous block in Postgres - Hello World

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: anonymous block in Postgres - Hello World
Дата
Msg-id 5493.1180022273@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: anonymous block in Postgres - Hello World  ("Igor Neyman" <ineyman@perceptron.com>)
Список pgsql-admin
"Igor Neyman" <ineyman@perceptron.com> writes:
> CREATE OR REPLACE FUNCTION exec_plpgsql_block(exec_string text)
> RETURNS BOOLEAN
> AS $THIS$
> DECLARE lRet BOOLEAN;
> BEGIN
> EXECUTE 'CREATE OR REPLACE FUNCTION any_block()
> RETURNS VOID
> AS $$ ' || exec_string || ' $$LANGUAGE PLPGSQL;' ;
> PERFORM any_block();
> RETURN TRUE;
> END;
> $THIS$LANGUAGE PLPGSQL;

That hasn't failed for you yet?  It will the first time you use $$
in the argument.

Use quote_literal() please ...

            regards, tom lane

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Can't drop tables ERROR: cache lookup failed for relation 411727
Следующее
От: Nicola Mauri
Дата:
Сообщение: Abnormal storage consumption with autovacuum enabled