Re: Getting value of bind variables - Mailing list pgsql-general

From Martijn van Oosterhout
Subject Re: Getting value of bind variables
Date
Msg-id 20110823073215.GA18950@svana.org
Whole thread Raw
In response to Re: Getting value of bind variables  (Jayadevan M <Jayadevan.Maymala@ibsplc.com>)
List pgsql-general
On Tue, Aug 23, 2011 at 09:07:20AM +0530, Jayadevan M wrote:
> I guess so. But when I tried the same query on psql by replacing ($4) with
> a value like '20110404', the query works OK. The value of $4 is being
> passed from a java application. So does this mean I have to change the
> data type in java code?

For clarity, when you put the value '20110404' in a query, that is not
a varchar. Rather it's type is coerced to whatever is most appropriate
from the surrounding SQL.

To generate the same error you need to put '20110404'::varchar in place
of the parameter.

Have a nice day,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> He who writes carelessly confesses thereby at the very outset that he does
> not attach much importance to his own thoughts.
   -- Arthur Schopenhauer

Attachment

pgsql-general by date:

Previous
From: Giuseppe Sacco
Date:
Subject: Re: SSL certificates issue
Next
From: alexondi
Date:
Subject: Wal archiving and streaming replication