[JDBC] reWriteBatchedInserts=true not working with ON CONFLICT DO UPDATE

Поиск
Список
Период
Сортировка
От Thomas Kellerer
Тема [JDBC] reWriteBatchedInserts=true not working with ON CONFLICT DO UPDATE
Дата
Msg-id ob2isj$n2o$1@blaine.gmane.org
обсуждение исходный текст
Список pgsql-jdbc
When using the new reWriteBatchedInserts=true feature, this fails when using ON CONFLICT DO UPDATE ...

Assume the following table:

   create table testbatch (x integer primary key, y integer)

And the following code:

    pstmt = con.prepareStatement("insert into testbatch (x, y) values (?,?) on conflict (x) do update set y =
exluded.y");
    pstmt.setInt(1,1);
    pstmt.setInt(2,1);
    pstmt.addBatch();

    pstmt.setInt(1,2);
    pstmt.setInt(2,2);
    pstmt.addBatch();

    pstmt.executeBatch();

The executeBatch() fails with:

java.sql.BatchUpdateException: Batch entry 0

   insert into testbatch (x, y) values (1,1) on conflict (x),(2,2) on conflict (x) do update set y = exluded.y was
aborted:ERROR: syntax error at or near "," 

It seems the rewrite code doesn't take the on conflict clause into account properly.

However, it _does_ work correctly with ON CONFLICT DO NOTHING

Tested with postgresql-42.0.0.jar

Regards
Thomas





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

Предыдущее
От: Daniel Migowski
Дата:
Сообщение: [JDBC] [pgjdbc/pgjdbc] a7e0c8: feat: improve waiting for notifications byprovidi...
Следующее
От: Dave Cramer
Дата:
Сообщение: Re: Interest in allowing caller to push binary data ratherthan having it pulled?