PG_RESTORE(1) PostgreSQL 18.6 Documentation PG_RESTORE(1) (NAME) pg_restore - PostgreSQL pg_dump (SYNOPSIS) pg_restore [connection-option...] [option...] [filename] (DESCRIPTION) pg_restore PostgreSQL pg_dump(1) . . pg_restore . . pg_restore . pg_restore . SQL . pg_dump . pg_dump . pg_restore . " INSERT" pg_restore COPY . (dump) (superusers) . . SQL . --file pg_restore . . pg_restore . filename ( ) . . -a --data-only ( ) . (large objects) . --section=data . -c --clean DROP . . --if-exists . -C --create . --clean . --create pg_restore (comment) ( ) ALTER DATABASE ... SET ... ALTER ROLE ... IN DATABASE ... SET ... . --no-acl . -d DROP DATABASE CREATE DATABASE . . -d dbname --dbname=dbname dbname . dbname (connection string) . . -e --exit-on-error SQL . . -f filename --file=filename -l . stdout - . -F format --format=format . pg_restore . : c custom (custom) pg_dump . d directory (directory) . t tar tar . -I index --index=index (index) . -I . -j number-of-jobs --jobs=number-of-jobs pg_restore -- -- number-of-jobs . . . (job) (thread) . . CPU . CPU . (thrashing) . custom directory . ( pipe ). --single-transaction . -l --list . -L . -n -t -l . -L list-file --use-list=list-file list-file . -n -t -L . list-file -l . (;) . . -n schema --schema=schema (schema) . -n . -t . -N schema --exclude-schema=schema . -N . -n -N -N . -O --no-owner . pg_restore ALTER OWNER SET SESSION AUTHORIZATION . (superuser) ( ) . -O . -P function-name(argtype [, ...]) --function=function-name(argtype [, ...]) . . -P . -R --no-reconnect . -s --schema-only ( ) . --data-only --statistics-only . --section=pre-data --section=post-data --no-statistics. ( --schema "schema" .) -S username --superuser=username (superuser) . --disable-triggers . -t table --table=table / . "table" (views) (materialized views) (sequences) (foreign tables) . -t . -n () . -t pg_restore () . . -t pg_dump . (wildcard) pg_restore -t . -t pg_dump ( ) () -t pg_restore . PostgreSQL 9.6 (relation) . -T trigger --trigger=trigger . -T . -v --verbose (verbose) . pg_restore / . (debug) . -V --version pg_restore . -x --no-privileges --no-acl ( grant/revoke) . -1 --single-transaction ( BEGIN/COMMIT ). . --exit-on-error . --disable-triggers (schema) . pg_restore . . --disable-triggers (superuser) . superuser -S pg_restore superuser PostgreSQL . --enable-row-security (row security) . pg_restore row_security off . row security . pg_restore row_security on row security . . INSERT COPY FROM row security . --filter=filename . -n/--schema -N/--exclude-schema -P/--function -I/--index (indexes) -t/--table -T/--trigger . STDIN - . --filter . : { include | exclude } { function | index | schema | table | trigger } PATTERN (include) (exclude) . : o function: -P/--function . include . o index: -I/--indexes . include . o schema: -n/--schema -N/--exclude-schema . o table: -t/--table . include . o trigger: -T/--trigger . include . # () . . . (quoting) Patterns . --if-exists DROP ... IF EXISTS --clean . "does not exist" . --clean . --no-comments (comments) . --no-data . --no-data-for-failed-tables ( ). . . PostgreSQL PostGIS . SQL. --no-policies (row security policies) . --no-publications (publications) . --no-schema ( ) . --no-security-labels . --no-statistics (statistics) . --no-subscriptions (subscriptions) . --no-table-access-method (table access methods) . . --no-tablespaces tablespace . tablespace . --restrict-key=restrict_key \restrict psql dump . SQL --file . pg_restore . . ( dump) . psql dump . --section=sectionname . pre-data data post-data . . . data (large-object) . post-data (indexes) (triggers) (rules) (constraints) check . pre-data . --statistics (statistics) . . --statistics-only ( ) . --strict-names (-n/--schema) (-t/--table) / . --transaction-size=N N . --exit-on-error . --transaction-size ( SQL) -1/--single-transaction ( ) . --single-transaction (overhead) (lock table space) . --transaction-size . --use-set-session-authorization ALTER OWNER SQL SET SESSION AUTHORIZATION . dump dump . -? --help pg_restore . pg_restore : -h host --host=host . () Unix domain socket . PGHOST Unix domain socket . -p port --port=port TCP Unix domain socket . PGPORT . -U username --username=username . -w --no-password . .pgpass . (batch jobs) . -W --password pg_restore . pg_restore . pg_restore . -W . --role=rolename . pg_restore SET ROLE rolename . ( -U) pg_restore . . (ENVIRONMENT) PGHOST PGOPTIONS PGPORT PGUSER PG_COLOR . always auto never. PostgreSQL libpq ( 32.15 ). PGDATABASE . (DIAGNOSTICS) -d pg_restore SQL . pg_restore psql(1) . libpq . (NOTES) template1 pg_restore . template1 template0 : CREATE DATABASE foo WITH TEMPLATE template0; pg_restore . o --disable-triggers pg_restore . . o pg_restore (large objects) . -L -t . pg_dump pg_dump(1) . (dump) pg_restore . ANALYZE 24.1.3 24.1.6 ..SH " (EXAMPLES)" mydb (custom-format) : $ pg_dump -Fc mydb > db.dump : $ dropdb mydb $ pg_restore -C -d postgres db.dump -d pg_restore CREATE DATABASE mydb . -C . newdb: $ createdb -T template0 newdb $ pg_restore -d newdb db.dump -C . template0 template1 . (table of contents) : $ pg_restore -l db.dump > db.list : ; ; Archive created at Mon Sep 14 13:55:39 2009 ; dbname: DBDEMOS ; TOC Entries: 81 ; Compression: 9 ; Dump Version: 1.10-0 ; Format: CUSTOM ; Integer: 4 bytes ; Offset: 8 bytes ; Dumped from database version: 8.3.5 ; Dumped by pg_dump version: 8.3.8 ; ; ; Selected TOC Entries: ; 3; 2615 2200 SCHEMA - public pasha 1861; 0 0 COMMENT - SCHEMA public pasha 1862; 0 0 ACL - public pasha 317; 1247 17715 TYPE public composite pasha 319; 1247 25899 DOMAIN public domain0 pasha (;) (internal archive ID) . . : 10; 145433 TABLE map_resolutions postgres ;2; 145344 TABLE species postgres ;4; 145359 TABLE nt_header postgres 6; 145402 TABLE species_records postgres ;8; 145416 TABLE ss_old postgres pg_restore 10 6 : $ pg_restore -L db.list db.dump pg_dump(1), pg_dumpall(1), psql(1) PostgreSQL 18.6 2026 PG_RESTORE(1)