Skip to content

Commit e94033c

Browse files
committed
Handle new tryparse/parse logic for Julia 1.6.6
1 parent 7b13b3e commit e94033c

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

Project.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "LibPQ"
22
uuid = "194296ae-ab2e-5f79-8cd4-7183a0a5a0d1"
33
license = "MIT"
4-
version = "1.12.0"
4+
version = "1.13.0"
55

66
[deps]
77
CEnum = "fa961155-64e5-5f13-b03f-caf6b980ea82"

src/parsing.jl

+12-7
Original file line numberDiff line numberDiff line change
@@ -295,15 +295,20 @@ end
295295

296296
_DEFAULT_TYPE_MAP[:time] = Time
297297
function pqparse(::Type{Time}, str::AbstractString)
298-
try
299-
return parse(Time, str)
300-
catch err
301-
if !(err isa InexactError)
302-
rethrow(err)
298+
@static if v"1.6.6" <= VERSION < v"1.7.0" || VERSION > v"1.7.2"
299+
result = tryparse(Time, str)
300+
# If there's an error we want to see it here
301+
return isnothing(result) ? parse(Time, _trunc_seconds(str)) : result
302+
else
303+
try
304+
return parse(Time, str)
305+
catch err
306+
if !(err isa InexactError)
307+
rethrow(err)
308+
end
303309
end
310+
return parse(Time, _trunc_seconds(str))
304311
end
305-
306-
return parse(Time, _trunc_seconds(str))
307312
end
308313

309314
# InfExtendedTime support for Dates.TimeType

0 commit comments

Comments
 (0)