Re: ERROR: there is no parameter $1 - Mailing list pgsql-admin

From Sergey Konoplev
Subject Re: ERROR: there is no parameter $1
Date
Msg-id CAL_0b1sQg9Mx59Mw9CC6i1=OEmX7Mh4VUe_M4Ak1hkAgNp+1QA@mail.gmail.com
Whole thread Raw
In response to ERROR: there is no parameter $1  ("Madhu.Lanka" <mlanka@avineonindia.com>)
Responses Re: ERROR: there is no parameter $1
List pgsql-admin
On Fri, Jul 20, 2012 at 6:33 AM, Madhu.Lanka <mlanka@avineonindia.com> wrote:
> I am getting the following error
>
> ERROR:  there is no parameter $1
> LINE 5: r.role_id = u.role_id and p.name= $1 and p.password = $2

Because they are not expanding inside strings. Use EXECUTE ... USING ...

EXECUTE '... and p.name =$1  and p.password = $2;' USING pname, ppassword

--
Sergey Konoplev

a database architect, software developer at PostgreSQL-Consulting.com
http://www.postgresql-consulting.com

Jabber: gray.ru@gmail.com Skype: gray-hemp Phone: +79160686204

pgsql-admin by date:

Previous
From: David Kerr
Date:
Subject: Re: Measurin the lag between a master and a replica
Next
From: Craig Ringer
Date:
Subject: Re: Postgres Database got down