pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tillmann Schulz <tillmann73@yahoo.de>
To: pgsql-bugs@postgresql.org <pgsql-bugs@postgresql.org>
Subject: Re: Return Codes of BatchUpdateException in PostgreSql 9.6
Date: Wed, 12 Oct 2016 11:42:53 +0000 (UTC)
Message-ID: <1551770832.7977601.1476272573709@mail.yahoo.com> (raw)
In-Reply-To: <a97b53cb-2b66-ef10-2a20-6aa7e3918249@hogranch.com>
References: <1828260214.7688612.1476267837715.ref@mail.yahoo.com>
	<1828260214.7688612.1476267837715@mail.yahoo.com>
	<a97b53cb-2b66-ef10-2a20-6aa7e3918249@hogranch.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

Hello again,


>>since htere's no SQL in your report, I'd suggest its probably a JDBC
>>issue. 

Yes, I am talking about JDBC-Batch-Update funcionallity in Java. So it could be a jdbc driver issue.
Is there a special mailing list for the driver?


>>no idea what you mean when you say batch updates... SQL 


I try to give an example.

Preparation, with SQL
-----------------------------

CREATE TABLE TESTTABLE (id INTEGER);

INSERT INTO TESTTABLE VALUES (5);


Java Code with Java JDBC Update
-----------------------------

    for( int i = 0; i < 10;i++ )
    {
        stmt.addBatch("INSERT INTO TESTTABLE VALUES('"+i+"')"	);
        stmt.executeBatch();
        con.commit();
    }
    catch( java.sql.BatchUpdateException x )
    {
        final int[] updateCounts = x.getUpdateCounts();
    }



In the sample, the 6th statement has an error, because the value 5 already exists in the database.


In this case in postgres 9.6 all fields updateCounts[0..9] are -3 (Statement.EXECUTE_FAILED) 
The behavior prior 9.6 was, that only the specific entry in updateCounts[5] has the error code -3

I hope this helps,

Tillmann Schulz


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



view thread (4+ messages)  latest in thread

Message-ID: <1551770832.7977601.1476272573709@mail.yahoo.com>
Permalink:  ../1551770832.7977601.1476272573709@mail.yahoo.com/
Also on:    postgresql.org/message-id/1551770832.7977601.1476272573709@mail.yahoo.com

 · 

reply

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-bugs@postgresql.org
  Cc: tillmann73@yahoo.de
  Subject: Re: Return Codes of BatchUpdateException in PostgreSql 9.6
  In-Reply-To: <1551770832.7977601.1476272573709@mail.yahoo.com>
  References: <1828260214.7688612.1476267837715.ref@mail.yahoo.com> <1828260214.7688612.1476267837715@mail.yahoo.com> <a97b53cb-2b66-ef10-2a20-6aa7e3918249@hogranch.com> <1551770832.7977601.1476272573709@mail.yahoo.com>

* 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