Review misleading error message with schema not found.

It might be that the schema exists but we didn't find what we expected to
in there, so that it didn't make it to pgloader's internal catalogs. Be
friendly to the user with a better error message.

Fix #713.
This commit is contained in:
Dimitri Fontaine 2018-01-25 23:29:36 +01:00
parent a603cd8882
commit 5ba42edb0c

View File

@ -32,8 +32,15 @@
(find-schema target-catalog schema-name)))
(unless target-schema
(error "pgloader failed to find schema ~s in target catalog"
schema-name))
;; it could be that we found nothing in the schema because of
;; including/excluding rules, or that the schema doesn't
;; exists, let's double check
(let ((schema-list (list-schemas)))
(if (member schema-name schema-list :test #'string=)
(error "pgloader failed to find anything in schema ~s in target catalog."
schema-name)
(error "pgloader failed to find schema ~s in target catalog."
schema-name))))
(loop :for source-table :in (schema-table-list source-schema)
:for target-table := (find-table target-schema