Re: create temp view from function inside plpgsql function.

Поиск
Список
Период
Сортировка
От Pavel Stehule
Тема Re: create temp view from function inside plpgsql function.
Дата
Msg-id CAFj8pRBoLWjQUVhM9GMDhdb9pNbnhN0Zr=7_ek8SfA5nh-AWOQ@mail.gmail.com
обсуждение исходный текст
Ответ на create temp view from function inside plpgsql function.  (Tjibbe <tjibbe@rijpma.org>)
Список pgsql-general
Hello


2014-04-04 11:43 GMT+02:00 Tjibbe <tjibbe@rijpma.org>:
I have a plpgsql function with:


PERFORM * FROM answers(_h);    --works fine.
CREATE TEMP VIEW answers AS SELECT * FROM answers(_h);  --gives error...

Inside view definition should not be plpgsql variable - this statement has no plan - CREATE VIEW

probably you can do with dynamic SQL

 EXECUTE 'CREATE TEMP VIEW answers AS SELECT * FROM answers(' || quote_literal(_h) || ')';

Regards

Pavel Stehule


Why I get this error:
ERROR: column \"_h\" does not exist\nLINE 1: ...TEMP VIEW answers AS SELECT * FROM antwoorden_view(_h)

--
+31 6 29401726
tjibbe@rijpma.org
Jacobusstraat 185
3012 JM Rotterdam

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

Предыдущее
От: Tjibbe
Дата:
Сообщение: create temp view from function inside plpgsql function.
Следующее
От: Oleg Bartunov
Дата:
Сообщение: Re: hstore - jsonb