Re: "no value found for parameter 1" error for query with no parameters

From: "Phil Endecott" <spam_from_postgresql_general(at)chezphil(dot)org>
To: <pgsql-general(at)postgresql(dot)org>
Subject: Re: "no value found for parameter 1" error for query with no parameters
Date: 2007-02-12 00:01:07
Message-ID: 1171238467381@dmwebmail.belize.chezphil.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Peter Eisentraut wrote:
> Phil Endecott wrote:
>> I converted the first query like this:
>>
>> create or replace temporary view u_messages as
>> select * from messsages where owner=$1;
>
> What makes you think this should work?

Hi Peter, thanks for the quick reply.

Well this page:

http://www.postgresql.org/docs/8.1/static/libpq-exec.html

starts by saying

"the functions described here are used to perform SQL queries and commands"

and continues

"PQexecParams is like PQexec but offers additional functionality"

I don't see any suggestion that there are only some commands that can
use PQexecParams while others are limited to using PQexec.

But rather than discus the documentation, can we first establish for
certain whether I may use $n in a create view command, or whether I
have to go back to converting from C types to strings and escaping
them? It's a shame if I do have to do that, as changing over to binary
parameters had simplified a lot of my code.

Regards,

Phil.

(You are welcome to CC: me in any replies.)

Browse pgsql-general by date

  From Date Subject
Next Message Bill Moseley 2007-02-12 00:20:10 Adjacency List or Nested Sets to model file system hierarchy?
Previous Message Peter Eisentraut 2007-02-11 23:29:33 Re: getting postgres to emulate mysql/sqlserver bit datatype