postgresql - PG_restore. What does it do? -
i read these docs:
description
pg_restore utility restoring postgresql database archive created pg_dump in 1 of non-plain-text formats. issue commands necessary reconstruct database state in @ time saved. archive files allow pg_restore selective restored, or reorder items prior being restored. archive files designed portable across architectures.
pg_restore can operate in 2 modes. if database name specified, pg_restore connects database , restores archive contents directly database. otherwise, script containing sql commands necessary rebuild database created , written file or standard output. script output equivalent plain text output format of pg_dump. of options controlling output therefore analogous pg_dump options.
obviously, pg_restore cannot restore information not present in archive file. instance, if archive made using "dump data insert commands" option, pg_restore not able load data using copy statements.
but it's still unclear me if pg_restore loads database data or if creates structure of database too.
it depends on options pass, , in stored information in dump. if keep reading through documentation see option:
--data-only restore data, not schema (data definitions). table data, large objects, , sequence values restored, if present in archive. option similar to, historical reasons not identical to, specifying --section=data.
that allowing restore schema no data.