Yun Guo wrote:
>>> I use this command to dump schema:
>>> pg_dump -s -n test polling_etl > file.sql
>>>
>>> However, the file.sql file includes creation of all the objects in
>>> schema test, but not the creation of test schema itself.
>>> polling_etl=# \dn+ test
>>> List of schemas
>>> Name | Owner | Access privileges | Description
>>> ------+-------+-------------------+-------------
>>> test | test | test=UC/test +|
>>> | | pb_writer=UC/test+|
>>> | | =U/test +|
>>> | | postgres=U*C/test |
> I tried again. It¹s still not dumping CREATE SCHEMA. And weirdly it would
> work for some other schemas in the same database.
>
> -bash-4.1$ pg_dump -s -n test polling_etl | grep 'CREATE SCHEMA'
> -bash-4.1$ pg_dump -s -n test2 polling_etl | grep 'CREATE SCHEMA'
> CREATE SCHEMA test2;
That is disturbing.
Does the schema show up in a custom format dump?
pg_dump -s -n test -Fc polling_etl | pg_restore -l
Yours,
Laurenz Albe