BUG #15927: PGresult *PQexecParams(..) not work on view

Started by PG Bug reporting formover 6 years ago2 messagesbugs
Jump to latest
#1PG Bug reporting form
noreply@postgresql.org

The following bug has been logged on the website:

Bug reference: 15927
Logged by: Vladimir Dobrokhotov
Email address: pm_fon@mail.ru
PostgreSQL version: 10.1
Operating system: freebsd 11.1
Description:

create temp table ttt(a text)
...
select * from ttt where a= $1
create temp view vvv as select * from ttt where a= $1

ERROR: bind message supplies 1 parameters, but prepared statement ""

requires 0

(there are no restrictions on specific commands in the documentation)

#2Andres Freund
andres@anarazel.de
In reply to: PG Bug reporting form (#1)
Re: BUG #15927: PGresult *PQexecParams(..) not work on view

Hi,

On 2019-07-26 18:11:08 +0000, PG Bug reporting form wrote:

create temp table ttt(a text)
...
select * from ttt where a= $1
create temp view vvv as select * from ttt where a= $1

ERROR: bind message supplies 1 parameters, but prepared statement ""

requires 0

It's not really PQexecParams()'s fault that this doesn't work - we
simply do not support using parameters for DDL. And especially in a case
like this it seems unlikely that we will - what exactly would you expect
the created view to look like? I assume you think we'd change it so the
view references the value you supplied as a parameter as a literal
value? That seems like it'd be quite a bit of magic.

Greetings,

Andres Freund