When errors occur in a batch, only last one is visible, masking the original cause of the failure
See original GitHub issueWhen batch execution fails, we usually want to see the first failed statement. The subsequent failures can be caused by the first one, but in the exception thrown the (irrelevant) information of only the last failure is available.
Note the following line:
Our scenario:
- We are using
SET IDENTITY_INSERT .. ON
in one batch withINSERT
s to fill a table withIDENTITY
fields. - Insertions fails somewhere in the middle of the batch because of constraint violation.
- But what we see in exception is “Cannot insert explicit value for identity column”, which has nothing to do with the real cause of the error.
Can we change the logic of error handling so that the first failure in the batch is saved and is used when building BatchUpdateException
?
Issue Analytics
- State:
- Created a year ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Command Line Execution - DataVeil Data Masking User Guide
This command is on one logical line although it appears on multiple lines below due to line wrap. ./dataveil --nosplash --nogui -J-Dnetbeans.logger.
Read more >How Batch process works during the Error.
1. Assume a batch process has 3 iterations processing 200 records each. The batch process is doing an insert and I am using...
Read more >Data Masker Command Line Arguments and Batch Mode
The script output below shows such an operation. The 301 exit code means the masking set execution failed with an error.
Read more >Db2 Administration Tool 12.1 - CM batch parameter definitions
Specifies whether and how to generate a base version. This parameter enables you to start Change Management (CM) batch interface only to generate...
Read more >Find errors with transactional replication - SQL Server
Transactions occur on objects that are replicated, and are marked "for replication" in the transaction log. · The Log Reader Agent scans through ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@inponomarev
I initially thought to move this to our backlog, and consider it again in the future, but on further thought, this doesn’t seem like work that will enhance the driver. Users are able to see all batch error messages with the method described above and thus we feel no change is required. Adding a ‘total number of errors’ like you describe wouldn’t be helpful either. The user still needs to process the batch response, so they will be seeing the total regardless of whether is presented to them outright, or through batch processing. Finally, again, while changing to show a first error message may help workflows that use the first response, it will harm workflows that take advantage of last error message, having zero, or even a negative effect, in the long run.
Thanks for the submission, and discussion, but we will now close this issue.
Hi @inponomarev,
We’ll look into this. You make a good argument around how returning the last known error can mask the actual problem, but we’ll have to take a look into the impact this has on other workflows. Thanks for the PR as well, we’ll take a look into that too.