fix: avoid connection failure when DateStyle is set to ISO #1081
Conversation
Default PostgreSQL configuration is DateStyle='iso, dmy', however just iso would be fine. Note: PostgreSQL prints DateStyle value in upper case, and toUpperCase was added just in case. fixes #1080
Codecov Report
@@ Coverage Diff @@
## master #1081 +/- ##
============================================
+ Coverage 67.2% 67.27% +0.07%
- Complexity 3662 3665 +3
============================================
Files 170 170
Lines 15622 15623 +1
Branches 2523 2524 +1
============================================
+ Hits 10498 10510 +12
+ Misses 3937 3928 -9
+ Partials 1187 1185 -2 |
@@ -2593,7 +2593,8 @@ public void receiveParameterStatus() throws IOException, SQLException { | |||
value), PSQLState.CONNECTION_FAILURE); | |||
} | |||
|
|||
if (name.equals("DateStyle") && !value.startsWith("ISO,")) { | |||
if (name.equals("DateStyle") && !value.startsWith("ISO") | |||
&& !value.toUpperCase().startsWith("ISO")) { |
jorsol
Jan 21, 2018
Member
It looks redundant to check startsWith() first and toUpperCase().startsWith() later.
It looks redundant to check startsWith() first and toUpperCase().startsWith() later.
vlsi
Jan 21, 2018
Author
Member
The first one is an optimization
The first one is an optimization
rhavermans
added a commit
to bolcom/pgjdbc
that referenced
this pull request
Jul 13, 2018
Default PostgreSQL configuration is DateStyle='iso, dmy', however pgjdbc should not raise errors if DateStyle is just ISO Note: PostgreSQL prints DateStyle value in upper case, and toUpperCase was added just in case. fixes pgjdbc#1080
rhavermans
added a commit
to bolcom/pgjdbc
that referenced
this pull request
Jul 13, 2018
Default PostgreSQL configuration is DateStyle='iso, dmy', however pgjdbc should not raise errors if DateStyle is just ISO Note: PostgreSQL prints DateStyle value in upper case, and toUpperCase was added just in case. fixes pgjdbc#1080
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.
Default PostgreSQL configuration is DateStyle='iso, dmy',
however just iso would be fine.
Note: PostgreSQL prints DateStyle value in upper case, and toUpperCase
was added just in case.
fixes #1080