From af2995b91804aa52e90f3845b8a46cd46ac66504 Mon Sep 17 00:00:00 2001 From: Dimitri Fontaine Date: Sun, 2 Dec 2018 00:17:26 +0100 Subject: [PATCH] Apply quoting rules to SQLite index column names. The previous fix was wrong for missing the point: rather than unquote column names in the table definition when matching the column names in the index definition, we should in the first place have quoted the index column names when needed. Fixes #872 for real this time. --- src/pgsql/pgsql-ddl.lisp | 4 +--- src/sources/sqlite/sqlite-schema.lisp | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/pgsql/pgsql-ddl.lisp b/src/pgsql/pgsql-ddl.lisp index 008fe7d..662bc95 100644 --- a/src/pgsql/pgsql-ddl.lisp +++ b/src/pgsql/pgsql-ddl.lisp @@ -266,9 +266,7 @@ :collect (column-type-name (find idx-col tbl-cols :test #'string-equal - :key (lambda (col) - (ensure-unquoted - (column-name col))))))) + :key #'column-name)))) (nobtree (catalog-types-without-btree (schema-catalog (table-schema (index-table index)))))) (let* ((idx-type (first idx-types)) diff --git a/src/sources/sqlite/sqlite-schema.lisp b/src/sources/sqlite/sqlite-schema.lisp index 7174fea..17f05ba 100644 --- a/src/sources/sqlite/sqlite-schema.lisp +++ b/src/sources/sqlite/sqlite-schema.lisp @@ -150,7 +150,7 @@ "Return the list of columns in INDEX-NAME." (let ((sql (format nil (sql "/sqlite/list-index-cols.sql") index-name))) (loop :for (index-pos table-pos col-name) :in (sqlite:execute-to-list db sql) - :collect col-name))) + :collect (apply-identifier-case col-name)))) (defun list-indexes (table &optional (db *sqlite-db*)) "Return the list of indexes attached to TABLE."