Обсуждение: Re: "no value found for parameter 1" error for query with no parameters

Поиск
Список
Период
Сортировка

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

От
"Phil Endecott"
Дата:
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.)