mirror of
https://github.com/dimitri/pgloader.git
synced 2026-05-04 18:36:12 +02:00
Accept even more ragged date format input.
When parsing a date string from a date format, accept that the ms or us part be completely missing, rather than just missing some digits. Fixed #828.
This commit is contained in:
parent
5119d864f4
commit
d356bd501b
@ -38,11 +38,12 @@
|
||||
:for ragged-end := (when end
|
||||
(cond ((member name '(:msecs :usecs))
|
||||
;; take any number of digits up to
|
||||
;; the specified field lenght
|
||||
;; the specified field length
|
||||
;; (less digits are allowed)
|
||||
(min end (length date-string)))
|
||||
(when (<= start (length date-string))
|
||||
(min end (length date-string))))
|
||||
(t end)))
|
||||
:when (and start end)
|
||||
:when (and start ragged-end)
|
||||
:append (list name (subseq date-string start ragged-end)))
|
||||
(if (or (string= year "0000")
|
||||
(string= month "00")
|
||||
|
||||
@ -28,3 +28,4 @@ LOAD CSV
|
||||
1,10-02-1999 00-33-12.123456,"00:05.02"
|
||||
2,10-02-2014 00-33-13.123,"18:25.52"
|
||||
3,10-02-2014 00-33-14.1234,13:14.15
|
||||
4,10-09-2018 19-24-59,19:24.59
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
1 1999-10-02 00:33:12.123456+02 00:05:02
|
||||
2 2014-10-02 00:33:13.123+02 18:25:52
|
||||
3 2014-10-02 00:33:14.1234+02 13:14:15
|
||||
4 2018-10-09 19:24:59+02 19:24:59
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user