Re: Error selecting constant - Mailing list pgsql-jdbc

From Oliver Jowett
Subject Re: Error selecting constant
Date
Msg-id 48AF4A83.4060400@opencloud.com
Whole thread Raw
In response to Error selecting constant  (Mat <mat@voxmobili.com>)
List pgsql-jdbc
Mat wrote:

> org.springframework.dao.DataRetrievalFailureException: Problem executing
> statement: SELECT '?_?' as result with values [str1, str2]; nested
> exception is org.postgresql.util.PSQLException: The column index is out
> of range: 1, number of columns: 0.

Try "SELECT ? || '_' || ?"

Parameter substitution is not just substitution into the query string,
you can only put ? where it makes sense to have a selfcontained data
value. And it's definitely not going to work inside a string constant,
the driver must interpret that '?' as a literal '?' not a parameter
placeholder!

-O

pgsql-jdbc by date:

Previous
From: Mat
Date:
Subject: Error selecting constant
Next
From: "kumar, Anand (Anand)"
Date:
Subject: ssl support in XA Datasource