Re: ERROR: there is no parameter $1

From: Sergey Konoplev <sergey(dot)konoplev(at)postgresql-consulting(dot)com>
To: mlanka(at)avineonindia(dot)com
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: ERROR: there is no parameter $1
Date: 2012-07-20 04:25:58
Message-ID: CAL_0b1sQg9Mx59Mw9CC6i1=OEmX7Mh4VUe_M4Ak1hkAgNp+1QA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On Fri, Jul 20, 2012 at 6:33 AM, Madhu.Lanka <mlanka(at)avineonindia(dot)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(dot)ru(at)gmail(dot)com Skype: gray-hemp Phone: +79160686204

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Craig Ringer 2012-07-20 04:38:36 Re: Postgres Database got down
Previous Message David Kerr 2012-07-20 04:10:50 Re: Measurin the lag between a master and a replica