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

From: "Andrey G(dot)" <andvgal(at)gmail(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #5776: Unable to create view with parameter in PL/pgsql
Date: 2010-12-14 21:03:44
Message-ID: AANLkTiksbHxpHTR03UAyB_y0eMFuyXYNwiZfVoFTMRmE@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

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 <robertmhaas(at)gmail(dot)com>:
> On Mon, Dec 13, 2010 at 4:28 PM, Andrey G. <andvgal(at)gmail(dot)com> 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
>> LINE 1: CREATE VIEW v4 AS SELECT * FROM t1 WHERE some_field = $1
>>                                                               ^
>> QUERY:  CREATE VIEW v4 AS SELECT * FROM t1 WHERE some_field = $1
>> CONTEXT:  PL/pgSQL function "bug_create_tmp_view_exec_test" line 3 at
>> EXECUTE statement
>
> Yeah, parameter substitution doesn't work in this case.  You could
> however build up a string with quote_identifier() and then EXECUTE the
> resulting string.
>
> --
> Robert Haas
> EnterpriseDB: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Robert Haas 2010-12-14 21:09:11 Re: BUG #5776: Unable to create view with parameter in PL/pgsql
Previous Message Tomas Vondra 2010-12-14 20:57:31 Re: memory leak in xml2 contrib module