Re: Getting value of bind variables

From: Jayadevan M <Jayadevan(dot)Maymala(at)ibsplc(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Getting value of bind variables
Date: 2011-08-23 03:37:20
Message-ID: OF7BCFF519.81EB64BE-ON652578F5.0012E5EF-652578F5.0013E71F@ibsplc.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,
Thank you for the reply.
> > I am trying to debug a query that gives an error. The error in the
> > application server log is
> > " ERROR: operator does not exist: timestamp without time zone =
character
> > varying
>
> > It looks like the error is for the condition ( CUSINDINF.MEMDOB ) =
($4) ,
> > memdob being a date of birth (timestamp) column. When I try the query
at
> > psql with some values, the data is retrieved OK. Is there some logging

> > available in PostgreSQL that will tell me what values were actually
used?
>
> Yes, if you're using a reasonably recent version of Postgres ---
> log_statements should provide that information. However, it's 100%
> irrelevant to this problem what the specific value is. The problem is
> that the application is declaring the *type* of $4 as varchar rather
> than something appropriate.
>
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?

By the way ,even log_statemtnts did not give me the bind variable value.
It gave me values for bind variables for queries which got executed, not
for this particular query. I am logging to csv file and loading it to the
postgres_log as mentioned in the document. For this scenario, does the
output go somewhere else? I am looking at the column query_text (select *
from postgres_log where error_severity='ERROR' and log_time > '20110818')

and it shows
.....AND ( CUSINDINF.MEMDOB )= ($4) ....

Regards,
Jayadevan

DISCLAIMER:

"The information in this e-mail and any attachment is intended only for
the person to whom it is addressed and may contain confidential and/or
privileged material. If you have received this e-mail in error, kindly
contact the sender and destroy all copies of the original communication.
IBS makes no warranty, express or implied, nor guarantees the accuracy,
adequacy or completeness of the information contained in this email or any
attachment and is not liable for any errors, defects, omissions, viruses
or for resultant loss or damage, if any, direct or indirect."

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Condor 2011-08-23 06:25:03 Re: securing the sql server ?
Previous Message Tom Lane 2011-08-23 02:54:58 Re: Updating Arrays