From 75727df72fc3bb64286587989e4ca5a4b7f80822 Mon Sep 17 00:00:00 2001 From: Dimitri Fontaine Date: Tue, 25 Aug 2015 01:13:19 +0200 Subject: [PATCH] Quote table names when migrating from SQLite, fix #281. Apparently I just forgot to apply any smartness whatsoever to SQLite identifiers and just copied them as they are to PostgreSQL. Change that by calling apply-identifier-case. --- src/sources/sqlite/sqlite.lisp | 5 +++-- test/sqlite/sqlite.db | Bin 73728 -> 77824 bytes 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/sources/sqlite/sqlite.lisp b/src/sources/sqlite/sqlite.lisp index 61703d5..e086e03 100644 --- a/src/sources/sqlite/sqlite.lisp +++ b/src/sources/sqlite/sqlite.lisp @@ -16,6 +16,7 @@ (defmethod open-connection ((slconn sqlite-connection) &key) (setf (conn-handle slconn) (sqlite:connect (fd-path slconn))) + (log-message :debug "CONNECTED TO ~a" (fd-path slconn)) slconn) (defmethod close-connection ((slconn sqlite-connection)) @@ -235,7 +236,7 @@ (truncate (truncate-tables (target-db sqlite) (mapcar #'car all-columns)))) - (cl-postgres::database-errror (e) + (cl-postgres:database-error (e) (declare (ignore e)) ; a log has already been printed (log-message :fatal "Failed to create the schema, see above.") (return-from copy-database))) @@ -248,7 +249,7 @@ :source-db (source-db sqlite) :target-db (target-db sqlite) :source table-name - :target table-name + :target (apply-identifier-case table-name) :fields columns))) ;; first COPY the data from SQLite to PostgreSQL, using copy-kernel (unless schema-only diff --git a/test/sqlite/sqlite.db b/test/sqlite/sqlite.db index 8ada41f7337742d487fec5710609b4d7cde60b4b..1e31b944854872fcb2fe7e5996e2f05af8a86f51 100644 GIT binary patch delta 222 zcmZoTz|!!5WrDPz0s{ksFc8B4|3n>QWd#P^N2+=Ci2yr8HBS_^Vpf08AP*-GK<-mfC5SRNoR delta 92 zcmZp8z|wGlWrDPz90LP`5D>!v-$Wf_ML7oDN2+=Ci2z-{i$(L5_Rb1?D0Vc`GD|7Nq`f(QJY-<%f-005X`8C3uP