From: luvar@plaintext.sk
To: pgsql-jdbc@postgresql.org
Subject: bug in jdbc
Date: Sat, 3 Sep 2011 18:16:30 +0100 (GMT+01:00)
Message-ID: <381613887.6661315070190151.JavaMail.root@shiva> (raw)
In-Reply-To: <41953811.6641315070051379.JavaMail.root@shiva>
Hi, I have executed some update query and I have requested to return generated id...
statement.executeUpdate(query, Statement.RETURN_GENERATED_KEYS);
ResultSet ids = statement.getGeneratedKeys();
ids.next();
ids.getInt(1);
It will fail with this exception:
19:03:50,300 WARN ObjectBrowser:254 - Bad value for type int : /home/luvar/output.svg
org.postgresql.util.PSQLException: Bad value for type int : /home/luvar/output.svg
at org.postgresql.jdbc2.AbstractJdbc2ResultSet.toInt(AbstractJdbc2ResultSet.java:2759)
at org.postgresql.jdbc2.AbstractJdbc2ResultSet.getInt(AbstractJdbc2ResultSet.java:2003)
.....
I am using maven. Used jdbc version:
<dependency>
<groupId>postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>9.0-801.jdbc4</version>
</dependency>
I have table constructed in such way, that id (bigserial typed) column is NOT first column. It is second and first column of my table is "url" column to which I try insert "/home/luvar/output.svg" value.
Can you have a look and confirm this bug to me, or there is no bug and something I am doing bad?
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: luvar@plaintext.sk
Subject: Re: bug in jdbc
In-Reply-To: <381613887.6661315070190151.JavaMail.root@shiva>
References: <41953811.6641315070051379.JavaMail.root@shiva> <381613887.6661315070190151.JavaMail.root@shiva>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox