Fix catalog merge hasards.

When reading table names from PostgreSQL, we might find some that need
systematic quoting (such as names that begin with a digit). In that case,
when later comparing the catalogs to match source database table names
against PostgreSQL catalog table names, we need to unquote the PostgreSQL
table name we are using.

In passing, force the *identifier-case* to :none when reading object names
from the PostgreSQL catalogs.
This commit is contained in:
Dimitri Fontaine 2017-02-25 17:50:25 +01:00
parent 96b2af6b2a
commit 5fd1e9f3aa
2 changed files with 4 additions and 2 deletions

View File

@ -37,7 +37,8 @@
(loop :for source-table :in (schema-table-list source-schema)
:for target-table := (find-table target-schema
(table-name source-table))
(ensure-unquoted
(table-name source-table)))
:do (if target-table
(progn
;; re-use indexes and fkeys from target-catalog

View File

@ -8,7 +8,8 @@
&key table source-catalog including excluding)
"Fetch PostgreSQL catalogs for the target database. A PostgreSQL
connection must be opened."
(let* ((catalog (make-catalog :name dbname))
(let* ((*identifier-case* :none)
(catalog (make-catalog :name dbname))
(including (cond ((and table (not including))
(make-including-expr-from-table table))