Re: create temp view from function inside plpgsql function. - Mailing list pgsql-general

From Pavel Stehule
Subject Re: create temp view from function inside plpgsql function.
Date
Msg-id CAFj8pRBoLWjQUVhM9GMDhdb9pNbnhN0Zr=7_ek8SfA5nh-AWOQ@mail.gmail.com
Whole thread Raw
In response to create temp view from function inside plpgsql function.  (Tjibbe <tjibbe@rijpma.org>)
List 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 by date:

Previous
From: Tjibbe
Date:
Subject: create temp view from function inside plpgsql function.
Next
From: Oleg Bartunov
Date:
Subject: Re: hstore - jsonb