Re: Return Codes of BatchUpdateException in PostgreSql 9.6 - Mailing list pgsql-jdbc

From Tillmann Schulz
Subject Re: Return Codes of BatchUpdateException in PostgreSql 9.6
Date
Msg-id 2090140889.4873532.1476796498454@mail.yahoo.com
Whole thread Raw
In response to Return Codes of BatchUpdateException in PostgreSql 9.6  (Tillmann Schulz <tillmann73@yahoo.de>)
Responses Re: Return Codes of BatchUpdateException in PostgreSql 9.6  (Enrico Olivelli - Diennea <enrico.olivelli@diennea.com>)
List pgsql-jdbc
Hi,

After debugging my problem with the updateCount in the 9.4.1211 JDBC Driver I found the line in the code which causes
theerror. 

It's

  org.postgresql.jdbc.BatchResultHandler, Line 138 , JDBC Driver postgresql-9.4.1211

 @Override
 public void handleError(SQLException newError) {
   if (getException() == null) {
      Arrays.fill(updateCounts, committedRows, updateCounts.length, Statement.EXECUTE_FAILED);  //138 <-- BUG
   //...



Before the line "Arrays.fill..." the updateCounts contain the information of the already successfully inserted records
[1,1,1,1,1,0,0,0,0,0]. 
After filling the array with Statement.EXECUTE_FAILED the array contains [-3,-3,-3,-3,-3,-3,-3,-3,-3,-3]
This is a not correct.
The correct result is [1,1,1,1,1] or [1,1,1,1,1,-3]

How to get this bug fixed? Can you rethink your implementation?

Thank you for your help,

Tillmann

pgsql-jdbc by date:

Previous
From: Tillmann Schulz
Date:
Subject: Re: Return Codes of BatchUpdateException in PostgreSql 9.6
Next
From: Enrico Olivelli - Diennea
Date:
Subject: Re: Return Codes of BatchUpdateException in PostgreSql 9.6