From 656bf850752ab06435870d2e68696ff12a285362 Mon Sep 17 00:00:00 2001 From: Dimitri Fontaine Date: Sat, 10 Nov 2018 20:22:04 +0100 Subject: [PATCH] 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. --- src/sources/common/project-fields.lisp | 4 ++-- test/allcols.load | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/sources/common/project-fields.lisp b/src/sources/common/project-fields.lisp index 0ab57ff..f82d46c 100644 --- a/src/sources/common/project-fields.lisp +++ b/src/sources/common/project-fields.lisp @@ -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)))) diff --git a/test/allcols.load b/test/allcols.load index e5c4e29..2598466 100644 --- a/test/allcols.load +++ b/test/allcols.load @@ -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,