Re: Problem with prepareStatement and Statement.RETURN_GENERATED_KEYS in PostgreSQL JDBC driver 8.4 - Mailing list pgsql-jdbc

From Alvaro Herrera
Subject Re: Problem with prepareStatement and Statement.RETURN_GENERATED_KEYS in PostgreSQL JDBC driver 8.4
Date
Msg-id 20140612142231.GA27193@eldon.alvh.no-ip.org
Whole thread Raw
In response to Re: Problem with prepareStatement and Statement.RETURN_GENERATED_KEYS in PostgreSQL JDBC driver 8.4  (Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>)
Responses Re: Problem with prepareStatement and Statement.RETURN_GENERATED_KEYS in PostgreSQL JDBC driver 8.4  (David G Johnston <david.g.johnston@gmail.com>)
List pgsql-jdbc
Heikki Linnakangas wrote:

> But that's not very bullet-proof, and will fail to detect the statement
> as an INSERT if it e.g begins with a comment. We could add a mini-parser
> to detect comments too, but it's not a very robust approach.

It will also fail to work with WITH clauses,

alvherre=# create table r (f int);
CREATE TABLE
alvherre=# insert into r values (42), (142857);
INSERT 0 2
alvherre=# with t as (select 1) update r set f = f + t."?column?" from t returning r.*;
   f
--------
     43
 142858
(2 filas)

UPDATE 2

--
Álvaro Herrera                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services


pgsql-jdbc by date:

Previous
From: Dave Cramer
Date:
Subject: Re: Hibernate over postgresql
Next
From: David G Johnston
Date:
Subject: Re: Problem with prepareStatement and Statement.RETURN_GENERATED_KEYS in PostgreSQL JDBC driver 8.4