Find schema names unquoted.

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.
This commit is contained in:
Dimitri Fontaine 2017-11-19 17:12:21 +01:00
parent 1d7706c045
commit 6964764fb4
2 changed files with 2 additions and 2 deletions

View File

@ -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)))

View File

@ -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))))