Review field to column projection code emitted.

The code emitted by pgloader to transform input fields into PostgreSQL
column values was using too many optimization declarations, some of them
that SBCL failed to follow through for lack of type marking in the generated
code.

As SBCL doesn't have enough information to be optimizing anyway, at least we
can make it so that we don't have a warning about it. The new code does that.

Fixes #803.
This commit is contained in:
Dimitri Fontaine 2018-11-10 20:22:04 +01:00
parent 6eaad0621b
commit 656bf85075
2 changed files with 3 additions and 3 deletions

View File

@ -20,7 +20,6 @@
nil
col))
(lambda (col)
(declare (optimize speed))
(if (string= null-as col) nil col))))
(field-name-as-symbol (field-name-or-list)
@ -120,7 +119,8 @@
(destructuring-bind (&optional ,@args &rest extra) row
(declare (ignorable ,@args) (ignore extra))
(let ,values
(declare (ignorable ,@args))
(declare (ignorable ,@args)
(type vector ,@args))
(vector ,@newrow)))))))))
;; allow for some debugging
(if compile (compile nil projection) projection))))

View File

@ -13,7 +13,7 @@
LOAD CSV
FROM inline (a, b, c)
INTO postgresql:///pgloader?allcols (a, b, c)
INTO postgresql:///pgloader?allcols (a, b, c text using (subseq c 0))
WITH fields optionally enclosed by '"',
fields escaped by double-quote,