Hi everyone at postgres.
Talking about version 9.5/9.6 (recent updates)
I have a problem with pg_dump / pg_restore
around the tablespaces.
Running pg_restore like:
pg_restore --clean --create --no-tablespaces
Did fail on CREATE DATABASE (in TABLESPACE ....),
because that statement needed the tablespace to exists upfront.
---
I'd say this is a bug in pg_restore.
When invoking pg_restore with the option --no-tablespaces
the statement: CREATE DATABASE
should create the database in the current table space,
ignoring any table space designation from the export.