Open JajaComp opened 3 years ago
@JajaComp Can you make a simple reproducing project?
Hi @kdubb, sorry for the grave dig. Have encountered and replicated this issue myself.
CREATE TABLE my_table(a INTEGER NOT NULL PRIMARY KEY, b INTEGER);
Connection connection = ...;
PreparedStatement statement = connection.prepareStatement("INSERT INTO my_table (a, b) VALUES (?, ?) ON CONFLICT (a) DO NOTHING RETURNING (a);", RETURN_GENERATED_KEYS);
statement.setInt(1, 1);
statement.setInt(2, 1);
statement.addBatch();
statement.setInt(1, 1);
statement.setInt(2, 2);
statement.addBatch();
statement.executeBatch(); // Line 540 of PGPreparedStatement:
Happy path (insert one):
Unhappy path (insert two):
Results in:
java.lang.IndexOutOfBoundsException: Index 0 out of bounds for length 0
at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:100)
at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:106)
at java.base/jdk.internal.util.Preconditions.checkIndex(Preconditions.java:302)
at java.base/java.util.Objects.checkIndex(Objects.java:359)
at java.base/java.util.ArrayList.remove(ArrayList.java:504)
at com.impossibl.postgres.protocol.RowDataSet.take(RowDataSet.java:78)
at com.impossibl.postgres.jdbc.PGPreparedStatement.finishRequest(PGPreparedStatement.java:540)
at com.impossibl.postgres.jdbc.PGPreparedStatement.finishRequests(PGPreparedStatement.java:566)
at com.impossibl.postgres.jdbc.PGPreparedStatement.executeBatch(PGPreparedStatement.java:499)
at com.impossibl.postgres.jdbc.PGPreparedStatement.executeBatch(PGPreparedStatement.java:417)
Hi! I use exposed kotlin version 0.31.1 com.impossibl.pgjdbc-ng:pgjdbc-ng:0.8.9 After code:
exposed function arguments:
i got error:
I think problem do add exist item and after ignore returning empty result