Fix ConvertException false positives from SQLSTATE[HY match#1174
Closed
darkspock wants to merge 1 commit intoyiisoft:masterfrom
Closed
Fix ConvertException false positives from SQLSTATE[HY match#1174darkspock wants to merge 1 commit intoyiisoft:masterfrom
darkspock wants to merge 1 commit intoyiisoft:masterfrom
Conversation
The SQLSTATE[HY string match was too broad: HY is the "CLI-specific condition" class, not an integrity constraint class. This could cause non-integrity errors to be incorrectly wrapped as IntegrityException. Replace the string-based SQLSTATE[HY check with a proper errorInfo[0] SQLSTATE code check for class 23 (integrity constraint violations), which is the standard SQLSTATE class for these errors across all DBMS. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1174 +/- ##
============================================
+ Coverage 98.62% 98.71% +0.09%
- Complexity 1645 1648 +3
============================================
Files 120 120
Lines 4292 4289 -3
============================================
+ Hits 4233 4234 +1
+ Misses 59 55 -4 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Member
|
Another PR already fixing this part of code. If you have any suggestions regarding this, please write comment in that PR |
Member
|
Closed in favor #1170 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ConvertException::run()matchesSQLSTATE[HYin error messages to detect integrity constraint violations. However, SQLSTATE classHYis the "CLI-specific condition" class (e.g.,HY000= general error,HY001= memory allocation error,HY010= function sequence error). These are not integrity constraint violations and should not be wrapped asIntegrityException.This can cause false positives where general database errors are incorrectly classified as integrity violations.
Fix
SQLSTATE[HYstring matchPDOException::errorInfo[0](the SQLSTATE code) for class23, which is the standard SQLSTATE class for integrity constraint violations across all DBMSSQLSTATE[23message string match andORA-00001match as fallbacksBefore
After
Risk
Low — this makes detection more precise. Errors that were previously (incorrectly) classified as
IntegrityExceptionwill now correctly be classified asException. Code that catchesIntegrityExceptionspecifically will no longer catch unrelated errors.