[#8166] fix: treat PostgreSQL SQLSTATE as string#8260
Merged
justinmclean merged 2 commits intoapache:mainfrom Aug 25, 2025
Merged
[#8166] fix: treat PostgreSQL SQLSTATE as string#8260justinmclean merged 2 commits intoapache:mainfrom
justinmclean merged 2 commits intoapache:mainfrom
Conversation
54fab80 to
f871989
Compare
Contributor
|
LGTM; @yuqi1129 Yuqi, what do you think? |
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR fixes a bug in the PostgreSQL exception converter where SQLSTATE codes were incorrectly parsed as integers, causing NumberFormatException when encountering alphanumeric codes like "28P01".
- Changed SQLSTATE handling from integer parsing to string comparison
- Added comprehensive unit tests for both numeric and alphanumeric SQLSTATE codes
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| PostgreSQLExceptionConverter.java | Changed SQLSTATE handling from integer to string to support alphanumeric codes |
| TestPostgreSQLExceptionConverter.java | Added unit tests covering numeric and non-numeric SQLSTATE scenarios |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
justinmclean
approved these changes
Aug 25, 2025
Member
justinmclean
left a comment
There was a problem hiding this comment.
Thanks for doing this, much appreciated
diqiu50
pushed a commit
to diqiu50/gravitino
that referenced
this pull request
Sep 15, 2025
### What changes were proposed in this pull request? Fix bug in `PostgreSQLExceptionConverter` where SQLSTATE codes were parsed as numbers. Now SQLSTATE is treated as a string to avoid `NumberFormatException` (e.g., "28P01"). ### Why are the changes needed? PostgreSQL SQLSTATE codes can include letters. Parsing them as integers causes runtime errors. Fix: apache#8166 ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? 1. Added unit tests for numeric code ("23505") and non-numeric code ("28P01"). 2. Verified tests pass successfully. Co-authored-by: 이준하 <joonha.lee@kia.com> Co-authored-by: Justin Mclean <justin@classsoftware.com>
bharos
pushed a commit
to bharos/gravitino
that referenced
this pull request
Oct 3, 2025
### What changes were proposed in this pull request? Fix bug in `PostgreSQLExceptionConverter` where SQLSTATE codes were parsed as numbers. Now SQLSTATE is treated as a string to avoid `NumberFormatException` (e.g., "28P01"). ### Why are the changes needed? PostgreSQL SQLSTATE codes can include letters. Parsing them as integers causes runtime errors. Fix: apache#8166 ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? 1. Added unit tests for numeric code ("23505") and non-numeric code ("28P01"). 2. Verified tests pass successfully. Co-authored-by: 이준하 <joonha.lee@kia.com> Co-authored-by: Justin Mclean <justin@classsoftware.com>
bharos
pushed a commit
to bharos/gravitino
that referenced
this pull request
Oct 7, 2025
### What changes were proposed in this pull request? Fix bug in `PostgreSQLExceptionConverter` where SQLSTATE codes were parsed as numbers. Now SQLSTATE is treated as a string to avoid `NumberFormatException` (e.g., "28P01"). ### Why are the changes needed? PostgreSQL SQLSTATE codes can include letters. Parsing them as integers causes runtime errors. Fix: apache#8166 ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? 1. Added unit tests for numeric code ("23505") and non-numeric code ("28P01"). 2. Verified tests pass successfully. Co-authored-by: 이준하 <joonha.lee@kia.com> Co-authored-by: Justin Mclean <justin@classsoftware.com>
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.
What changes were proposed in this pull request?
Fix bug in
PostgreSQLExceptionConverterwhere SQLSTATE codes were parsed as numbers.Now SQLSTATE is treated as a string to avoid
NumberFormatException(e.g., "28P01").Why are the changes needed?
PostgreSQL SQLSTATE codes can include letters. Parsing them as integers causes runtime errors.
Fix: #8166
Does this PR introduce any user-facing change?
No
How was this patch tested?