LibPQ.jl
LibPQ.jl copied to clipboard
fix: datetime tryparse (#265)
I've tested it locally with Julia versions 1.7.2 and 1.8.1 and it works correctly. Not sure, whether it make sense to add any specific tests, since runtests works with postgres database as a whole and should cover this function (for latest versions of Julia at least).
Yup no need to add specific tests.
This should be added to the ZonedDateTime and UTCDateTime parsing methods as well though, to replicate the same behaviour (I assume it also happens for those types?). For ZonedDateTime you can put the whole for-loop in the try-catch.
Well, in the end, I moved all @static to utility function, this allows for
- having clear code in main function
- it'll be easy to remove this fix in the future (just delete
_tryparseand change all_tryparsecalls totryparse
Also, I've updated pqparse(::Type{Time}, str::AbstractString) function to use the same approach.
I am using tryparse in catch block, because for some reason for ZonedDateTime tryparse is working properly in 1.7
Well, in the end, I moved all @static to utility function, this allows for
- having clear code in main function
- it'll be easy to remove this fix in the future (just delete
_tryparseand change all_tryparsecalls totryparse
Also, I've updated pqparse(::Type{Time}, str::AbstractString) function to use the same approach.
I am using tryparse in catch block, because for some reason for ZonedDateTime tryparse is working properly in 1.7
Sorry for bothering @iamed2 , but is there anything else that should be done in this PR?