Comments (5)
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 @static
would have no performance impact and is clearly marked.
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.
from libpq.jl.
Can you give an example please?
I cannot seem to replicate this on Julia 1.6.7 with LibPQ 1.15.1.
from libpq.jl.
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
ERROR: InexactError: convert(Dates.Decimal3, 789012)
Stacktrace:
[1] tryparsenext
@ ~/Languages/julia-1.7.1/share/julia/stdlib/v1.7/Dates/src/io.jl:153 [inlined]
[2] tryparsenext
@ ~/Languages/julia-1.7.1/share/julia/stdlib/v1.7/Dates/src/io.jl:41 [inlined]
[3] macro expansion
@ ~/Languages/julia-1.7.1/share/julia/stdlib/v1.7/Dates/src/parse.jl:64 [inlined]
[4] tryparsenext_core(str::String, pos::Int64, len::Int64, df::DateFormat{Symbol("y-m-d HH:MM:SS.s"), Tuple{Dates.DatePart{'y'}, Dates.Delim{Char, 1}, Dates.DatePart{'m'}, Dates.Delim{Char, 1}, Dates.DatePart{'d'}, Dates.Delim{Char, 1}, Dates.DatePart{'H'}, Dates.Delim{Char, 1}, Dates.DatePart{'M'}, Dates.Delim{Char, 1}, Dates.DatePart{'S'}, Dates.Delim{Char, 1}, Dates.DatePart{'s'}}}, raise::Bool)
@ Dates ~/Languages/julia-1.7.1/share/julia/stdlib/v1.7/Dates/src/parse.jl:38
[5] macro expansion
@ ~/Languages/julia-1.7.1/share/julia/stdlib/v1.7/Dates/src/parse.jl:150 [inlined]
[6] tryparsenext_internal
@ ~/Languages/julia-1.7.1/share/julia/stdlib/v1.7/Dates/src/parse.jl:125 [inlined]
[7] tryparse(::Type{DateTime}, str::String, df::DateFormat{Symbol("y-m-d HH:MM:SS.s"), Tuple{Dates.DatePart{'y'}, Dates.Delim{Char, 1}, Dates.DatePart{'m'}, Dates.Delim{Char, 1}, Dates.DatePart{'d'}, Dates.Delim{Char, 1}, Dates.DatePart{'H'}, Dates.Delim{Char, 1}, Dates.DatePart{'M'}, Dates.Delim{Char, 1}, Dates.DatePart{'S'}, Dates.Delim{Char, 1}, Dates.DatePart{'s'}}})
@ Dates ~/Languages/julia-1.7.1/share/julia/stdlib/v1.7/Dates/src/parse.jl:290
[8] pqparse(#unused#::Type{DateTime}, str::String)
@ LibPQ ~/.julia/packages/LibPQ/gYEIG/src/parsing.jl:262
[9] top-level scope
@ REPL[8]:1
In Julia 1.8.2, LibPQ 1.15.1
using LibPQ
using Dates
LibPQ.pqparse(DateTime, "2023-03-03 12:34:56.789012")
yields
2023-03-03T12:34:56.789
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
from libpq.jl.
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.
from libpq.jl.
Sorry, I do not quite understand...
Why can't we do the same as in #248? It seems simple enough.
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.
from libpq.jl.
Related Issues (20)
- collect on LibPQ.Column allocates a lot HOT 1
- Memory Leak? HOT 4
- LibPQ and local peer trust ("ident") HOT 4
- All rational numbers are parsed as Decimals.Decimal instead of Float HOT 3
- Trying to implement large object support HOT 4
- Large select queries running 5-10x slower than with psql HOT 7
- Support UUIDs with binary_format=true HOT 1
- Make Tables.rowtable(result) as fast as Tables.rowtable(Tables.columntable(result))
- Docs links return 404 HOT 3
- Using array_agg results in a string HOT 2
- I install LibPQ but test fails. HOT 1
- Guess when there is no server running in tests and suggest users install one
- Multiple `async_execute`s may not always execute in sequence?
- `execute` and `async_execute` exception handling difference
- `LibPQ`.`async_execute`'s overhead is around 3ms HOT 2
- Add functions for closing prepared statements (requires PostgreSQL 17 release and corresponding libpq_jll)
- Can't suppress LibPQ's error output HOT 2
- Conflict with Dates.jl HOT 1
- Can't store Vector{UInt8} as expected in bytea
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from libpq.jl.