From 6964764fb4b31cbb06c016afe6c5762ed4d9fba5 Mon Sep 17 00:00:00 2001 From: Dimitri Fontaine Date: Sun, 19 Nov 2017 17:12:21 +0100 Subject: [PATCH] Find schema names unquoted. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When doing a MySQL to PostgreSQL migration in data only mode, pgloader matches schema names found on both source and target database, and much like with table names must do so ensuring unquoted schema names. Otherwise we fail to find the schema name again, because one spelling has the quotes, but not the other one, when using the “quote identifiers” option. Fix #659, at least some forms of it. --- src/pgsql/merge-catalogs.lisp | 2 +- src/pgsql/pgsql-schema.lisp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pgsql/merge-catalogs.lisp b/src/pgsql/merge-catalogs.lisp index f082ef6..9e437e2 100644 --- a/src/pgsql/merge-catalogs.lisp +++ b/src/pgsql/merge-catalogs.lisp @@ -26,7 +26,7 @@ ;; MySQL schema map to PostgreSQL databases, so we might ;; have NIL as a schema name here. Find the current ;; PostgreSQL schema instead of NIL. - (or (schema-name source-schema) + (or (ensure-unquoted (schema-name source-schema)) (pomo:query "select current_schema()" :single))) (target-schema (find-schema target-catalog schema-name))) diff --git a/src/pgsql/pgsql-schema.lisp b/src/pgsql/pgsql-schema.lisp index 1e34f85..8a6f3ad 100644 --- a/src/pgsql/pgsql-schema.lisp +++ b/src/pgsql/pgsql-schema.lisp @@ -71,7 +71,7 @@ (loop :for table :in (append (table-list catalog) (view-list catalog)) :do (let* ((schema-name - (or (schema-name (table-schema table)) + (or (ensure-unquoted (schema-name (table-schema table))) current-schema (setf current-schema (pomo:query "select current_schema()" :single))))