prepared-statement* behaves different on OpenJDK 1.6 and OS X Java 1.6.


  • Type: Defect Defect
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Declined
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
  • Environment:


I'm using the Clojure library Korma to generate SQL for Postgres, which depends on Recently I added a custom 'upsert' query. Using it on normal java 1.6 is fine, but on openJDK it breaks due to the use of 'java.sql.Statement/RETURN_GENERATED_KEYS'. This makes the Postgres driver add a seemingly random "RETURNING *" at the end of the query.

On normal Java 1.6 java.sql.Statement/RETURN_GENERATED_KEYS doesn't exist and then a exception is caught and everything works as expected. Sounds like the world up side down, but I'm probably missing the rational behind this.

The line that causes the weird behavior is here:

The code that showcases the 'bug' is here:

(Sorry for the monkey patching in the gist, if there is a better way I would love to hear it)

I guess a naive patch would be to remove the java.sql.Statement/RETURN_GENERATED_KEYS line, but there must be a reason for its existence I assume.


Sean Corfield made changes -
Field Original Value New Value
Status Open [ 1 ] Resolved [ 5 ]
Resolution Declined [ 2 ]
Sean Corfield made changes -
Status Resolved [ 5 ] Closed [ 6 ]


Vote (0)
Watch (0)


  • Created: