Skip to content

Commit

Permalink
Apply quoting rules to SQLite index column names.
Browse files Browse the repository at this point in the history
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 dimitri#872 for real this time.
  • Loading branch information
dimitri committed Dec 1, 2018
1 parent a939d20 commit af2995b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
4 changes: 1 addition & 3 deletions src/pgsql/pgsql-ddl.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
2 changes: 1 addition & 1 deletion src/sources/sqlite/sqlite-schema.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down

0 comments on commit af2995b

Please sign in to comment.