Ioana Danes wrote
> create view tmp_view as 
> with func as (
>     select tmp_Cashdrawer.CashdrawerID, test1(tmp_Cashdrawer.CashdrawerID)
> as call
>     from tmp_Cashdrawer
> )
> select func.CashdrawerID, (func.call).*
> from func;

So yeah, putting this into a view will not work.  The WITH/CTE construct is
an optimization barrier so the WHERE clause that is going to be used cannot
be applied before the function call is performed - only afterwards.

As I said before LATERAL in 9.3 may help - though others will have to
comment - in cleaning up the syntax and multiple-calls.

For <= 9.2 you will have to either live with the slightly verbose syntax or
wrap what you need into user-defined functions.

David J.





--
View this message in context: 
http://postgresql.1045698.n5.nabble.com/Function-use-in-query-tp5758051p5758201.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.


-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Reply via email to