Fix fixed-file column name quoting, as we did for CSV, fixes #70.

This commit is contained in:
Dimitri Fontaine 2014-06-29 16:25:30 +02:00
parent 6a7f3c2417
commit 55655ed927
2 changed files with 21 additions and 18 deletions

View File

@ -116,7 +116,10 @@
;; this function update :rows stats ;; this function update :rows stats
#'pgloader.pgsql:copy-from-queue dbname table-name queue #'pgloader.pgsql:copy-from-queue dbname table-name queue
;; we only are interested into the column names here ;; we only are interested into the column names here
:columns (mapcar #'car (columns fixed)) :columns (mapcar (lambda (col)
;; always double quote column names
(format nil "~s" (car col)))
(columns fixed))
:truncate truncate) :truncate truncate)
;; now wait until both the tasks are over ;; now wait until both the tasks are over

View File

@ -9,7 +9,7 @@ LOAD ARCHIVE
usps char(2) not null, usps char(2) not null,
fips char(2) not null, fips char(2) not null,
fips_code char(5), fips_code char(5),
loc_name varchar(64) "LocationName" varchar(64)
); );
$$ $$
@ -21,7 +21,7 @@ LOAD ARCHIVE
usps 0 2, usps 0 2,
fips 2 2, fips 2 2,
fips_code 4 5, fips_code 4 5,
loc_name 9 64, "LocationName" 9 64,
p 73 9, p 73 9,
h 82 9, h 82 9,
land 91 14, land 91 14,
@ -34,5 +34,5 @@ LOAD ARCHIVE
INTO postgresql:///pgloader?places INTO postgresql:///pgloader?places
( (
usps, fips, fips_code, usps, fips, fips_code,
loc_name text using (right-trim loc_name) "LocationName" text using (right-trim LocationName)
); );