From: | Lachezar Dobrev <l(dot)dobrev(at)gmail(dot)com> |
---|---|
To: | pgsql-jdbc(at)postgresql(dot)org |
Subject: | Regression: Problems with Timestamp arguments |
Date: | 2013-09-10 09:17:36 |
Message-ID: | CA+xsaB0EMDaNek0Oky9c17_8UX3-epWVP11+vTNgrAPoY2s9FA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
Hello colleagues,
There seems to be a problem with the latest driver and Timestamp
arguments uses in IS NULL comparisons:
QUERY: SELECT ? IS NULL
ARGUMENTS: statement.setTimestamp(1, new
Timestamp(System.currentTimeMillis()))
Result:
Exception in thread "main" org.postgresql.util.PSQLException: ERROR:
could not determine data type of parameter $1
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2157)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1886)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:255)
at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:555)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:417)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:302)
The problem arises on:
protocolVersion=3, or not specifying protocol version
argument type: Timestamp
The problem does not arise on other types (tested on BigDecimal and String)
The problem does not arise when using protocolVersion=2
The problem does not arise if the expression is not ? IS NULL
List of work-around methods:
- Degrade the protocol:
jdbc:postgresql://host:port/database?protocolVersion=2
* does not work with PgPool-2
- Explicitly cast the argument
SELECT ?::timestamp IS NULL
SELECT CAST(? AS timestamp) IS NULL
* requires rewriting of currently working code
I believe this to be a bug.
From | Date | Subject | |
---|---|---|---|
Next Message | Devrim GÜNDÜZ | 2013-09-10 09:19:51 | 9.3 driver |
Previous Message | Tore Halset | 2013-09-09 10:14:08 | setBlob(int, Blob) with large blob |