-
Notifications
You must be signed in to change notification settings - Fork 860
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
fix: support insert ... on conflict...update for reWriteBatchedInserts=true #1130
Conversation
…s=true pgjdbc will avoid rewriting the query if a bind is identified after values(...) That is ON CONFLICT... DO update set x=? is NOT rewrite-compatible, and update set x='default' is rewrite-compatible "reported" here: https://stackoverflow.com/questions/47664889/jdbc-batch-operations-understanding/48349524?noredirect=1#comment84691562_48349524
Codecov Report
@@ Coverage Diff @@
## master #1130 +/- ##
============================================
+ Coverage 67.25% 67.28% +0.03%
- Complexity 3673 3680 +7
============================================
Files 170 170
Lines 15640 15643 +3
Branches 2531 2533 +2
============================================
+ Hits 10519 10526 +7
+ Misses 3932 3928 -4
Partials 1189 1189 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd really appreciate getting this in - it would be a huge benefit for us.
ps.setString(2, "53"); | ||
ps.addBatch(); | ||
int[] actual = ps.executeBatch(); | ||
BatchExecuteTest.assertSimpleInsertBatch(2, actual); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a way to test that it executed only a single statement? The fact that this asserts the same as the above test makes me feel uncertain.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this fixes #783 |
Is there anything I could do to help speed this branch along? |
I notice there's no tests in here that cover having a WHERE clause in the ON CONFLICT section. I haven't had time to test if it works; do you think it would? |
@Daenyth , I think it would, however more tests would definitely make sense there |
pgjdbc will avoid rewriting the query if a bind is identified after values(...)
That is ON CONFLICT... DO update set x=? is NOT rewrite-compatible, and update set x='default' is rewrite-compatible
"reported" here: https://stackoverflow.com/questions/47664889/jdbc-batch-operations-understanding/48349524?noredirect=1#comment84691562_48349524