From 08fc7fd092668e113b725565152cd7ea233e5715 Mon Sep 17 00:00:00 2001 From: Dimitri Fontaine Date: Thu, 2 Oct 2014 01:17:24 +0200 Subject: [PATCH] Square brackets around source field options are now mandatory. --- pgloader.1 | 2 +- pgloader.1.md | 2 +- src/parsers/parser.lisp | 2 +- test/archive.load | 10 +++++----- test/csv-nulls.load | 2 +- test/xzero.load | Bin 1271 -> 1275 bytes 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/pgloader.1 b/pgloader.1 index 6157c3a..b764fe1 100644 --- a/pgloader.1 +++ b/pgloader.1 @@ -775,7 +775,7 @@ How many bytes to read from the \fIstart\fR position to read that field\'s value .IP "" 0 . .IP -Those optional parameters can enclosed in square brackets and comma\-separated: +Those optional parameters must be enclosed in square brackets and comma\-separated: . .IP "\(bu" 4 \fIterminated by\fR diff --git a/pgloader.1.md b/pgloader.1.md index 16558bd..065a9cd 100644 --- a/pgloader.1.md +++ b/pgloader.1.md @@ -668,7 +668,7 @@ The `fixed` format command accepts the following clauses and options: How many bytes to read from the *start* position to read that field's value. Same format as *start*. - Those optional parameters can enclosed in square brackets and + Those optional parameters must be enclosed in square brackets and comma-separated: - *terminated by* diff --git a/src/parsers/parser.lisp b/src/parsers/parser.lisp index 7003b03..de04843 100644 --- a/src/parsers/parser.lisp +++ b/src/parsers/parser.lisp @@ -1743,7 +1743,7 @@ load database (declare (ignore open close)) (alexandria:alist-plist `(,opt1 ,@opts))))) -(defrule csv-field-options (? (or csv-field-option csv-field-option-list))) +(defrule csv-field-options (? csv-field-option-list)) (defrule csv-raw-field-name (and (or #\_ (alpha-char-p character)) (* (or (alpha-char-p character) diff --git a/test/archive.load b/test/archive.load index d02b2d7..8f39d0b 100644 --- a/test/archive.load +++ b/test/archive.load @@ -19,13 +19,13 @@ LOAD ARCHIVE ( locId, country, - region null if blanks, - city null if blanks, - postalCode null if blanks, + region [ null if blanks ], + city [ null if blanks ], + postalCode [ null if blanks ], latitude, longitude, - metroCode null if blanks, - areaCode null if blanks + metroCode [ null if blanks ], + areaCode [ null if blanks ] ) INTO postgresql:///ip4r?geolite.location ( diff --git a/test/csv-nulls.load b/test/csv-nulls.load index 5601834..ebaddc9 100644 --- a/test/csv-nulls.load +++ b/test/csv-nulls.load @@ -1,5 +1,5 @@ LOAD CSV - FROM INLINE (id, number null if '\N', data) + FROM INLINE (id, number [null if '\N'], data) INTO postgresql:///pgloader?nullif BEFORE LOAD DO diff --git a/test/xzero.load b/test/xzero.load index 9fc84da8d7fa99afb76516e3be6bf3f4a282c819..85be1074196db63ffe02d95cb2c5812f3f1979dd 100644 GIT binary patch delta 28 jcmey)`I~dYZbtrSg}l<79EHp@1$72>h1ku<7!8>LnJEcA delta 24 fcmey(`JHpaZbt6B(wrQH%rpgc2KCLS7!8>LctZ$A