Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
3.0 beta 1
-
None
-
IcedTea6 1.6.1
PostgreSQL 8.3
JDBC 8.3-603.jdbc4
Description
I have queries that no longer work in 3.0B1, because of a change that was made in revision 813661. For example, a query like this used to work:
DataObjectUtils.objectForPK(db, Artist.class, "1");
But now, I get the following error:
org.postgresql.util.PSQLException: ERROR: operator does not exist: smallint = character varying
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:1592)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1327)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:192)
at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:451)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:350)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:254)
at org.apache.cayenne.access.jdbc.SelectAction.performAction(SelectAction.java:71)
at org.apache.cayenne.access.DataNodeQueryAction.runQuery(DataNodeQueryAction.java:87)
at org.apache.cayenne.access.DataNode.performQueries(DataNode.java:274)
at org.apache.cayenne.access.DataDomainQueryAction.runQuery(DataDomainQueryAction.java:418)
at org.apache.cayenne.access.DataDomainQueryAction.access$000(DataDomainQueryAction.java:65)
at org.apache.cayenne.access.DataDomainQueryAction$2.transform(DataDomainQueryAction.java:391)
at org.apache.cayenne.access.DataDomain.runInTransaction(DataDomain.java:850)
at org.apache.cayenne.access.DataDomainQueryAction.runQueryInTransaction(DataDomainQueryAction.java:388)
at org.apache.cayenne.access.DataDomainQueryAction.interceptOIDQuery(DataDomainQueryAction.java:155)
at org.apache.cayenne.access.DataDomainQueryAction.execute(DataDomainQueryAction.java:112)
at org.apache.cayenne.access.DataDomain.onQuery(DataDomain.java:743)
at org.apache.cayenne.util.ObjectContextQueryAction.runQuery(ObjectContextQueryAction.java:333)
at org.apache.cayenne.util.ObjectContextQueryAction.execute(ObjectContextQueryAction.java:96)
at org.apache.cayenne.access.DataContext.onQuery(DataContext.java:1278)
at org.apache.cayenne.access.DataContext.performQuery(DataContext.java:1267)
at org.apache.cayenne.DataObjectUtils.objectForQuery(DataObjectUtils.java:273)
at org.apache.cayenne.DataObjectUtils.objectForPK(DataObjectUtils.java:259)
at org.apache.cayenne.DataObjectUtils.objectForPK(DataObjectUtils.java:170)
at Test.main(Test.java:9)
Exception in thread "main" org.apache.cayenne.CayenneRuntimeException: [v.3.0-SNAPSHOT Oct 30 2009 10:19:35] Query exception.
at org.apache.cayenne.access.DataDomainQueryAction.nextQueryException(DataDomainQueryAction.java:545)
at org.apache.cayenne.access.DataNode.performQueries(DataNode.java:281)
at org.apache.cayenne.access.DataDomainQueryAction.runQuery(DataDomainQueryAction.java:418)
at org.apache.cayenne.access.DataDomainQueryAction.access$000(DataDomainQueryAction.java:65)
at org.apache.cayenne.access.DataDomainQueryAction$2.transform(DataDomainQueryAction.java:391)
at org.apache.cayenne.access.DataDomain.runInTransaction(DataDomain.java:850)
at org.apache.cayenne.access.DataDomainQueryAction.runQueryInTransaction(DataDomainQueryAction.java:388)
at org.apache.cayenne.access.DataDomainQueryAction.interceptOIDQuery(DataDomainQueryAction.java:155)
at org.apache.cayenne.access.DataDomainQueryAction.execute(DataDomainQueryAction.java:112)
at org.apache.cayenne.access.DataDomain.onQuery(DataDomain.java:743)
at org.apache.cayenne.util.ObjectContextQueryAction.runQuery(ObjectContextQueryAction.java:333)
at org.apache.cayenne.util.ObjectContextQueryAction.execute(ObjectContextQueryAction.java:96)
at org.apache.cayenne.access.DataContext.onQuery(DataContext.java:1278)
at org.apache.cayenne.access.DataContext.performQuery(DataContext.java:1267)
at org.apache.cayenne.DataObjectUtils.objectForQuery(DataObjectUtils.java:273)
at org.apache.cayenne.DataObjectUtils.objectForPK(DataObjectUtils.java:259)
at org.apache.cayenne.DataObjectUtils.objectForPK(DataObjectUtils.java:170)
at Test.main(Test.java:9)
Caused by: org.postgresql.util.PSQLException: ERROR: operator does not exist: smallint = character varying
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:1592)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1327)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:192)
at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:451)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:350)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:254)
at org.apache.cayenne.access.jdbc.SelectAction.performAction(SelectAction.java:71)
at org.apache.cayenne.access.DataNodeQueryAction.runQuery(DataNodeQueryAction.java:87)
at org.apache.cayenne.access.DataNode.performQueries(DataNode.java:274)
... 16 more
The strange part is that the logger shows the query as SELECT t0.name, t0.id FROM lookup.color t0 WHERE t0.id = ? [bind: 1->id:'1'], both before and after the change. Postgres can usually deal with using a character type to match on an integer column. Something must have changed with the JDBC binding that is not showing up in the textual representation of the query.