Re: Return Codes of BatchUpdateException in PostgreSql 9.6

Поиск
Список
Период
Сортировка
От Tillmann Schulz
Тема Re: Return Codes of BatchUpdateException in PostgreSql 9.6
Дата
Msg-id 1551770832.7977601.1476272573709@mail.yahoo.com
обсуждение исходный текст
Ответ на Re: Return Codes of BatchUpdateException in PostgreSql 9.6  (John R Pierce <pierce@hogranch.com>)
Ответы Re: Return Codes of BatchUpdateException in PostgreSql 9.6  (Bruce Momjian <bruce@momjian.us>)
Список pgsql-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

В списке pgsql-bugs по дате отправления:

Предыдущее
От: John R Pierce
Дата:
Сообщение: Re: Return Codes of BatchUpdateException in PostgreSql 9.6
Следующее
От: jan.kort@genetics.nl
Дата:
Сообщение: BUG #14367: Pressing execute 20-30 times really fast causes loop of error messages