-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tryparse
Inexact Error
#265
Comments
Can you give an example please? I cannot seem to replicate this on Julia 1.6.7 with LibPQ 1.15.1. |
Sure. Julia 1.7.1, LibPQ 1.15.1: using LibPQ
using Dates
LibPQ.pqparse(DateTime, "2023-03-03 12:34:56.789012") yields output
In Julia 1.8.2, LibPQ 1.15.1 using LibPQ
using Dates
LibPQ.pqparse(DateTime, "2023-03-03 12:34:56.789012") yields
Also, Julia 1.7.1, LibPQ 1.14.1 julia> using LibPQ
julia> using Dates
julia> LibPQ.pqparse(DateTime, "2023-03-03 12:34:56.789123")
2023-03-03T12:34:56.789 |
This works properly with LibPQ.jl 1.15.1 on Julia 1.7.3, Julia 1.6.7, and Julia 1.8.2+. Unfortunately my suggestion is to upgrade Julia to a later patch version, since the above error is a bug in Julia that was fixed. |
Sorry, I do not quite understand... Or, even better, just change https://github.com/iamed2/LibPQ.jl/blob/master/src/parsing.jl#L262 from parsed = tryparse(DateTime, str, TIMESTAMP_FORMAT) to parsed = tryparse(DateTime, _trunc_seconds(str), TIMESTAMP_FORMAT) as it basically was in 1.14.1? I can make a PR if you do not have time for these changes, no big deal. |
I would accept a PR for a static version-guarded fix for old patch versions. Typically, old patch versions of Julia are not supported, as they are neither tested in CI nor recommended for installation by the Julia developers. And I do not want to impact performance for everyone by adding regex replacement to every parse call (which is why it is written as it is now). But a different version guarded by I cannot guarantee it will survive in perpetuity, especially if there is a refactor. Testing on old patch versions is wasteful. However, if you reference this issue, I will ping you before removing your changes in the future to check if you've moved to a patched version of Julia. |
It seems that this commit: b82a753 introduced regression in processing of
tryparse
function infunction pqparse(::Type{DateTime}, str::AbstractString)
, similar to the issue that was resolved in #248So, currently in some
1.6
and1.7
versions of Julia, selecting from the postgres table which has timestamp column results inInexactError
fromtryparse
function.The text was updated successfully, but these errors were encountered: