Re: [BUGS] BUG #5776: Unable to create view with parameter in PL/pgsql

2010-12-14 Thread Andrey G.
Robert, Yes, you've read my mind about quote_literal() ;). The bug report is rising exactly the parameter substitution issue. Andrey 2010/12/14 Robert Haas : > On Mon, Dec 13, 2010 at 4:28 PM, Andrey G. wrote: >> It seems my original test, which also includes the EXECUTE approach, >> has not

Re: [BUGS] BUG #5776: Unable to create view with parameter in PL/pgsql

2010-12-14 Thread Andrey G.
OK. Thanks, Andrey. 2010/12/14 Pavel Stehule : > Hello > > 2010/12/14 Andrey G. : >> Pavel, >> >> As far as I'm aware, SETOF return creates whole result in memory, what >> has some implications. >> > > it's not true for immutable SQL function - look on EXPLAIN > >> My intention was to create a

Re: [BUGS] BUG #5776: Unable to create view with parameter in PL/pgsql

2010-12-14 Thread Robert Haas
On Tue, Dec 14, 2010 at 4:03 PM, Andrey G. wrote: > Yes, you've read my mind about quote_literal() ;). The bug report is > rising exactly the parameter substitution issue. Yeah. I don't think it's exactly a bug so much as a known limitation, but of course I agree it would be convenient if it wor

Re: [BUGS] BUG #5776: Unable to create view with parameter in PL/pgsql

2010-12-14 Thread Robert Haas
On Mon, Dec 13, 2010 at 4:28 PM, Andrey G. wrote: > It seems my original test, which also includes the EXECUTE approach, > has not come to you in full. EXECUTE statement also fails with > parameter: The test is attached in file. > > psql -q < db/db/pgbug_5776.sql > ERROR:  there is no parameter $1

Re: [BUGS] BUG #5776: Unable to create view with parameter in PL/pgsql

2010-12-14 Thread Andrey G.
Pavel, As far as I'm aware, SETOF return creates whole result in memory, what has some implications. My intention was to create a temporary view in session, which can be used in other processing. Of course, I've found another solution, but creating view with parameter dynamically could be a good

Re: [BUGS] BUG #5776: Unable to create view with parameter in PL/pgsql

2010-12-14 Thread Pavel Stehule
Hello 2010/12/14 Andrey G. : > Pavel, > > As far as I'm aware, SETOF return creates whole result in memory, what > has some implications. > it's not true for immutable SQL function - look on EXPLAIN > My intention was to create a temporary view in session, which can be > used in other processing

Re: [BUGS] BUG #5776: Unable to create view with parameter in PL/pgsql

2010-12-14 Thread Pavel Stehule
Hello View must not has a parameter in PostgreSQL. You can use a SRF function: postgres=# create or replace function parametrized_view(a int) returns setof foo as $$ select * from foo where a = $1; $$ language sql immutable; CREATE FUNCTION

Re: [BUGS] BUG #5776: Unable to create view with parameter in PL/pgsql

2010-12-14 Thread Andrey G.
It seems my original test, which also includes the EXECUTE approach, has not come to you in full. EXECUTE statement also fails with parameter: The test is attached in file. psql -q < db/db/pgbug_5776.sql ERROR:  there is no parameter $1 LINE 1: CREATE VIEW v4 AS SELECT * FROM t1 WHERE some_field =

Re: [BUGS] BUG #5776: Unable to create view with parameter in PL/pgsql

2010-12-12 Thread Robert Haas
On Tue, Nov 30, 2010 at 4:43 PM, Andrey Galkin wrote: > > The following bug has been logged online: > > Bug reference:      5776 > Logged by:          Andrey Galkin > Email address:      andv...@gmail.com > PostgreSQL version: 9.0.1 > Operating system:   Debian unstable > Description:        Unabl

[BUGS] BUG #5776: Unable to create view with parameter in PL/pgsql

2010-11-30 Thread Andrey Galkin
The following bug has been logged online: Bug reference: 5776 Logged by: Andrey Galkin Email address: andv...@gmail.com PostgreSQL version: 9.0.1 Operating system: Debian unstable Description:Unable to create view with parameter in PL/pgsql Details: Below is simple