New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Batch inserts with duplicate treatment only perform 1 insert #182
Comments
|
Strange thing: I have another table on which the problem does not happen. |
|
That is then a server issue, not a connector one, but in order to identify the issue, I've tryed on my side without reproducing this kind of error. |
|
Thanks for the help, @rusher The indices: And two triggers on the table: |
|
ok, reproduced. The only possible workaround is to disable connection closing issue here. please follow https://jira.mariadb.org/browse/MDEV-24411 for more information |
connector version 2.5.5
I have been using batch inserts and they've been working fine when not dealing with unique key conflicts.
However, I had to start dealing with conflicts on keys. I have tried both:
and
Where
entriesis an array of arrays as expected by the batch.Initially, I allowed duplicate values for the
(a,b)pairs, but I needed to enforce uniqueness.When there was no uniqueness constraint, everything worked fine. With the constraint, suddenly, the insert will go through the work on the duplicates before any unique insert but will stop after inserting the first non-duplicate new data.
If I run multiple times the batch insert with the same entries, the
resvariable will go something like this:{ affectedRows: 1, insertId: 11840, warningStatus: 0 }{ affectedRows: 2, insertId: 11841, warningStatus: 0 }{ affectedRows: 3, insertId: 11842, warningStatus: 0 }Note that if I try:
then 2 new rows will be inserted. So it seems the issue is with the 'batch' command not working correctly and not something on the mariadb side of things.
The text was updated successfully, but these errors were encountered: