{"Entry":{"collection":"tool","key":"pg-dump","name":"pg_dump","aliases":["pg_dump"],"metadata":{"aliases":["pg_dump"],"category":"Client applications","content_hash":"c2dd35a94adb46b5c132ee33391b6b068e814d594cc6847dce93b76cf632698b","imported_at":"2026-09-30T00:40:34.17845+08:00","name":"pg_dump","name_zh":"","slug":"pg-dump","summary":"pg_dump — export a PostgreSQL database as an SQL script or to other formats"}},"Definition":{"Collection":"tool","Key":"pg-dump","SourceDatabase":"center","Version":"18","SourceTable":"command_tool","SourceKey":"pg-dump","SourceRevision":"ee8d1a3612338fd9adf250730cb640fcc5233b5491337cc00a316a44e3a0b9f8","Facts":{"comparison_data":{"environment":[{"description":"Default connection parameters.","name":"PGDATABASE PGHOST PGOPTIONS PGPORT PGUSER"},{"description":"Specifies whether to use color in diagnostic messages. Possible values are always , auto and never .","name":"PG_COLOR"}],"options":[{"description":"Dump only the data, not the schema (data definitions) or statistics. Table data, large objects, and sequence values are dumped. This option is similar to, but for historical reasons not identical to, specifying --section=data .","names":["-a","--data-only"],"signature":"-a --data-only"},{"description":"Include large objects in the dump. This is the default behavior except when --schema , --table , --schema-only , --statistics-only , or --no-data is specified. The -b switch is therefore only useful to add large objects to dumps where a specific schema or table has been requested. Note that large objects are considered data and therefore will be included when --data-only is used, but not when --schema-only or --statistics-only is.","names":["-b","--large-objects","--blobs"],"signature":"-b --large-objects --blobs (deprecated)"},{"description":"Exclude large objects in the dump. When both -b and -B are given, the behavior is to output large objects, when data is being dumped, see the -b documentation.","names":["-B","--no-large-objects","--no-blobs"],"signature":"-B --no-large-objects --no-blobs (deprecated)"},{"description":"Output commands to DROP all the dumped database objects prior to outputting the commands for creating them. This option is useful when the restore is to overwrite an existing database. If any of the objects do not exist in the destination database, ignorable error messages will be reported during restore, unless --if-exists is also specified. This option is ignored when emitting an archive (non-text) output file. For the archive formats, you can specify the option when you call pg_restore .","names":["-c","--clean"],"signature":"-c --clean"},{"description":"Begin the output with a command to create the database itself and reconnect to the created database. (With a script of this form, it doesn't matter which database in the destination installation you connect to before running the script.) If --clean is also specified, the script drops and recreates the target database before reconnecting to it. With --create , the output also includes the database's comment if any, and any configuration variable settings that are specific to this database, that is, any ALTER DATABASE ... SET ... and ALTER ROLE ... IN DATABASE ... SET ... commands that mention this database. Access privileges for the database itself are also dumped, unless --no-acl is specified. This option is ignored when emitting an archive (non-text) output file. For the archive formats, you can specify the option when you call pg_restore .","names":["-C","--create"],"signature":"-C --create"},{"description":"Dump only extensions matching pattern . When this option is not specified, all non-system extensions in the target database will be dumped. Multiple extensions can be selected by writing multiple -e switches. The pattern parameter is interpreted as a pattern according to the same rules used by psql 's \\d commands (see Patterns ), so multiple extensions can also be selected by writing wildcard characters in the pattern. When using wildcards, be careful to quote the pattern if needed to prevent the shell from expanding the wildcards. Any configuration relation registered by pg_extension_config_dump is included in the dump if its extension is specified by --extension . Note When -e is specified, pg_dump makes no attempt to dump any other database objects that the selected extension(s) might depend upon. Therefore, there is no guarantee that the results of a specific-extension dump can be successfully restored by themselves into a clean database.","names":["-e pattern","--extension= pattern"],"signature":"-e pattern --extension= pattern"},{"description":"Create the dump in the specified character set encoding. By default, the dump is created in the database encoding. (Another way to get the same result is to set the PGCLIENTENCODING environment variable to the desired dump encoding.) The supported encodings are described in Section 23.3.1 .","names":["-E encoding","--encoding= encoding"],"signature":"-E encoding --encoding= encoding"},{"description":"Send output to the specified file. This parameter can be omitted for file based output formats, in which case the standard output is used. It must be given for the directory output format however, where it specifies the target directory instead of a file. In this case the directory is created by pg_dump and must not exist before.","names":["-f file","--file= file"],"signature":"-f file --file= file"},{"description":"Selects the format of the output. format can be one of the following: p plain Output a plain-text SQL script file (the default). c custom Output a custom-format archive suitable for input into pg_restore . Together with the directory output format, this is the most flexible output format in that it allows manual selection and reordering of archived items during restore. This format is also compressed by default. d directory Output a directory-format archive suitable for input into pg_restore . This will create a directory with one file for each table and large object being dumped, plus a so-called Table of Contents file describing the dumped objects in a machine-readable format that pg_restore can read. A directory format archive can be manipulated with standard Unix tools; for example, files in an uncompressed archive can be compressed with the gzip , lz4 , or zstd tools. This format is compressed by default using gzip and also supports parallel dumps. t tar Output a tar -format archive suitable for input into pg_restore . The tar format is compatible with the directory format: extracting a tar-format archive produces a valid directory-format archive. However, the tar format does not support compression. Also, when using tar format the relative order of table data items cannot be changed during restore.","names":["-F format","--format= format"],"signature":"-F format --format= format"},{"description":"Run the dump in parallel by dumping njobs tables simultaneously. This option may reduce the time needed to perform the dump but it also increases the load on the database server. You can only use this option with the directory output format because this is the only output format where multiple processes can write their data at the same time. pg_dump will open njobs + 1 connections to the database, so make sure your max_connections setting is high enough to accommodate all connections. Requesting exclusive locks on database objects while running a parallel dump could cause the dump to fail. The reason is that the pg_dump leader process requests shared locks ( ACCESS SHARE ) on the objects that the worker processes are going to dump later in order to make sure that nobody deletes them and makes them go away while the dump is running. If another client then requests an exclusive lock on a table, that lock will not be granted but will be queued waiting for the shared lock of the leader process to be released. Consequently any other access to the table will not be granted either and will queue after the exclusive lock request. This includes the worker process trying to dump the table. Without any precautions this would be a classic deadlock situation. To detect this conflict, the pg_dump worker process requests another shared lock using the NOWAIT option. If the worker process is not granted this shared lock, somebody else must have requested an exclusive lock in the meantime and there is no way to continue with the dump, so pg_dump has no choice but to abort the dump. To perform a parallel dump, the database server needs to support synchronized snapshots, a feature that was introduced in PostgreSQL 9.2 for primary servers and 10 for standbys. With this feature, database clients can ensure they see the same data set even though they use different connections. pg_dump -j uses multiple database connections; it connects to the database once with the leader process and once again for each worker job. Without the synchronized snapshot feature, the different worker jobs wouldn't be guaranteed to see the same data in each connection, which could lead to an inconsistent backup.","names":["-j njobs","--jobs= njobs"],"signature":"-j njobs --jobs= njobs"},{"description":"Dump only schemas matching pattern ; this selects both the schema itself, and all its contained objects. When this option is not specified, all non-system schemas in the target database will be dumped. Multiple schemas can be selected by writing multiple -n switches. The pattern parameter is interpreted as a pattern according to the same rules used by psql 's \\d commands (see Patterns ), so multiple schemas can also be selected by writing wildcard characters in the pattern. When using wildcards, be careful to quote the pattern if needed to prevent the shell from expanding the wildcards; see Examples below. Note When -n is specified, pg_dump makes no attempt to dump any other database objects that the selected schema(s) might depend upon. Therefore, there is no guarantee that the results of a specific-schema dump can be successfully restored by themselves into a clean database. Note Non-schema objects such as large objects are not dumped when -n is specified. You can add large objects back to the dump with the --large-objects switch.","names":["-n pattern","--schema= pattern"],"signature":"-n pattern --schema= pattern"},{"description":"Do not dump any schemas matching pattern . The pattern is interpreted according to the same rules as for -n . -N can be given more than once to exclude schemas matching any of several patterns. When both -n and -N are given, the behavior is to dump just the schemas that match at least one -n switch but no -N switches. If -N appears without -n , then schemas matching -N are excluded from what is otherwise a normal dump.","names":["-N pattern","--exclude-schema= pattern"],"signature":"-N pattern --exclude-schema= pattern"},{"description":"Do not output commands to set ownership of objects to match the original database. By default, pg_dump issues ALTER OWNER or SET SESSION AUTHORIZATION statements to set ownership of created database objects. These statements will fail when the script is run unless it is started by a superuser (or the same user that owns all of the objects in the script). To make a script that can be restored by any user, but will give that user ownership of all the objects, specify -O . This option is ignored when emitting an archive (non-text) output file. For the archive formats, you can specify the option when you call pg_restore .","names":["-O","--no-owner"],"signature":"-O --no-owner"},{"description":"This option is obsolete but still accepted for backwards compatibility.","names":["-R","--no-reconnect"],"signature":"-R --no-reconnect"},{"description":"Dump only the object definitions (schema), not data or statistics. This option cannot be used with --data-only or --statistics-only . It is similar to, but for historical reasons not identical to, specifying --section=pre-data --section=post-data . (Do not confuse this with the --schema option, which uses the word “ schema ” in a different meaning.) To exclude table data for only a subset of tables in the database, see --exclude-table-data .","names":["-s","--schema-only"],"signature":"-s --schema-only"},{"description":"Specify the superuser user name to use when disabling triggers. This is relevant only if --disable-triggers is used. (Usually, it's better to leave this out, and instead start the resulting script as superuser.)","names":["-S username","--superuser= username"],"signature":"-S username --superuser= username"},{"description":"Dump only tables with names matching pattern . Multiple tables can be selected by writing multiple -t switches. The pattern parameter is interpreted as a pattern according to the same rules used by psql 's \\d commands (see Patterns ), so multiple tables can also be selected by writing wildcard characters in the pattern. When using wildcards, be careful to quote the pattern if needed to prevent the shell from expanding the wildcards; see Examples below. As well as tables, this option can be used to dump the definition of matching views, materialized views, foreign tables, and sequences. It will not dump the contents of views or materialized views, and the contents of foreign tables will only be dumped if the corresponding foreign server is specified with --include-foreign-data . The -n and -N switches have no effect when -t is used, because tables selected by -t will be dumped regardless of those switches, and non-table objects will not be dumped. Note When -t is specified, pg_dump makes no attempt to dump any other database objects that the selected table(s) might depend upon. Therefore, there is no guarantee that the results of a specific-table dump can be successfully restored by themselves into a clean database.","names":["-t pattern","--table= pattern"],"signature":"-t pattern --table= pattern"},{"description":"Do not dump any tables matching pattern . The pattern is interpreted according to the same rules as for -t . -T can be given more than once to exclude tables matching any of several patterns. When both -t and -T are given, the behavior is to dump just the tables that match at least one -t switch but no -T switches. If -T appears without -t , then tables matching -T are excluded from what is otherwise a normal dump.","names":["-T pattern","--exclude-table= pattern"],"signature":"-T pattern --exclude-table= pattern"},{"description":"Specifies verbose mode. This will cause pg_dump to output detailed object comments and start/stop times to the dump file, and progress messages to standard error. Repeating the option causes additional debug-level messages to appear on standard error.","names":["-v","--verbose"],"signature":"-v --verbose"},{"description":"Print the pg_dump version and exit.","names":["-V","--version"],"signature":"-V --version"},{"description":"Prevent dumping of access privileges (grant/revoke commands).","names":["-x","--no-privileges","--no-acl"],"signature":"-x --no-privileges --no-acl"},{"description":"Specify the compression method and/or the compression level to use. The compression method can be set to gzip , lz4 , zstd , or none for no compression. A compression detail string can optionally be specified. If the detail string is an integer, it specifies the compression level. Otherwise, it should be a comma-separated list of items, each of the form keyword or keyword=value . Currently, the supported keywords are level and long . If no compression level is specified, the default compression level will be used. If only a level is specified without mentioning an algorithm, gzip compression will be used if the level is greater than 0 , and no compression will be used if the level is 0 . For the custom and directory archive formats, this specifies compression of individual table-data segments, and the default is to compress using gzip at a moderate level. For plain text output, setting a nonzero compression level causes the entire output file to be compressed, as though it had been fed through gzip , lz4 , or zstd ; but the default is not to compress. With zstd compression, long mode may improve the compression ratio, at the cost of increased memory use. The tar archive format currently does not support compression at all.","names":["-Z level","-Z method","--compress= level","--compress= method"],"signature":"-Z level -Z method [: detail ] --compress= level --compress= method [: detail ]"},{"description":"This option is for use by in-place upgrade utilities. Its use for other purposes is not recommended or supported. The behavior of the option may change in future releases without notice.","names":["--binary-upgrade"],"signature":"--binary-upgrade"},{"description":"Dump data as INSERT commands with explicit column names ( INSERT INTO table ( column , ...) VALUES ... ). This will make restoration very slow; it is mainly useful for making dumps that can be loaded into non- PostgreSQL databases. Any error during restoring will cause only rows that are part of the problematic INSERT to be lost, rather than the entire table contents.","names":["--column-inserts","--attribute-inserts"],"signature":"--column-inserts --attribute-inserts"},{"description":"This option disables the use of dollar quoting for function bodies, and forces them to be quoted using SQL standard string syntax.","names":["--disable-dollar-quoting"],"signature":"--disable-dollar-quoting"},{"description":"This option is relevant only when creating a dump that includes data but does not include schema. It instructs pg_dump to include commands to temporarily disable triggers on the target tables while the data is restored. Use this if you have referential integrity checks or other triggers on the tables that you do not want to invoke during data restore. Presently, the commands emitted for --disable-triggers must be done as superuser. So, you should also specify a superuser name with -S , or preferably be careful to start the resulting script as a superuser. This option is ignored when emitting an archive (non-text) output file. For the archive formats, you can specify the option when you call pg_restore .","names":["--disable-triggers"],"signature":"--disable-triggers"},{"description":"This option is relevant only when dumping the contents of a table which has row security. By default, pg_dump will set row_security to off, to ensure that all data is dumped from the table. If the user does not have sufficient privileges to bypass row security, then an error is thrown. This parameter instructs pg_dump to set row_security to on instead, allowing the user to dump the parts of the contents of the table that they have access to. Note that if you use this option currently, you probably also want the dump be in INSERT format, as the COPY FROM during restore does not support row security.","names":["--enable-row-security"],"signature":"--enable-row-security"},{"description":"Do not dump any extensions matching pattern . The pattern is interpreted according to the same rules as for -e . --exclude-extension can be given more than once to exclude extensions matching any of several patterns. When both -e and --exclude-extension are given, the behavior is to dump just the extensions that match at least one -e switch but no --exclude-extension switches. If --exclude-extension appears without -e , then extensions matching --exclude-extension are excluded from what is otherwise a normal dump.","names":["--exclude-extension= pattern"],"signature":"--exclude-extension= pattern"},{"description":"This is the same as the -T / --exclude-table option, except that it also excludes any partitions or inheritance child tables of the table(s) matching the pattern .","names":["--exclude-table-and-children= pattern"],"signature":"--exclude-table-and-children= pattern"},{"description":"Do not dump data for any tables matching pattern . The pattern is interpreted according to the same rules as for -t . --exclude-table-data can be given more than once to exclude tables matching any of several patterns. This option is useful when you need the definition of a particular table even though you do not need the data in it. To exclude data for all tables in the database, see --schema-only or --statistics-only .","names":["--exclude-table-data= pattern"],"signature":"--exclude-table-data= pattern"},{"description":"This is the same as the --exclude-table-data option, except that it also excludes data of any partitions or inheritance child tables of the table(s) matching the pattern .","names":["--exclude-table-data-and-children= pattern"],"signature":"--exclude-table-data-and-children= pattern"},{"description":"Use the specified value of extra_float_digits when dumping floating-point data, instead of the maximum available precision. Routine dumps made for backup purposes should not use this option.","names":["--extra-float-digits= ndigits"],"signature":"--extra-float-digits= ndigits"},{"description":"Specify a filename from which to read patterns for objects to include or exclude from the dump. The patterns are interpreted according to the same rules as the corresponding options: -t / --table , --table-and-children , -T / --exclude-table , and --exclude-table-and-children for tables, -n / --schema and -N / --exclude-schema for schemas, --include-foreign-data for data on foreign servers, --exclude-table-data and --exclude-table-data-and-children for table data, and -e / --extension and --exclude-extension for extensions. To read from STDIN , use - as the filename. The --filter option can be specified in conjunction with the above listed options for including or excluding objects, and can also be specified more than once for multiple filter files. The file lists one object pattern per row, with the following format: { include | exclude } { extension | foreign_data | table | table_and_children | table_data | table_data_and_children | schema } PATTERN The first keyword specifies whether the objects matched by the pattern are to be included or excluded. The second keyword specifies the type of object to be filtered using the pattern: extension : extensions. This works like the -e / --extension or --exclude-extension option. foreign_data : data on foreign servers. This works like the --include-foreign-data option. This keyword can only be used with the include keyword. table : tables. This works like the -t / --table or -T / --exclude-table option. table_and_children : tables including any partitions or inheritance child tables. This works like the --table-and-children or --exclude-table-and-children option. table_data : table data of any tables matching pattern . This works like the --exclude-table-data option. This keyword can only be used with the exclude keyword. table_data_and_children : table data of any tables matching pattern as well as any partitions or inheritance children of the table(s). This works like the --exclude-table-data-and-children option. This keyword can only be used with the exclude keyword. schema : schemas. This works like the -n / --schema or -N / --exclude-schema option. Lines starting with # are considered comments and ignored. Comments can be placed after an object pattern row as well. Blank lines are also ignored. See Patterns for how to perform quoting in patterns. Example files are listed below in the Examples section.","names":["--filter= filename"],"signature":"--filter= filename"},{"description":"Use DROP ... IF EXISTS commands to drop objects in --clean mode. This suppresses “ does not exist ” errors that might otherwise be reported. This option is not valid unless --clean is also specified.","names":["--if-exists"],"signature":"--if-exists"},{"description":"Dump the data for any foreign table with a foreign server matching foreignserver pattern. Multiple foreign servers can be selected by writing multiple --include-foreign-data switches. Also, the foreignserver parameter is interpreted as a pattern according to the same rules used by psql 's \\d commands (see Patterns ), so multiple foreign servers can also be selected by writing wildcard characters in the pattern. When using wildcards, be careful to quote the pattern if needed to prevent the shell from expanding the wildcards; see Examples below. The only exception is that an empty pattern is disallowed. Note Using wildcards in --include-foreign-data may result in access to unexpected foreign servers. Also, to use this option securely, make sure that the named server must have a trusted owner. Note When --include-foreign-data is specified, pg_dump does not check that the foreign table is writable. Therefore, there is no guarantee that the results of a foreign table dump can be successfully restored.","names":["--include-foreign-data= foreignserver"],"signature":"--include-foreign-data= foreignserver"},{"description":"Dump data as INSERT commands (rather than COPY ). This will make restoration very slow; it is mainly useful for making dumps that can be loaded into non- PostgreSQL databases. Any error during restoring will cause only rows that are part of the problematic INSERT to be lost, rather than the entire table contents. Note that the restore might fail altogether if you have rearranged column order. The --column-inserts option is safe against column order changes, though even slower.","names":["--inserts"],"signature":"--inserts"},{"description":"When dumping data for a table partition, make the COPY or INSERT statements target the root of the partitioning hierarchy that contains it, rather than the partition itself. This causes the appropriate partition to be re-determined for each row when the data is loaded. This may be useful when restoring data on a server where rows do not always fall into the same partitions as they did on the original server. That could happen, for example, if the partitioning column is of type text and the two systems have different definitions of the collation used to sort the partitioning column.","names":["--load-via-partition-root"],"signature":"--load-via-partition-root"},{"description":"Do not wait forever to acquire shared table locks at the beginning of the dump. Instead fail if unable to lock a table within the specified timeout . The timeout may be specified in any of the formats accepted by SET statement_timeout . (Allowed formats vary depending on the server version you are dumping from, but an integer number of milliseconds is accepted by all versions.)","names":["--lock-wait-timeout= timeout"],"signature":"--lock-wait-timeout= timeout"},{"description":"Do not dump COMMENT commands.","names":["--no-comments"],"signature":"--no-comments"},{"description":"Do not dump data.","names":["--no-data"],"signature":"--no-data"},{"description":"Do not dump row security policies.","names":["--no-policies"],"signature":"--no-policies"},{"description":"Do not dump publications.","names":["--no-publications"],"signature":"--no-publications"},{"description":"Do not dump schema (data definitions).","names":["--no-schema"],"signature":"--no-schema"},{"description":"Do not dump security labels.","names":["--no-security-labels"],"signature":"--no-security-labels"},{"description":"Do not dump statistics. This is the default.","names":["--no-statistics"],"signature":"--no-statistics"},{"description":"Do not dump subscriptions.","names":["--no-subscriptions"],"signature":"--no-subscriptions"},{"description":"By default, pg_dump will wait for all files to be written safely to disk. This option causes pg_dump to return without waiting, which is faster, but means that a subsequent operating system crash can leave the dump corrupt. Generally, this option is useful for testing but should not be used when dumping data from production installation.","names":["--no-sync"],"signature":"--no-sync"},{"description":"Do not output commands to select table access methods. With this option, all objects will be created with whichever table access method is the default during restore. This option is ignored when emitting an archive (non-text) output file. For the archive formats, you can specify the option when you call pg_restore .","names":["--no-table-access-method"],"signature":"--no-table-access-method"},{"description":"Do not output commands to select tablespaces. With this option, all objects will be created in whichever tablespace is the default during restore. This option is ignored when emitting an archive (non-text) output file. For the archive formats, you can specify the option when you call pg_restore .","names":["--no-tablespaces"],"signature":"--no-tablespaces"},{"description":"Do not output commands to set TOAST compression methods. With this option, all columns will be restored with the default compression setting.","names":["--no-toast-compression"],"signature":"--no-toast-compression"},{"description":"Do not dump the contents of unlogged tables and sequences. This option has no effect on whether or not the table and sequence definitions (schema) are dumped; it only suppresses dumping the table and sequence data. Data in unlogged tables and sequences is always excluded when dumping from a standby server.","names":["--no-unlogged-table-data"],"signature":"--no-unlogged-table-data"},{"description":"Add ON CONFLICT DO NOTHING to INSERT commands. This option is not valid unless --inserts , --column-inserts or --rows-per-insert is also specified.","names":["--on-conflict-do-nothing"],"signature":"--on-conflict-do-nothing"},{"description":"Force quoting of all identifiers. This option is recommended when dumping a database from a server whose PostgreSQL major version is different from pg_dump 's, or when the output is intended to be loaded into a server of a different major version. By default, pg_dump quotes only identifiers that are reserved words in its own major version. This sometimes results in compatibility issues when dealing with servers of other versions that may have slightly different sets of reserved words. Using --quote-all-identifiers prevents such issues, at the price of a harder-to-read dump script.","names":["--quote-all-identifiers"],"signature":"--quote-all-identifiers"},{"description":"Use the provided string as the psql \\restrict key in the dump output. This can only be specified for plain-text dumps, i.e., when --format is set to plain or the --format option is omitted. If no restrict key is specified, pg_dump will generate a random one as needed. Keys may contain only alphanumeric characters. This option is primarily intended for testing purposes and other scenarios that require repeatable output (e.g., comparing dump files). It is not recommended for general use, as a malicious server with advance knowledge of the key may be able to inject arbitrary code that will be executed on the machine that runs psql with the dump output.","names":["--restrict-key= restrict_key"],"signature":"--restrict-key= restrict_key"},{"description":"Dump data as INSERT commands (rather than COPY ). Controls the maximum number of rows per INSERT command. The value specified must be a number greater than zero. Any error during restoring will cause only rows that are part of the problematic INSERT to be lost, rather than the entire table contents.","names":["--rows-per-insert= nrows"],"signature":"--rows-per-insert= nrows"},{"description":"Only dump the named section. The section name can be pre-data , data , or post-data . This option can be specified more than once to select multiple sections. The default is to dump all sections. The data section contains actual table data, large-object contents, sequence values, and statistics for tables, materialized views, and foreign tables. Post-data items include definitions of indexes, triggers, rules, statistics for indexes, and constraints other than validated check and not-null constraints. Pre-data items include all other data definition items.","names":["--section= sectionname"],"signature":"--section= sectionname"},{"description":"Include sequence data in the dump. This is the default behavior except when --no-data , --schema-only , or --statistics-only is specified.","names":["--sequence-data"],"signature":"--sequence-data"},{"description":"Use a serializable transaction for the dump, to ensure that the snapshot used is consistent with later database states; but do this by waiting for a point in the transaction stream at which no anomalies can be present, so that there isn't a risk of the dump failing or causing other transactions to roll back with a serialization_failure . See Chapter 13 for more information about transaction isolation and concurrency control. This option is not beneficial for a dump which is intended only for disaster recovery. It could be useful for a dump used to load a copy of the database for reporting or other read-only load sharing while the original database continues to be updated. Without it the dump may reflect a state which is not consistent with any serial execution of the transactions eventually committed. For example, if batch processing techniques are used, a batch may show as closed in the dump without all of the items which are in the batch appearing. This option will make no difference if there are no read-write transactions active when pg_dump is started. If read-write transactions are active, the start of the dump may be delayed for an indeterminate length of time. Once running, performance with or without the switch is the same.","names":["--serializable-deferrable"],"signature":"--serializable-deferrable"},{"description":"Use the specified synchronized snapshot when making a dump of the database (see Table 9.100 for more details). This option is useful when needing to synchronize the dump with a logical replication slot (see Chapter 47 ) or with a concurrent session. In the case of a parallel dump, the snapshot name defined by this option is used rather than taking a new snapshot.","names":["--snapshot= snapshotname"],"signature":"--snapshot= snapshotname"},{"description":"Dump optimizer statistics.","names":["--statistics"],"signature":"--statistics"},{"description":"Dump only the statistics, not the schema (data definitions) or data. Optimizer statistics for tables, materialized views, foreign tables, and indexes are dumped.","names":["--statistics-only"],"signature":"--statistics-only"},{"description":"Require that each extension ( -e / --extension ), schema ( -n / --schema ) and table ( -t / --table ) pattern match at least one extension/schema/table in the database to be dumped. This also applies to filters used with --filter . Note that if none of the extension/schema/table patterns find matches, pg_dump will generate an error even without --strict-names . This option has no effect on --exclude-extension , -N / --exclude-schema , -T / --exclude-table , or --exclude-table-data . An exclude pattern failing to match any objects is not considered an error.","names":["--strict-names"],"signature":"--strict-names"},{"description":"When set to fsync , which is the default, pg_dump --format=directory will recursively open and synchronize all files in the archive directory. On Linux, syncfs may be used instead to ask the operating system to synchronize the whole file system that contains the archive directory. See recovery_init_sync_method for information about the caveats to be aware of when using syncfs . This option has no effect when --no-sync is used or --format is not set to directory .","names":["--sync-method= method"],"signature":"--sync-method= method"},{"description":"This is the same as the -t / --table option, except that it also includes any partitions or inheritance child tables of the table(s) matching the pattern .","names":["--table-and-children= pattern"],"signature":"--table-and-children= pattern"},{"description":"Output SQL-standard SET SESSION AUTHORIZATION commands instead of ALTER OWNER commands to determine object ownership. This makes the dump more standards-compatible, but depending on the history of the objects in the dump, might not restore properly. Also, a dump using SET SESSION AUTHORIZATION will certainly require superuser privileges to restore correctly, whereas ALTER OWNER requires lesser privileges.","names":["--use-set-session-authorization"],"signature":"--use-set-session-authorization"},{"description":"Show help about pg_dump command line arguments, and exit.","names":["-?","--help"],"signature":"-? --help"},{"description":"Specifies the name of the database to connect to. This is equivalent to specifying dbname as the first non-option argument on the command line. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options.","names":["-d dbname","--dbname= dbname"],"signature":"-d dbname --dbname= dbname"},{"description":"Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket. The default is taken from the PGHOST environment variable, if set, else a Unix domain socket connection is attempted.","names":["-h host","--host= host"],"signature":"-h host --host= host"},{"description":"Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default.","names":["-p port","--port= port"],"signature":"-p port --port= port"},{"description":"User name to connect as.","names":["-U username","--username= username"],"signature":"-U username --username= username"},{"description":"Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password.","names":["-w","--no-password"],"signature":"-w --no-password"},{"description":"Force pg_dump to prompt for a password before connecting to a database. This option is never essential, since pg_dump will automatically prompt for a password if the server demands password authentication. However, pg_dump will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing -W to avoid the extra connection attempt.","names":["-W","--password"],"signature":"-W --password"},{"description":"Specifies a role name to be used to create the dump. This option causes pg_dump to issue a SET ROLE rolename command after connecting to the database. It is useful when the authenticated user (specified by -U ) lacks privileges needed by pg_dump , but can switch to a role with the required rights. Some installations have a policy against logging in directly as a superuser, and use of this option allows dumps to be made without violating the policy.","names":["--role= rolename"],"signature":"--role= rolename"}],"synopsis":["pg_dump [ connection-option ...] [ option ...] [ dbname ]"]},"comparison_hash":"e4fc1961ca5ae638ffddf6b82d9336086bc97a70b652b15a5b41f476128da561","description":["pg_dump — export a PostgreSQL database as an SQL script or to other formats"],"environment":[{"description":"Default connection parameters.","name":"PGDATABASE PGHOST PGOPTIONS PGPORT PGUSER"},{"description":"Specifies whether to use color in diagnostic messages. Possible values are always , auto and never .","name":"PG_COLOR"}],"facts":[{"label":"Documented executable","value":"pg_dump"},{"label":"Executable version","value":"18.6"},{"label":"Reference inventory","value":"Client applications"},{"label":"Option definition groups","value":"73"}],"manual_html":"\u003cdiv\u003e\u003cdiv class=\"refentry\" id=\"APP-PGDUMP\"\u003e\n\u003cdiv class=\"titlepage\"\u003e\u003c/div\u003e\n\u003cdiv class=\"refnamediv\"\u003e\n\u003ch2\u003e\u003cspan class=\"refentrytitle\"\u003e\u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e\u003c/span\u003e\u003c/h2\u003e\n\u003cp\u003epg_dump — export a \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e database as an SQL script or to other formats\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsynopsisdiv\"\u003e\n\u003ch2\u003eSynopsis\u003c/h2\u003e\n\u003cdiv class=\"cmdsynopsis\"\u003e\n\u003cp id=\"id-1.9.4.14.4.1\"\u003e\u003ccode class=\"command\"\u003epg_dump\u003c/code\u003e [\u003cem class=\"replaceable\"\u003e\u003ccode\u003econnection-option\u003c/code\u003e\u003c/em\u003e...] [\u003cem class=\"replaceable\"\u003e\u003ccode\u003eoption\u003c/code\u003e\u003c/em\u003e...] [\u003cem class=\"replaceable\"\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e]\u003c/p\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"PG-DUMP-DESCRIPTION\"\u003e\n\u003ch2\u003eDescription\u003c/h2\u003e\n\u003cp\u003e\u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e is a utility for exporting a \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e database. It makes consistent exports even if the database is being used concurrently. \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e does not block other users accessing the database (readers or writers). Note, however, that except in simple cases, \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e is generally not the right choice for taking regular backups of production databases. See \u003ca class=\"xref\" href=\"/docs/18/backup.html\" title=\"Chapter 25. Backup and Restore\"\u003eChapter 25\u003c/a\u003e for further discussion.\u003c/p\u003e\n\u003cp\u003e\u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e only dumps a single database. To export an entire cluster, or to export global objects that are common to all databases in a cluster (such as roles and tablespaces), use \u003ca class=\"xref\" href=\"/docs/18/app-pg-dumpall.html\" title=\"pg_dumpall\"\u003e\u003cspan class=\"refentrytitle\"\u003e\u003cspan class=\"application\"\u003epg_dumpall\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e.\u003c/p\u003e\n\u003cp\u003eDumps can be output in script or archive file formats. Script dumps are plain-text files containing the SQL commands required to reconstruct the database to the state it was in at the time it was saved. To restore from such a script, feed it to \u003ca class=\"xref\" href=\"/docs/18/app-psql.html\" title=\"psql\"\u003e\u003cspan class=\"refentrytitle\"\u003e\u003cspan class=\"application\"\u003epsql\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e. Script files can be used to reconstruct the database even on other machines and other architectures; with some modifications, even on other SQL database products.\u003c/p\u003e\n\u003cp\u003eThe alternative archive file formats must be used with \u003ca class=\"xref\" href=\"/docs/18/app-pgrestore.html\" title=\"pg_restore\"\u003e\u003cspan class=\"refentrytitle\"\u003e\u003cspan class=\"application\"\u003epg_restore\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e to rebuild the database. They allow \u003cspan class=\"application\"\u003epg_restore\u003c/span\u003e to be selective about what is restored, or even to reorder the items prior to being restored. The archive file formats are designed to be portable across architectures.\u003c/p\u003e\n\u003cp\u003eWhen used with one of the archive file formats and combined with \u003cspan class=\"application\"\u003epg_restore\u003c/span\u003e, \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e provides a flexible archival and transfer mechanism. \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e can be used to export an entire database, then \u003cspan class=\"application\"\u003epg_restore\u003c/span\u003e can be used to examine the archive and/or select which parts of the database are to be restored. The most flexible output file formats are the \u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003ecustom\u003c/span\u003e”\u003c/span\u003e format (\u003ccode class=\"option\"\u003e-Fc\u003c/code\u003e) and the \u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003edirectory\u003c/span\u003e”\u003c/span\u003e format (\u003ccode class=\"option\"\u003e-Fd\u003c/code\u003e). They allow for selection and reordering of all archived items, support parallel restoration, and are compressed by default. The \u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003edirectory\u003c/span\u003e”\u003c/span\u003e format is the only format that supports parallel dumps.\u003c/p\u003e\n\u003cp\u003eWhile running \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e, one should examine the output for any warnings (printed on standard error), especially in light of the limitations listed below.\u003c/p\u003e\n\u003cdiv class=\"warning\"\u003e\n\u003ch3 class=\"title\"\u003eWarning\u003c/h3\u003e\n\u003cp\u003eRestoring a dump causes the destination to execute arbitrary code of the source superusers' choice. Partial dumps and partial restores do not limit that. If the source superusers are not trusted, the dumped SQL statements must be inspected before restoring. Non-plain-text dumps can be inspected by using \u003cspan class=\"application\"\u003epg_restore\u003c/span\u003e's \u003ccode class=\"option\"\u003e--file\u003c/code\u003e option. Note that the client running the dump and restore need not trust the source or destination superusers.\u003c/p\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"PG-DUMP-OPTIONS\"\u003e\n\u003ch2\u003eOptions\u003c/h2\u003e\n\u003cp\u003eThe following command-line options control the content and format of the output.\u003c/p\u003e\n\u003cdiv class=\"variablelist\"\u003e\n\u003cdl class=\"variablelist\"\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the name of the database to be dumped. If this is not specified, the environment variable \u003ccode class=\"envar\"\u003ePGDATABASE\u003c/code\u003e is used. If that is not set, the user name specified for the connection is used.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-a\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--data-only\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDump only the data, not the schema (data definitions) or statistics. Table data, large objects, and sequence values are dumped.\u003c/p\u003e\n\u003cp\u003eThis option is similar to, but for historical reasons not identical to, specifying \u003ccode class=\"option\"\u003e--section=data\u003c/code\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-b\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--large-objects\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--blobs\u003c/code\u003e (deprecated)\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eInclude large objects in the dump. This is the default behavior except when \u003ccode class=\"option\"\u003e--schema\u003c/code\u003e, \u003ccode class=\"option\"\u003e--table\u003c/code\u003e, \u003ccode class=\"option\"\u003e--schema-only\u003c/code\u003e, \u003ccode class=\"option\"\u003e--statistics-only\u003c/code\u003e, or \u003ccode class=\"option\"\u003e--no-data\u003c/code\u003e is specified. The \u003ccode class=\"option\"\u003e-b\u003c/code\u003e switch is therefore only useful to add large objects to dumps where a specific schema or table has been requested. Note that large objects are considered data and therefore will be included when \u003ccode class=\"option\"\u003e--data-only\u003c/code\u003e is used, but not when \u003ccode class=\"option\"\u003e--schema-only\u003c/code\u003e or \u003ccode class=\"option\"\u003e--statistics-only\u003c/code\u003e is.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-B\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-large-objects\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-blobs\u003c/code\u003e (deprecated)\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eExclude large objects in the dump.\u003c/p\u003e\n\u003cp\u003eWhen both \u003ccode class=\"option\"\u003e-b\u003c/code\u003e and \u003ccode class=\"option\"\u003e-B\u003c/code\u003e are given, the behavior is to output large objects, when data is being dumped, see the \u003ccode class=\"option\"\u003e-b\u003c/code\u003e documentation.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-c\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--clean\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eOutput commands to \u003ccode class=\"command\"\u003eDROP\u003c/code\u003e all the dumped database objects prior to outputting the commands for creating them. This option is useful when the restore is to overwrite an existing database. If any of the objects do not exist in the destination database, ignorable error messages will be reported during restore, unless \u003ccode class=\"option\"\u003e--if-exists\u003c/code\u003e is also specified.\u003c/p\u003e\n\u003cp\u003eThis option is ignored when emitting an archive (non-text) output file. For the archive formats, you can specify the option when you call \u003ccode class=\"command\"\u003epg_restore\u003c/code\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-C\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--create\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eBegin the output with a command to create the database itself and reconnect to the created database. (With a script of this form, it doesn't matter which database in the destination installation you connect to before running the script.) If \u003ccode class=\"option\"\u003e--clean\u003c/code\u003e is also specified, the script drops and recreates the target database before reconnecting to it.\u003c/p\u003e\n\u003cp\u003eWith \u003ccode class=\"option\"\u003e--create\u003c/code\u003e, the output also includes the database's comment if any, and any configuration variable settings that are specific to this database, that is, any \u003ccode class=\"command\"\u003eALTER DATABASE ... SET ...\u003c/code\u003e and \u003ccode class=\"command\"\u003eALTER ROLE ... IN DATABASE ... SET ...\u003c/code\u003e commands that mention this database. Access privileges for the database itself are also dumped, unless \u003ccode class=\"option\"\u003e--no-acl\u003c/code\u003e is specified.\u003c/p\u003e\n\u003cp\u003eThis option is ignored when emitting an archive (non-text) output file. For the archive formats, you can specify the option when you call \u003ccode class=\"command\"\u003epg_restore\u003c/code\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-e \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--extension=\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDump only extensions matching \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e. When this option is not specified, all non-system extensions in the target database will be dumped. Multiple extensions can be selected by writing multiple \u003ccode class=\"option\"\u003e-e\u003c/code\u003e switches. The \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e parameter is interpreted as a pattern according to the same rules used by \u003cspan class=\"application\"\u003epsql\u003c/span\u003e's \u003ccode class=\"literal\"\u003e\\d\u003c/code\u003e commands (see \u003ca class=\"xref\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003ePatterns\u003c/a\u003e), so multiple extensions can also be selected by writing wildcard characters in the pattern. When using wildcards, be careful to quote the pattern if needed to prevent the shell from expanding the wildcards.\u003c/p\u003e\n\u003cp\u003eAny configuration relation registered by \u003ccode class=\"function\"\u003epg_extension_config_dump\u003c/code\u003e is included in the dump if its extension is specified by \u003ccode class=\"option\"\u003e--extension\u003c/code\u003e.\u003c/p\u003e\n\u003cdiv class=\"note\"\u003e\n\u003ch3 class=\"title\"\u003eNote\u003c/h3\u003e\n\u003cp\u003eWhen \u003ccode class=\"option\"\u003e-e\u003c/code\u003e is specified, \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e makes no attempt to dump any other database objects that the selected extension(s) might depend upon. Therefore, there is no guarantee that the results of a specific-extension dump can be successfully restored by themselves into a clean database.\u003c/p\u003e\n\u003c/div\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-E \u003cem class=\"replaceable\"\u003e\u003ccode\u003eencoding\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--encoding=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eencoding\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eCreate the dump in the specified character set encoding. By default, the dump is created in the database encoding. (Another way to get the same result is to set the \u003ccode class=\"envar\"\u003ePGCLIENTENCODING\u003c/code\u003e environment variable to the desired dump encoding.) The supported encodings are described in \u003ca class=\"xref\" href=\"/docs/18/multibyte.html#MULTIBYTE-CHARSET-SUPPORTED\" title=\"23.3.1. Supported Character Sets\"\u003eSection 23.3.1\u003c/a\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-f \u003cem class=\"replaceable\"\u003e\u003ccode\u003efile\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--file=\u003cem class=\"replaceable\"\u003e\u003ccode\u003efile\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSend output to the specified file. This parameter can be omitted for file based output formats, in which case the standard output is used. It must be given for the directory output format however, where it specifies the target directory instead of a file. In this case the directory is created by \u003ccode class=\"command\"\u003epg_dump\u003c/code\u003e and must not exist before.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-F \u003cem class=\"replaceable\"\u003e\u003ccode\u003eformat\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--format=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eformat\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSelects the format of the output. \u003cem class=\"replaceable\"\u003e\u003ccode\u003eformat\u003c/code\u003e\u003c/em\u003e can be one of the following:\u003c/p\u003e\n\u003cdiv class=\"variablelist\"\u003e\n\u003cdl class=\"variablelist\"\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003ep\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003eplain\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eOutput a plain-text SQL script file (the default).\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003ec\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003ecustom\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eOutput a custom-format archive suitable for input into \u003cspan class=\"application\"\u003epg_restore\u003c/span\u003e. Together with the directory output format, this is the most flexible output format in that it allows manual selection and reordering of archived items during restore. This format is also compressed by default.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003ed\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003edirectory\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eOutput a directory-format archive suitable for input into \u003cspan class=\"application\"\u003epg_restore\u003c/span\u003e. This will create a directory with one file for each table and large object being dumped, plus a so-called Table of Contents file describing the dumped objects in a machine-readable format that \u003cspan class=\"application\"\u003epg_restore\u003c/span\u003e can read. A directory format archive can be manipulated with standard Unix tools; for example, files in an uncompressed archive can be compressed with the \u003cspan class=\"application\"\u003egzip\u003c/span\u003e, \u003cspan class=\"application\"\u003elz4\u003c/span\u003e, or \u003cspan class=\"application\"\u003ezstd\u003c/span\u003e tools. This format is compressed by default using \u003ccode class=\"literal\"\u003egzip\u003c/code\u003e and also supports parallel dumps.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003et\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003etar\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eOutput a \u003ccode class=\"command\"\u003etar\u003c/code\u003e-format archive suitable for input into \u003cspan class=\"application\"\u003epg_restore\u003c/span\u003e. The tar format is compatible with the directory format: extracting a tar-format archive produces a valid directory-format archive. However, the tar format does not support compression. Also, when using tar format the relative order of table data items cannot be changed during restore.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-j \u003cem class=\"replaceable\"\u003e\u003ccode\u003enjobs\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--jobs=\u003cem class=\"replaceable\"\u003e\u003ccode\u003enjobs\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eRun the dump in parallel by dumping \u003cem class=\"replaceable\"\u003e\u003ccode\u003enjobs\u003c/code\u003e\u003c/em\u003e tables simultaneously. This option may reduce the time needed to perform the dump but it also increases the load on the database server. You can only use this option with the directory output format because this is the only output format where multiple processes can write their data at the same time.\u003c/p\u003e\n\u003cp\u003e\u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e will open \u003cem class=\"replaceable\"\u003e\u003ccode\u003enjobs\u003c/code\u003e\u003c/em\u003e + 1 connections to the database, so make sure your \u003ca class=\"xref\" href=\"/docs/18/runtime-config-connection.html#GUC-MAX-CONNECTIONS\"\u003emax_connections\u003c/a\u003e setting is high enough to accommodate all connections.\u003c/p\u003e\n\u003cp\u003eRequesting exclusive locks on database objects while running a parallel dump could cause the dump to fail. The reason is that the \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e leader process requests shared locks (\u003ca class=\"link\" href=\"/docs/18/explicit-locking.html#LOCKING-TABLES\" title=\"13.3.1. Table-Level Locks\"\u003eACCESS SHARE\u003c/a\u003e) on the objects that the worker processes are going to dump later in order to make sure that nobody deletes them and makes them go away while the dump is running. If another client then requests an exclusive lock on a table, that lock will not be granted but will be queued waiting for the shared lock of the leader process to be released. Consequently any other access to the table will not be granted either and will queue after the exclusive lock request. This includes the worker process trying to dump the table. Without any precautions this would be a classic deadlock situation. To detect this conflict, the \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e worker process requests another shared lock using the \u003ccode class=\"literal\"\u003eNOWAIT\u003c/code\u003e option. If the worker process is not granted this shared lock, somebody else must have requested an exclusive lock in the meantime and there is no way to continue with the dump, so \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e has no choice but to abort the dump.\u003c/p\u003e\n\u003cp\u003eTo perform a parallel dump, the database server needs to support synchronized snapshots, a feature that was introduced in \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e 9.2 for primary servers and 10 for standbys. With this feature, database clients can ensure they see the same data set even though they use different connections. \u003ccode class=\"command\"\u003epg_dump -j\u003c/code\u003e uses multiple database connections; it connects to the database once with the leader process and once again for each worker job. Without the synchronized snapshot feature, the different worker jobs wouldn't be guaranteed to see the same data in each connection, which could lead to an inconsistent backup.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-n \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--schema=\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDump only schemas matching \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e; this selects both the schema itself, and all its contained objects. When this option is not specified, all non-system schemas in the target database will be dumped. Multiple schemas can be selected by writing multiple \u003ccode class=\"option\"\u003e-n\u003c/code\u003e switches. The \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e parameter is interpreted as a pattern according to the same rules used by \u003cspan class=\"application\"\u003epsql\u003c/span\u003e's \u003ccode class=\"literal\"\u003e\\d\u003c/code\u003e commands (see \u003ca class=\"xref\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003ePatterns\u003c/a\u003e), so multiple schemas can also be selected by writing wildcard characters in the pattern. When using wildcards, be careful to quote the pattern if needed to prevent the shell from expanding the wildcards; see \u003ca class=\"xref\" href=\"/docs/18/app-pgdump.html#PG-DUMP-EXAMPLES\" title=\"Examples\"\u003eExamples\u003c/a\u003e below.\u003c/p\u003e\n\u003cdiv class=\"note\"\u003e\n\u003ch3 class=\"title\"\u003eNote\u003c/h3\u003e\n\u003cp\u003eWhen \u003ccode class=\"option\"\u003e-n\u003c/code\u003e is specified, \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e makes no attempt to dump any other database objects that the selected schema(s) might depend upon. Therefore, there is no guarantee that the results of a specific-schema dump can be successfully restored by themselves into a clean database.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"note\"\u003e\n\u003ch3 class=\"title\"\u003eNote\u003c/h3\u003e\n\u003cp\u003eNon-schema objects such as large objects are not dumped when \u003ccode class=\"option\"\u003e-n\u003c/code\u003e is specified. You can add large objects back to the dump with the \u003ccode class=\"option\"\u003e--large-objects\u003c/code\u003e switch.\u003c/p\u003e\n\u003c/div\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-N \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--exclude-schema=\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not dump any schemas matching \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e. The pattern is interpreted according to the same rules as for \u003ccode class=\"option\"\u003e-n\u003c/code\u003e. \u003ccode class=\"option\"\u003e-N\u003c/code\u003e can be given more than once to exclude schemas matching any of several patterns.\u003c/p\u003e\n\u003cp\u003eWhen both \u003ccode class=\"option\"\u003e-n\u003c/code\u003e and \u003ccode class=\"option\"\u003e-N\u003c/code\u003e are given, the behavior is to dump just the schemas that match at least one \u003ccode class=\"option\"\u003e-n\u003c/code\u003e switch but no \u003ccode class=\"option\"\u003e-N\u003c/code\u003e switches. If \u003ccode class=\"option\"\u003e-N\u003c/code\u003e appears without \u003ccode class=\"option\"\u003e-n\u003c/code\u003e, then schemas matching \u003ccode class=\"option\"\u003e-N\u003c/code\u003e are excluded from what is otherwise a normal dump.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-O\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-owner\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not output commands to set ownership of objects to match the original database. By default, \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e issues \u003ccode class=\"command\"\u003eALTER OWNER\u003c/code\u003e or \u003ccode class=\"command\"\u003eSET SESSION AUTHORIZATION\u003c/code\u003e statements to set ownership of created database objects. These statements will fail when the script is run unless it is started by a superuser (or the same user that owns all of the objects in the script). To make a script that can be restored by any user, but will give that user ownership of all the objects, specify \u003ccode class=\"option\"\u003e-O\u003c/code\u003e.\u003c/p\u003e\n\u003cp\u003eThis option is ignored when emitting an archive (non-text) output file. For the archive formats, you can specify the option when you call \u003ccode class=\"command\"\u003epg_restore\u003c/code\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-R\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-reconnect\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThis option is obsolete but still accepted for backwards compatibility.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-s\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--schema-only\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDump only the object definitions (schema), not data or statistics.\u003c/p\u003e\n\u003cp\u003eThis option cannot be used with \u003ccode class=\"option\"\u003e--data-only\u003c/code\u003e or \u003ccode class=\"option\"\u003e--statistics-only\u003c/code\u003e. It is similar to, but for historical reasons not identical to, specifying \u003ccode class=\"option\"\u003e--section=pre-data --section=post-data\u003c/code\u003e.\u003c/p\u003e\n\u003cp\u003e(Do not confuse this with the \u003ccode class=\"option\"\u003e--schema\u003c/code\u003e option, which uses the word \u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003eschema\u003c/span\u003e”\u003c/span\u003e in a different meaning.)\u003c/p\u003e\n\u003cp\u003eTo exclude table data for only a subset of tables in the database, see \u003ccode class=\"option\"\u003e--exclude-table-data\u003c/code\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-S \u003cem class=\"replaceable\"\u003e\u003ccode\u003eusername\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--superuser=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eusername\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecify the superuser user name to use when disabling triggers. This is relevant only if \u003ccode class=\"option\"\u003e--disable-triggers\u003c/code\u003e is used. (Usually, it's better to leave this out, and instead start the resulting script as superuser.)\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-t \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--table=\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDump only tables with names matching \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e. Multiple tables can be selected by writing multiple \u003ccode class=\"option\"\u003e-t\u003c/code\u003e switches. The \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e parameter is interpreted as a pattern according to the same rules used by \u003cspan class=\"application\"\u003epsql\u003c/span\u003e's \u003ccode class=\"literal\"\u003e\\d\u003c/code\u003e commands (see \u003ca class=\"xref\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003ePatterns\u003c/a\u003e), so multiple tables can also be selected by writing wildcard characters in the pattern. When using wildcards, be careful to quote the pattern if needed to prevent the shell from expanding the wildcards; see \u003ca class=\"xref\" href=\"/docs/18/app-pgdump.html#PG-DUMP-EXAMPLES\" title=\"Examples\"\u003eExamples\u003c/a\u003e below.\u003c/p\u003e\n\u003cp\u003eAs well as tables, this option can be used to dump the definition of matching views, materialized views, foreign tables, and sequences. It will not dump the contents of views or materialized views, and the contents of foreign tables will only be dumped if the corresponding foreign server is specified with \u003ccode class=\"option\"\u003e--include-foreign-data\u003c/code\u003e.\u003c/p\u003e\n\u003cp\u003eThe \u003ccode class=\"option\"\u003e-n\u003c/code\u003e and \u003ccode class=\"option\"\u003e-N\u003c/code\u003e switches have no effect when \u003ccode class=\"option\"\u003e-t\u003c/code\u003e is used, because tables selected by \u003ccode class=\"option\"\u003e-t\u003c/code\u003e will be dumped regardless of those switches, and non-table objects will not be dumped.\u003c/p\u003e\n\u003cdiv class=\"note\"\u003e\n\u003ch3 class=\"title\"\u003eNote\u003c/h3\u003e\n\u003cp\u003eWhen \u003ccode class=\"option\"\u003e-t\u003c/code\u003e is specified, \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e makes no attempt to dump any other database objects that the selected table(s) might depend upon. Therefore, there is no guarantee that the results of a specific-table dump can be successfully restored by themselves into a clean database.\u003c/p\u003e\n\u003c/div\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-T \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--exclude-table=\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not dump any tables matching \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e. The pattern is interpreted according to the same rules as for \u003ccode class=\"option\"\u003e-t\u003c/code\u003e. \u003ccode class=\"option\"\u003e-T\u003c/code\u003e can be given more than once to exclude tables matching any of several patterns.\u003c/p\u003e\n\u003cp\u003eWhen both \u003ccode class=\"option\"\u003e-t\u003c/code\u003e and \u003ccode class=\"option\"\u003e-T\u003c/code\u003e are given, the behavior is to dump just the tables that match at least one \u003ccode class=\"option\"\u003e-t\u003c/code\u003e switch but no \u003ccode class=\"option\"\u003e-T\u003c/code\u003e switches. If \u003ccode class=\"option\"\u003e-T\u003c/code\u003e appears without \u003ccode class=\"option\"\u003e-t\u003c/code\u003e, then tables matching \u003ccode class=\"option\"\u003e-T\u003c/code\u003e are excluded from what is otherwise a normal dump.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-v\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--verbose\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies verbose mode. This will cause \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e to output detailed object comments and start/stop times to the dump file, and progress messages to standard error. Repeating the option causes additional debug-level messages to appear on standard error.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-V\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--version\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003ePrint the \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e version and exit.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-x\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-privileges\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-acl\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003ePrevent dumping of access privileges (grant/revoke commands).\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-Z \u003cem class=\"replaceable\"\u003e\u003ccode\u003elevel\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-Z \u003cem class=\"replaceable\"\u003e\u003ccode\u003emethod\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e[:\u003cem class=\"replaceable\"\u003e\u003ccode\u003edetail\u003c/code\u003e\u003c/em\u003e]\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--compress=\u003cem class=\"replaceable\"\u003e\u003ccode\u003elevel\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--compress=\u003cem class=\"replaceable\"\u003e\u003ccode\u003emethod\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e[:\u003cem class=\"replaceable\"\u003e\u003ccode\u003edetail\u003c/code\u003e\u003c/em\u003e]\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecify the compression method and/or the compression level to use. The compression method can be set to \u003ccode class=\"literal\"\u003egzip\u003c/code\u003e, \u003ccode class=\"literal\"\u003elz4\u003c/code\u003e, \u003ccode class=\"literal\"\u003ezstd\u003c/code\u003e, or \u003ccode class=\"literal\"\u003enone\u003c/code\u003e for no compression. A compression detail string can optionally be specified. If the detail string is an integer, it specifies the compression level. Otherwise, it should be a comma-separated list of items, each of the form \u003ccode class=\"literal\"\u003ekeyword\u003c/code\u003e or \u003ccode class=\"literal\"\u003ekeyword=value\u003c/code\u003e. Currently, the supported keywords are \u003ccode class=\"literal\"\u003elevel\u003c/code\u003e and \u003ccode class=\"literal\"\u003elong\u003c/code\u003e.\u003c/p\u003e\n\u003cp\u003eIf no compression level is specified, the default compression level will be used. If only a level is specified without mentioning an algorithm, \u003ccode class=\"literal\"\u003egzip\u003c/code\u003e compression will be used if the level is greater than \u003ccode class=\"literal\"\u003e0\u003c/code\u003e, and no compression will be used if the level is \u003ccode class=\"literal\"\u003e0\u003c/code\u003e.\u003c/p\u003e\n\u003cp\u003eFor the custom and directory archive formats, this specifies compression of individual table-data segments, and the default is to compress using \u003ccode class=\"literal\"\u003egzip\u003c/code\u003e at a moderate level. For plain text output, setting a nonzero compression level causes the entire output file to be compressed, as though it had been fed through \u003cspan class=\"application\"\u003egzip\u003c/span\u003e, \u003cspan class=\"application\"\u003elz4\u003c/span\u003e, or \u003cspan class=\"application\"\u003ezstd\u003c/span\u003e; but the default is not to compress. With zstd compression, \u003ccode class=\"literal\"\u003elong\u003c/code\u003e mode may improve the compression ratio, at the cost of increased memory use.\u003c/p\u003e\n\u003cp\u003eThe tar archive format currently does not support compression at all.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--binary-upgrade\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThis option is for use by in-place upgrade utilities. Its use for other purposes is not recommended or supported. The behavior of the option may change in future releases without notice.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--column-inserts\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--attribute-inserts\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDump data as \u003ccode class=\"command\"\u003eINSERT\u003c/code\u003e commands with explicit column names (\u003ccode class=\"literal\"\u003eINSERT INTO \u003cem class=\"replaceable\"\u003e\u003ccode\u003etable\u003c/code\u003e\u003c/em\u003e (\u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolumn\u003c/code\u003e\u003c/em\u003e, ...) VALUES ...\u003c/code\u003e). This will make restoration very slow; it is mainly useful for making dumps that can be loaded into non-\u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e databases. Any error during restoring will cause only rows that are part of the problematic \u003ccode class=\"command\"\u003eINSERT\u003c/code\u003e to be lost, rather than the entire table contents.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--disable-dollar-quoting\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThis option disables the use of dollar quoting for function bodies, and forces them to be quoted using SQL standard string syntax.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--disable-triggers\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThis option is relevant only when creating a dump that includes data but does not include schema. It instructs \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e to include commands to temporarily disable triggers on the target tables while the data is restored. Use this if you have referential integrity checks or other triggers on the tables that you do not want to invoke during data restore.\u003c/p\u003e\n\u003cp\u003ePresently, the commands emitted for \u003ccode class=\"option\"\u003e--disable-triggers\u003c/code\u003e must be done as superuser. So, you should also specify a superuser name with \u003ccode class=\"option\"\u003e-S\u003c/code\u003e, or preferably be careful to start the resulting script as a superuser.\u003c/p\u003e\n\u003cp\u003eThis option is ignored when emitting an archive (non-text) output file. For the archive formats, you can specify the option when you call \u003ccode class=\"command\"\u003epg_restore\u003c/code\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--enable-row-security\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThis option is relevant only when dumping the contents of a table which has row security. By default, \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e will set \u003ca class=\"xref\" href=\"/docs/18/runtime-config-client.html#GUC-ROW-SECURITY\"\u003erow_security\u003c/a\u003e to off, to ensure that all data is dumped from the table. If the user does not have sufficient privileges to bypass row security, then an error is thrown. This parameter instructs \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e to set \u003ca class=\"xref\" href=\"/docs/18/runtime-config-client.html#GUC-ROW-SECURITY\"\u003erow_security\u003c/a\u003e to on instead, allowing the user to dump the parts of the contents of the table that they have access to.\u003c/p\u003e\n\u003cp\u003eNote that if you use this option currently, you probably also want the dump be in \u003ccode class=\"command\"\u003eINSERT\u003c/code\u003e format, as the \u003ccode class=\"command\"\u003eCOPY FROM\u003c/code\u003e during restore does not support row security.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--exclude-extension=\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not dump any extensions matching \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e. The pattern is interpreted according to the same rules as for \u003ccode class=\"option\"\u003e-e\u003c/code\u003e. \u003ccode class=\"option\"\u003e--exclude-extension\u003c/code\u003e can be given more than once to exclude extensions matching any of several patterns.\u003c/p\u003e\n\u003cp\u003eWhen both \u003ccode class=\"option\"\u003e-e\u003c/code\u003e and \u003ccode class=\"option\"\u003e--exclude-extension\u003c/code\u003e are given, the behavior is to dump just the extensions that match at least one \u003ccode class=\"option\"\u003e-e\u003c/code\u003e switch but no \u003ccode class=\"option\"\u003e--exclude-extension\u003c/code\u003e switches. If \u003ccode class=\"option\"\u003e--exclude-extension\u003c/code\u003e appears without \u003ccode class=\"option\"\u003e-e\u003c/code\u003e, then extensions matching \u003ccode class=\"option\"\u003e--exclude-extension\u003c/code\u003e are excluded from what is otherwise a normal dump.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--exclude-table-and-children=\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThis is the same as the \u003ccode class=\"option\"\u003e-T\u003c/code\u003e/\u003ccode class=\"option\"\u003e--exclude-table\u003c/code\u003e option, except that it also excludes any partitions or inheritance child tables of the table(s) matching the \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--exclude-table-data=\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not dump data for any tables matching \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e. The pattern is interpreted according to the same rules as for \u003ccode class=\"option\"\u003e-t\u003c/code\u003e. \u003ccode class=\"option\"\u003e--exclude-table-data\u003c/code\u003e can be given more than once to exclude tables matching any of several patterns. This option is useful when you need the definition of a particular table even though you do not need the data in it.\u003c/p\u003e\n\u003cp\u003eTo exclude data for all tables in the database, see \u003ccode class=\"option\"\u003e--schema-only\u003c/code\u003e or \u003ccode class=\"option\"\u003e--statistics-only\u003c/code\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--exclude-table-data-and-children=\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThis is the same as the \u003ccode class=\"option\"\u003e--exclude-table-data\u003c/code\u003e option, except that it also excludes data of any partitions or inheritance child tables of the table(s) matching the \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--extra-float-digits=\u003cem class=\"replaceable\"\u003e\u003ccode\u003endigits\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eUse the specified value of \u003ccode class=\"option\"\u003eextra_float_digits\u003c/code\u003e when dumping floating-point data, instead of the maximum available precision. Routine dumps made for backup purposes should not use this option.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--filter=\u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecify a filename from which to read patterns for objects to include or exclude from the dump. The patterns are interpreted according to the same rules as the corresponding options: \u003ccode class=\"option\"\u003e-t\u003c/code\u003e/\u003ccode class=\"option\"\u003e--table\u003c/code\u003e, \u003ccode class=\"option\"\u003e--table-and-children\u003c/code\u003e, \u003ccode class=\"option\"\u003e-T\u003c/code\u003e/\u003ccode class=\"option\"\u003e--exclude-table\u003c/code\u003e, and \u003ccode class=\"option\"\u003e--exclude-table-and-children\u003c/code\u003e for tables, \u003ccode class=\"option\"\u003e-n\u003c/code\u003e/\u003ccode class=\"option\"\u003e--schema\u003c/code\u003e and \u003ccode class=\"option\"\u003e-N\u003c/code\u003e/\u003ccode class=\"option\"\u003e--exclude-schema\u003c/code\u003e for schemas, \u003ccode class=\"option\"\u003e--include-foreign-data\u003c/code\u003e for data on foreign servers, \u003ccode class=\"option\"\u003e--exclude-table-data\u003c/code\u003e and \u003ccode class=\"option\"\u003e--exclude-table-data-and-children\u003c/code\u003e for table data, and \u003ccode class=\"option\"\u003e-e\u003c/code\u003e/\u003ccode class=\"option\"\u003e--extension\u003c/code\u003e and \u003ccode class=\"option\"\u003e--exclude-extension\u003c/code\u003e for extensions. To read from \u003ccode class=\"literal\"\u003eSTDIN\u003c/code\u003e, use \u003ccode class=\"filename\"\u003e-\u003c/code\u003e as the filename. The \u003ccode class=\"option\"\u003e--filter\u003c/code\u003e option can be specified in conjunction with the above listed options for including or excluding objects, and can also be specified more than once for multiple filter files.\u003c/p\u003e\n\u003cp\u003eThe file lists one object pattern per row, with the following format:\u003c/p\u003e\n\u003cpre class=\"synopsis\"\u003e{ include | exclude } { extension | foreign_data | table | table_and_children | table_data | table_data_and_children | schema } \u003cem class=\"replaceable\"\u003e\u003ccode\u003ePATTERN\u003c/code\u003e\u003c/em\u003e\n\u003c/pre\u003e\n\u003cp\u003eThe first keyword specifies whether the objects matched by the pattern are to be included or excluded. The second keyword specifies the type of object to be filtered using the pattern:\u003c/p\u003e\n\u003cdiv class=\"itemizedlist\"\u003e\n\u003cul class=\"itemizedlist\"\u003e\n\u003cli class=\"listitem\"\u003e\n\u003cp\u003e\u003ccode class=\"literal\"\u003eextension\u003c/code\u003e: extensions. This works like the \u003ccode class=\"option\"\u003e-e\u003c/code\u003e/\u003ccode class=\"option\"\u003e--extension\u003c/code\u003e or \u003ccode class=\"option\"\u003e--exclude-extension\u003c/code\u003e option.\u003c/p\u003e\n\u003c/li\u003e\n\u003cli class=\"listitem\"\u003e\n\u003cp\u003e\u003ccode class=\"literal\"\u003eforeign_data\u003c/code\u003e: data on foreign servers. This works like the \u003ccode class=\"option\"\u003e--include-foreign-data\u003c/code\u003e option. This keyword can only be used with the \u003ccode class=\"literal\"\u003einclude\u003c/code\u003e keyword.\u003c/p\u003e\n\u003c/li\u003e\n\u003cli class=\"listitem\"\u003e\n\u003cp\u003e\u003ccode class=\"literal\"\u003etable\u003c/code\u003e: tables. This works like the \u003ccode class=\"option\"\u003e-t\u003c/code\u003e/\u003ccode class=\"option\"\u003e--table\u003c/code\u003e or \u003ccode class=\"option\"\u003e-T\u003c/code\u003e/\u003ccode class=\"option\"\u003e--exclude-table\u003c/code\u003e option.\u003c/p\u003e\n\u003c/li\u003e\n\u003cli class=\"listitem\"\u003e\n\u003cp\u003e\u003ccode class=\"literal\"\u003etable_and_children\u003c/code\u003e: tables including any partitions or inheritance child tables. This works like the \u003ccode class=\"option\"\u003e--table-and-children\u003c/code\u003e or \u003ccode class=\"option\"\u003e--exclude-table-and-children\u003c/code\u003e option.\u003c/p\u003e\n\u003c/li\u003e\n\u003cli class=\"listitem\"\u003e\n\u003cp\u003e\u003ccode class=\"literal\"\u003etable_data\u003c/code\u003e: table data of any tables matching \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e. This works like the \u003ccode class=\"option\"\u003e--exclude-table-data\u003c/code\u003e option. This keyword can only be used with the \u003ccode class=\"literal\"\u003eexclude\u003c/code\u003e keyword.\u003c/p\u003e\n\u003c/li\u003e\n\u003cli class=\"listitem\"\u003e\n\u003cp\u003e\u003ccode class=\"literal\"\u003etable_data_and_children\u003c/code\u003e: table data of any tables matching \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e as well as any partitions or inheritance children of the table(s). This works like the \u003ccode class=\"option\"\u003e--exclude-table-data-and-children\u003c/code\u003e option. This keyword can only be used with the \u003ccode class=\"literal\"\u003eexclude\u003c/code\u003e keyword.\u003c/p\u003e\n\u003c/li\u003e\n\u003cli class=\"listitem\"\u003e\n\u003cp\u003e\u003ccode class=\"literal\"\u003eschema\u003c/code\u003e: schemas. This works like the \u003ccode class=\"option\"\u003e-n\u003c/code\u003e/\u003ccode class=\"option\"\u003e--schema\u003c/code\u003e or \u003ccode class=\"option\"\u003e-N\u003c/code\u003e/\u003ccode class=\"option\"\u003e--exclude-schema\u003c/code\u003e option.\u003c/p\u003e\n\u003c/li\u003e\n\u003c/ul\u003e\n\u003c/div\u003e\n\u003cp\u003eLines starting with \u003ccode class=\"literal\"\u003e#\u003c/code\u003e are considered comments and ignored. Comments can be placed after an object pattern row as well. Blank lines are also ignored. See \u003ca class=\"xref\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003ePatterns\u003c/a\u003e for how to perform quoting in patterns.\u003c/p\u003e\n\u003cp\u003eExample files are listed below in the \u003ca class=\"xref\" href=\"/docs/18/app-pgdump.html#PG-DUMP-EXAMPLES\" title=\"Examples\"\u003eExamples\u003c/a\u003e section.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--if-exists\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eUse \u003ccode class=\"literal\"\u003eDROP ... IF EXISTS\u003c/code\u003e commands to drop objects in \u003ccode class=\"option\"\u003e--clean\u003c/code\u003e mode. This suppresses \u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003edoes not exist\u003c/span\u003e”\u003c/span\u003e errors that might otherwise be reported. This option is not valid unless \u003ccode class=\"option\"\u003e--clean\u003c/code\u003e is also specified.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--include-foreign-data=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eforeignserver\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDump the data for any foreign table with a foreign server matching \u003cem class=\"replaceable\"\u003e\u003ccode\u003eforeignserver\u003c/code\u003e\u003c/em\u003e pattern. Multiple foreign servers can be selected by writing multiple \u003ccode class=\"option\"\u003e--include-foreign-data\u003c/code\u003e switches. Also, the \u003cem class=\"replaceable\"\u003e\u003ccode\u003eforeignserver\u003c/code\u003e\u003c/em\u003e parameter is interpreted as a pattern according to the same rules used by \u003cspan class=\"application\"\u003epsql\u003c/span\u003e's \u003ccode class=\"literal\"\u003e\\d\u003c/code\u003e commands (see \u003ca class=\"xref\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003ePatterns\u003c/a\u003e), so multiple foreign servers can also be selected by writing wildcard characters in the pattern. When using wildcards, be careful to quote the pattern if needed to prevent the shell from expanding the wildcards; see \u003ca class=\"xref\" href=\"/docs/18/app-pgdump.html#PG-DUMP-EXAMPLES\" title=\"Examples\"\u003eExamples\u003c/a\u003e below. The only exception is that an empty pattern is disallowed.\u003c/p\u003e\n\u003cdiv class=\"note\"\u003e\n\u003ch3 class=\"title\"\u003eNote\u003c/h3\u003e\n\u003cp\u003eUsing wildcards in \u003ccode class=\"option\"\u003e--include-foreign-data\u003c/code\u003e may result in access to unexpected foreign servers. Also, to use this option securely, make sure that the named server must have a trusted owner.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"note\"\u003e\n\u003ch3 class=\"title\"\u003eNote\u003c/h3\u003e\n\u003cp\u003eWhen \u003ccode class=\"option\"\u003e--include-foreign-data\u003c/code\u003e is specified, \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e does not check that the foreign table is writable. Therefore, there is no guarantee that the results of a foreign table dump can be successfully restored.\u003c/p\u003e\n\u003c/div\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--inserts\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDump data as \u003ccode class=\"command\"\u003eINSERT\u003c/code\u003e commands (rather than \u003ccode class=\"command\"\u003eCOPY\u003c/code\u003e). This will make restoration very slow; it is mainly useful for making dumps that can be loaded into non-\u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e databases. Any error during restoring will cause only rows that are part of the problematic \u003ccode class=\"command\"\u003eINSERT\u003c/code\u003e to be lost, rather than the entire table contents. Note that the restore might fail altogether if you have rearranged column order. The \u003ccode class=\"option\"\u003e--column-inserts\u003c/code\u003e option is safe against column order changes, though even slower.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--load-via-partition-root\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eWhen dumping data for a table partition, make the \u003ccode class=\"command\"\u003eCOPY\u003c/code\u003e or \u003ccode class=\"command\"\u003eINSERT\u003c/code\u003e statements target the root of the partitioning hierarchy that contains it, rather than the partition itself. This causes the appropriate partition to be re-determined for each row when the data is loaded. This may be useful when restoring data on a server where rows do not always fall into the same partitions as they did on the original server. That could happen, for example, if the partitioning column is of type text and the two systems have different definitions of the collation used to sort the partitioning column.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--lock-wait-timeout=\u003cem class=\"replaceable\"\u003e\u003ccode\u003etimeout\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not wait forever to acquire shared table locks at the beginning of the dump. Instead fail if unable to lock a table within the specified \u003cem class=\"replaceable\"\u003e\u003ccode\u003etimeout\u003c/code\u003e\u003c/em\u003e. The timeout may be specified in any of the formats accepted by \u003ccode class=\"command\"\u003eSET statement_timeout\u003c/code\u003e. (Allowed formats vary depending on the server version you are dumping from, but an integer number of milliseconds is accepted by all versions.)\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-comments\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not dump \u003ccode class=\"command\"\u003eCOMMENT\u003c/code\u003e commands.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-data\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not dump data.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-policies\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not dump row security policies.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-publications\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not dump publications.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-schema\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not dump schema (data definitions).\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-security-labels\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not dump security labels.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-statistics\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not dump statistics. This is the default.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-subscriptions\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not dump subscriptions.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-sync\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eBy default, \u003ccode class=\"command\"\u003epg_dump\u003c/code\u003e will wait for all files to be written safely to disk. This option causes \u003ccode class=\"command\"\u003epg_dump\u003c/code\u003e to return without waiting, which is faster, but means that a subsequent operating system crash can leave the dump corrupt. Generally, this option is useful for testing but should not be used when dumping data from production installation.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-table-access-method\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not output commands to select table access methods. With this option, all objects will be created with whichever table access method is the default during restore.\u003c/p\u003e\n\u003cp\u003eThis option is ignored when emitting an archive (non-text) output file. For the archive formats, you can specify the option when you call \u003ccode class=\"command\"\u003epg_restore\u003c/code\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-tablespaces\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not output commands to select tablespaces. With this option, all objects will be created in whichever tablespace is the default during restore.\u003c/p\u003e\n\u003cp\u003eThis option is ignored when emitting an archive (non-text) output file. For the archive formats, you can specify the option when you call \u003ccode class=\"command\"\u003epg_restore\u003c/code\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-toast-compression\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not output commands to set TOAST compression methods. With this option, all columns will be restored with the default compression setting.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-unlogged-table-data\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not dump the contents of unlogged tables and sequences. This option has no effect on whether or not the table and sequence definitions (schema) are dumped; it only suppresses dumping the table and sequence data. Data in unlogged tables and sequences is always excluded when dumping from a standby server.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--on-conflict-do-nothing\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eAdd \u003ccode class=\"literal\"\u003eON CONFLICT DO NOTHING\u003c/code\u003e to \u003ccode class=\"command\"\u003eINSERT\u003c/code\u003e commands. This option is not valid unless \u003ccode class=\"option\"\u003e--inserts\u003c/code\u003e, \u003ccode class=\"option\"\u003e--column-inserts\u003c/code\u003e or \u003ccode class=\"option\"\u003e--rows-per-insert\u003c/code\u003e is also specified.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--quote-all-identifiers\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eForce quoting of all identifiers. This option is recommended when dumping a database from a server whose \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e major version is different from \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e's, or when the output is intended to be loaded into a server of a different major version. By default, \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e quotes only identifiers that are reserved words in its own major version. This sometimes results in compatibility issues when dealing with servers of other versions that may have slightly different sets of reserved words. Using \u003ccode class=\"option\"\u003e--quote-all-identifiers\u003c/code\u003e prevents such issues, at the price of a harder-to-read dump script.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--restrict-key=\u003cem class=\"replaceable\"\u003e\u003ccode\u003erestrict_key\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eUse the provided string as the \u003cspan class=\"application\"\u003epsql\u003c/span\u003e \u003ccode class=\"command\"\u003e\\restrict\u003c/code\u003e key in the dump output. This can only be specified for plain-text dumps, i.e., when \u003ccode class=\"option\"\u003e--format\u003c/code\u003e is set to \u003ccode class=\"literal\"\u003eplain\u003c/code\u003e or the \u003ccode class=\"option\"\u003e--format\u003c/code\u003e option is omitted. If no restrict key is specified, \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e will generate a random one as needed. Keys may contain only alphanumeric characters.\u003c/p\u003e\n\u003cp\u003eThis option is primarily intended for testing purposes and other scenarios that require repeatable output (e.g., comparing dump files). It is not recommended for general use, as a malicious server with advance knowledge of the key may be able to inject arbitrary code that will be executed on the machine that runs \u003cspan class=\"application\"\u003epsql\u003c/span\u003e with the dump output.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--rows-per-insert=\u003cem class=\"replaceable\"\u003e\u003ccode\u003enrows\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDump data as \u003ccode class=\"command\"\u003eINSERT\u003c/code\u003e commands (rather than \u003ccode class=\"command\"\u003eCOPY\u003c/code\u003e). Controls the maximum number of rows per \u003ccode class=\"command\"\u003eINSERT\u003c/code\u003e command. The value specified must be a number greater than zero. Any error during restoring will cause only rows that are part of the problematic \u003ccode class=\"command\"\u003eINSERT\u003c/code\u003e to be lost, rather than the entire table contents.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--section=\u003cem class=\"replaceable\"\u003e\u003ccode\u003esectionname\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eOnly dump the named section. The section name can be \u003ccode class=\"option\"\u003epre-data\u003c/code\u003e, \u003ccode class=\"option\"\u003edata\u003c/code\u003e, or \u003ccode class=\"option\"\u003epost-data\u003c/code\u003e. This option can be specified more than once to select multiple sections. The default is to dump all sections.\u003c/p\u003e\n\u003cp\u003eThe data section contains actual table data, large-object contents, sequence values, and statistics for tables, materialized views, and foreign tables. Post-data items include definitions of indexes, triggers, rules, statistics for indexes, and constraints other than validated check and not-null constraints. Pre-data items include all other data definition items.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--sequence-data\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eInclude sequence data in the dump. This is the default behavior except when \u003ccode class=\"option\"\u003e--no-data\u003c/code\u003e, \u003ccode class=\"option\"\u003e--schema-only\u003c/code\u003e, or \u003ccode class=\"option\"\u003e--statistics-only\u003c/code\u003e is specified.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--serializable-deferrable\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eUse a \u003ccode class=\"literal\"\u003eserializable\u003c/code\u003e transaction for the dump, to ensure that the snapshot used is consistent with later database states; but do this by waiting for a point in the transaction stream at which no anomalies can be present, so that there isn't a risk of the dump failing or causing other transactions to roll back with a \u003ccode class=\"literal\"\u003eserialization_failure\u003c/code\u003e. See \u003ca class=\"xref\" href=\"/docs/18/mvcc.html\" title=\"Chapter 13. Concurrency Control\"\u003eChapter 13\u003c/a\u003e for more information about transaction isolation and concurrency control.\u003c/p\u003e\n\u003cp\u003eThis option is not beneficial for a dump which is intended only for disaster recovery. It could be useful for a dump used to load a copy of the database for reporting or other read-only load sharing while the original database continues to be updated. Without it the dump may reflect a state which is not consistent with any serial execution of the transactions eventually committed. For example, if batch processing techniques are used, a batch may show as closed in the dump without all of the items which are in the batch appearing.\u003c/p\u003e\n\u003cp\u003eThis option will make no difference if there are no read-write transactions active when pg_dump is started. If read-write transactions are active, the start of the dump may be delayed for an indeterminate length of time. Once running, performance with or without the switch is the same.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--snapshot=\u003cem class=\"replaceable\"\u003e\u003ccode\u003esnapshotname\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eUse the specified synchronized snapshot when making a dump of the database (see \u003ca class=\"xref\" href=\"/docs/18/functions-admin.html#FUNCTIONS-SNAPSHOT-SYNCHRONIZATION-TABLE\" title=\"Table 9.100. Snapshot Synchronization Functions\"\u003eTable 9.100\u003c/a\u003e for more details).\u003c/p\u003e\n\u003cp\u003eThis option is useful when needing to synchronize the dump with a logical replication slot (see \u003ca class=\"xref\" href=\"/docs/18/logicaldecoding.html\" title=\"Chapter 47. Logical Decoding\"\u003eChapter 47\u003c/a\u003e) or with a concurrent session.\u003c/p\u003e\n\u003cp\u003eIn the case of a parallel dump, the snapshot name defined by this option is used rather than taking a new snapshot.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--statistics\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDump optimizer statistics.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--statistics-only\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDump only the statistics, not the schema (data definitions) or data. Optimizer statistics for tables, materialized views, foreign tables, and indexes are dumped.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--strict-names\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eRequire that each extension (\u003ccode class=\"option\"\u003e-e\u003c/code\u003e/\u003ccode class=\"option\"\u003e--extension\u003c/code\u003e), schema (\u003ccode class=\"option\"\u003e-n\u003c/code\u003e/\u003ccode class=\"option\"\u003e--schema\u003c/code\u003e) and table (\u003ccode class=\"option\"\u003e-t\u003c/code\u003e/\u003ccode class=\"option\"\u003e--table\u003c/code\u003e) pattern match at least one extension/schema/table in the database to be dumped. This also applies to filters used with \u003ccode class=\"option\"\u003e--filter\u003c/code\u003e. Note that if none of the extension/schema/table patterns find matches, \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e will generate an error even without \u003ccode class=\"option\"\u003e--strict-names\u003c/code\u003e.\u003c/p\u003e\n\u003cp\u003eThis option has no effect on \u003ccode class=\"option\"\u003e--exclude-extension\u003c/code\u003e, \u003ccode class=\"option\"\u003e-N\u003c/code\u003e/\u003ccode class=\"option\"\u003e--exclude-schema\u003c/code\u003e, \u003ccode class=\"option\"\u003e-T\u003c/code\u003e/\u003ccode class=\"option\"\u003e--exclude-table\u003c/code\u003e, or \u003ccode class=\"option\"\u003e--exclude-table-data\u003c/code\u003e. An exclude pattern failing to match any objects is not considered an error.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--sync-method=\u003cem class=\"replaceable\"\u003e\u003ccode\u003emethod\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eWhen set to \u003ccode class=\"literal\"\u003efsync\u003c/code\u003e, which is the default, \u003ccode class=\"command\"\u003epg_dump --format=directory\u003c/code\u003e will recursively open and synchronize all files in the archive directory.\u003c/p\u003e\n\u003cp\u003eOn Linux, \u003ccode class=\"literal\"\u003esyncfs\u003c/code\u003e may be used instead to ask the operating system to synchronize the whole file system that contains the archive directory. See \u003ca class=\"xref\" href=\"/docs/18/runtime-config-error-handling.html#GUC-RECOVERY-INIT-SYNC-METHOD\"\u003erecovery_init_sync_method\u003c/a\u003e for information about the caveats to be aware of when using \u003ccode class=\"literal\"\u003esyncfs\u003c/code\u003e.\u003c/p\u003e\n\u003cp\u003eThis option has no effect when \u003ccode class=\"option\"\u003e--no-sync\u003c/code\u003e is used or \u003ccode class=\"option\"\u003e--format\u003c/code\u003e is not set to \u003ccode class=\"literal\"\u003edirectory\u003c/code\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--table-and-children=\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThis is the same as the \u003ccode class=\"option\"\u003e-t\u003c/code\u003e/\u003ccode class=\"option\"\u003e--table\u003c/code\u003e option, except that it also includes any partitions or inheritance child tables of the table(s) matching the \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--use-set-session-authorization\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eOutput SQL-standard \u003ccode class=\"command\"\u003eSET SESSION AUTHORIZATION\u003c/code\u003e commands instead of \u003ccode class=\"command\"\u003eALTER OWNER\u003c/code\u003e commands to determine object ownership. This makes the dump more standards-compatible, but depending on the history of the objects in the dump, might not restore properly. Also, a dump using \u003ccode class=\"command\"\u003eSET SESSION AUTHORIZATION\u003c/code\u003e will certainly require superuser privileges to restore correctly, whereas \u003ccode class=\"command\"\u003eALTER OWNER\u003c/code\u003e requires lesser privileges.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-?\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--help\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eShow help about \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e command line arguments, and exit.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003cp\u003eThe following command-line options control the database connection parameters.\u003c/p\u003e\n\u003cdiv class=\"variablelist\"\u003e\n\u003cdl class=\"variablelist\"\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-d \u003cem class=\"replaceable\"\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--dbname=\u003cem class=\"replaceable\"\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the name of the database to connect to. This is equivalent to specifying \u003cem class=\"replaceable\"\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e as the first non-option argument on the command line. The \u003cem class=\"replaceable\"\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e can be a \u003ca class=\"link\" href=\"/docs/18/libpq-connect.html#LIBPQ-CONNSTRING\" title=\"32.1.1. Connection Strings\"\u003econnection string\u003c/a\u003e. If so, connection string parameters will override any conflicting command line options.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-h \u003cem class=\"replaceable\"\u003e\u003ccode\u003ehost\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--host=\u003cem class=\"replaceable\"\u003e\u003ccode\u003ehost\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket. The default is taken from the \u003ccode class=\"envar\"\u003ePGHOST\u003c/code\u003e environment variable, if set, else a Unix domain socket connection is attempted.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-p \u003cem class=\"replaceable\"\u003e\u003ccode\u003eport\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--port=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eport\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the \u003ccode class=\"envar\"\u003ePGPORT\u003c/code\u003e environment variable, if set, or a compiled-in default.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-U \u003cem class=\"replaceable\"\u003e\u003ccode\u003eusername\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--username=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eusername\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eUser name to connect as.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-w\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-password\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eNever issue a password prompt. If the server requires password authentication and a password is not available by other means such as a \u003ccode class=\"filename\"\u003e.pgpass\u003c/code\u003e file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-W\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--password\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eForce \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e to prompt for a password before connecting to a database.\u003c/p\u003e\n\u003cp\u003eThis option is never essential, since \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e will automatically prompt for a password if the server demands password authentication. However, \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing \u003ccode class=\"option\"\u003e-W\u003c/code\u003e to avoid the extra connection attempt.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--role=\u003cem class=\"replaceable\"\u003e\u003ccode\u003erolename\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies a role name to be used to create the dump. This option causes \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e to issue a \u003ccode class=\"command\"\u003eSET ROLE\u003c/code\u003e \u003cem class=\"replaceable\"\u003e\u003ccode\u003erolename\u003c/code\u003e\u003c/em\u003e command after connecting to the database. It is useful when the authenticated user (specified by \u003ccode class=\"option\"\u003e-U\u003c/code\u003e) lacks privileges needed by \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e, but can switch to a role with the required rights. Some installations have a policy against logging in directly as a superuser, and use of this option allows dumps to be made without violating the policy.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"id-1.9.4.14.7\"\u003e\n\u003ch2\u003eEnvironment\u003c/h2\u003e\n\u003cdiv class=\"variablelist\"\u003e\n\u003cdl class=\"variablelist\"\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003ePGDATABASE\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003ePGHOST\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003ePGOPTIONS\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003ePGPORT\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003ePGUSER\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDefault connection parameters.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003ePG_COLOR\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies whether to use color in diagnostic messages. Possible values are \u003ccode class=\"literal\"\u003ealways\u003c/code\u003e, \u003ccode class=\"literal\"\u003eauto\u003c/code\u003e and \u003ccode class=\"literal\"\u003enever\u003c/code\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003cp\u003eThis utility, like most other \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e utilities, also uses the environment variables supported by \u003cspan class=\"application\"\u003elibpq\u003c/span\u003e (see \u003ca class=\"xref\" href=\"/docs/18/libpq-envars.html\" title=\"32.15. Environment Variables\"\u003eSection 32.15\u003c/a\u003e).\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"APP-PGDUMP-DIAGNOSTICS\"\u003e\n\u003ch2\u003eDiagnostics\u003c/h2\u003e\n\u003cp\u003e\u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e internally executes \u003ccode class=\"command\"\u003eSELECT\u003c/code\u003e statements. If you have problems running \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e, make sure you are able to select information from the database using, for example, \u003ca class=\"xref\" href=\"/docs/18/app-psql.html\" title=\"psql\"\u003e\u003cspan class=\"refentrytitle\"\u003e\u003cspan class=\"application\"\u003epsql\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e. Also, any default connection settings and environment variables used by the \u003cspan class=\"application\"\u003elibpq\u003c/span\u003e front-end library will apply.\u003c/p\u003e\n\u003cp\u003eThe database activity of \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e is normally collected by the cumulative statistics system. If this is undesirable, you can set parameter \u003ccode class=\"varname\"\u003etrack_counts\u003c/code\u003e to false via \u003ccode class=\"envar\"\u003ePGOPTIONS\u003c/code\u003e or the \u003ccode class=\"literal\"\u003eALTER USER\u003c/code\u003e command.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"PG-DUMP-NOTES\"\u003e\n\u003ch2\u003eNotes\u003c/h2\u003e\n\u003cp\u003eIf your database cluster has any local additions to the \u003ccode class=\"literal\"\u003etemplate1\u003c/code\u003e database, be careful to restore the output of \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e into a truly empty database; otherwise you are likely to get errors due to duplicate definitions of the added objects. To make an empty database without any local additions, copy from \u003ccode class=\"literal\"\u003etemplate0\u003c/code\u003e not \u003ccode class=\"literal\"\u003etemplate1\u003c/code\u003e, for example:\u003c/p\u003e\n\u003cpre class=\"programlisting\"\u003eCREATE DATABASE foo WITH TEMPLATE template0;\n\u003c/pre\u003e\n\u003cp\u003eWhen a dump without schema is chosen and the option \u003ccode class=\"option\"\u003e--disable-triggers\u003c/code\u003e is used, \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e emits commands to disable triggers on user tables before inserting the data, and then commands to re-enable them after the data has been inserted. If the restore is stopped in the middle, the system catalogs might be left in the wrong state.\u003c/p\u003e\n\u003cp\u003eWhen \u003ccode class=\"option\"\u003e--statistics\u003c/code\u003e is specified, \u003ccode class=\"command\"\u003epg_dump\u003c/code\u003e will include most optimizer statistics in the resulting dump file. This does not include all statistics, such as those created explicitly with \u003ca class=\"xref\" href=\"/docs/18/sql-createstatistics.html\" title=\"CREATE STATISTICS\"\u003e\u003cspan class=\"refentrytitle\"\u003eCREATE STATISTICS\u003c/span\u003e\u003c/a\u003e, custom statistics added by an extension, or statistics collected by the cumulative statistics system. Therefore, it may still be useful to run \u003ccode class=\"command\"\u003eANALYZE\u003c/code\u003e after restoring from a dump file to ensure optimal performance; see \u003ca class=\"xref\" href=\"/docs/18/routine-vacuuming.html#VACUUM-FOR-STATISTICS\" title=\"24.1.3. Updating Planner Statistics\"\u003eSection 24.1.3\u003c/a\u003e and \u003ca class=\"xref\" href=\"/docs/18/routine-vacuuming.html#AUTOVACUUM\" title=\"24.1.6. The Autovacuum Daemon\"\u003eSection 24.1.6\u003c/a\u003e for more information.\u003c/p\u003e\n\u003cp\u003eBecause \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e is used to transfer data to newer versions of \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e, the output of \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e can be expected to load into \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e server versions newer than \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e's version. \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e can also dump from \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e servers older than its own version. (Currently, servers back to version 9.2 are supported.) However, \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e cannot dump from \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e servers newer than its own major version; it will refuse to even try, rather than risk making an invalid dump. Also, it is not guaranteed that \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e's output can be loaded into a server of an older major version — not even if the dump was taken from a server of that version. Loading a dump file into an older server may require manual editing of the dump file to remove syntax not understood by the older server. Use of the \u003ccode class=\"option\"\u003e--quote-all-identifiers\u003c/code\u003e option is recommended in cross-version cases, as it can prevent problems arising from varying reserved-word lists in different \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e versions.\u003c/p\u003e\n\u003cp\u003eWhen dumping logical replication subscriptions, \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e will generate \u003ccode class=\"command\"\u003eCREATE SUBSCRIPTION\u003c/code\u003e commands that use the \u003ccode class=\"literal\"\u003econnect = false\u003c/code\u003e option, so that restoring the subscription does not make remote connections for creating a replication slot or for initial table copy. That way, the dump can be restored without requiring network access to the remote servers. It is then up to the user to reactivate the subscriptions in a suitable way. If the involved hosts have changed, the connection information might have to be changed. It might also be appropriate to truncate the target tables before initiating a new full table copy. If users intend to copy initial data during refresh they must create the slot with \u003ccode class=\"literal\"\u003etwo_phase = false\u003c/code\u003e. After the initial sync, the \u003ca class=\"link\" href=\"/docs/18/sql-createsubscription.html#SQL-CREATESUBSCRIPTION-PARAMS-WITH-TWO-PHASE\"\u003e\u003ccode class=\"literal\"\u003etwo_phase\u003c/code\u003e\u003c/a\u003e option will be automatically enabled by the subscriber if the subscription had been originally created with \u003ccode class=\"literal\"\u003etwo_phase = true\u003c/code\u003e option.\u003c/p\u003e\n\u003cp\u003eIt is generally recommended to use the \u003ccode class=\"option\"\u003e-X\u003c/code\u003e (\u003ccode class=\"option\"\u003e--no-psqlrc\u003c/code\u003e) option when restoring a database from a plain-text \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e script to ensure a clean restore process and prevent potential conflicts with non-default \u003cspan class=\"application\"\u003epsql\u003c/span\u003e configurations.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"PG-DUMP-EXAMPLES\"\u003e\n\u003ch2\u003eExamples\u003c/h2\u003e\n\u003cp\u003eTo dump a database called \u003ccode class=\"literal\"\u003emydb\u003c/code\u003e into an SQL-script file:\u003c/p\u003e\n\u003cpre class=\"screen\"\u003e\u003ccode class=\"prompt\"\u003e$\u003c/code\u003e \u003cstrong class=\"userinput\"\u003e\u003ccode\u003epg_dump mydb \u0026gt; db.sql\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\n\u003cp\u003eTo reload such a script into a (freshly created) database named \u003ccode class=\"literal\"\u003enewdb\u003c/code\u003e:\u003c/p\u003e\n\u003cpre class=\"screen\"\u003e\u003ccode class=\"prompt\"\u003e$\u003c/code\u003e \u003cstrong class=\"userinput\"\u003e\u003ccode\u003epsql -X -d newdb -f db.sql\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\n\u003cp\u003eTo dump a database into a custom-format archive file:\u003c/p\u003e\n\u003cpre class=\"screen\"\u003e\u003ccode class=\"prompt\"\u003e$\u003c/code\u003e \u003cstrong class=\"userinput\"\u003e\u003ccode\u003epg_dump -Fc mydb \u0026gt; db.dump\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\n\u003cp\u003eTo dump a database into a directory-format archive:\u003c/p\u003e\n\u003cpre class=\"screen\"\u003e\u003ccode class=\"prompt\"\u003e$\u003c/code\u003e \u003cstrong class=\"userinput\"\u003e\u003ccode\u003epg_dump -Fd mydb -f dumpdir\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\n\u003cp\u003eTo dump a database into a directory-format archive in parallel with 5 worker jobs:\u003c/p\u003e\n\u003cpre class=\"screen\"\u003e\u003ccode class=\"prompt\"\u003e$\u003c/code\u003e \u003cstrong class=\"userinput\"\u003e\u003ccode\u003epg_dump -Fd mydb -j 5 -f dumpdir\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\n\u003cp\u003eTo reload an archive file into a (freshly created) database named \u003ccode class=\"literal\"\u003enewdb\u003c/code\u003e:\u003c/p\u003e\n\u003cpre class=\"screen\"\u003e\u003ccode class=\"prompt\"\u003e$\u003c/code\u003e \u003cstrong class=\"userinput\"\u003e\u003ccode\u003epg_restore -d newdb db.dump\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\n\u003cp\u003eTo reload an archive file into the same database it was dumped from, discarding the current contents of that database:\u003c/p\u003e\n\u003cpre class=\"screen\"\u003e\u003ccode class=\"prompt\"\u003e$\u003c/code\u003e \u003cstrong class=\"userinput\"\u003e\u003ccode\u003epg_restore -d postgres --clean --create db.dump\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\n\u003cp\u003eTo dump a single table named \u003ccode class=\"literal\"\u003emytab\u003c/code\u003e:\u003c/p\u003e\n\u003cpre class=\"screen\"\u003e\u003ccode class=\"prompt\"\u003e$\u003c/code\u003e \u003cstrong class=\"userinput\"\u003e\u003ccode\u003epg_dump -t mytab mydb \u0026gt; db.sql\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\n\u003cp\u003eTo dump all tables whose names start with \u003ccode class=\"literal\"\u003eemp\u003c/code\u003e in the \u003ccode class=\"literal\"\u003edetroit\u003c/code\u003e schema, except for the table named \u003ccode class=\"literal\"\u003eemployee_log\u003c/code\u003e:\u003c/p\u003e\n\u003cpre class=\"screen\"\u003e\u003ccode class=\"prompt\"\u003e$\u003c/code\u003e \u003cstrong class=\"userinput\"\u003e\u003ccode\u003epg_dump -t 'detroit.emp*' -T detroit.employee_log mydb \u0026gt; db.sql\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\n\u003cp\u003eTo dump all schemas whose names start with \u003ccode class=\"literal\"\u003eeast\u003c/code\u003e or \u003ccode class=\"literal\"\u003ewest\u003c/code\u003e and end in \u003ccode class=\"literal\"\u003egsm\u003c/code\u003e, excluding any schemas whose names contain the word \u003ccode class=\"literal\"\u003etest\u003c/code\u003e:\u003c/p\u003e\n\u003cpre class=\"screen\"\u003e\u003ccode class=\"prompt\"\u003e$\u003c/code\u003e \u003cstrong class=\"userinput\"\u003e\u003ccode\u003epg_dump -n 'east*gsm' -n 'west*gsm' -N '*test*' mydb \u0026gt; db.sql\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\n\u003cp\u003eThe same, using regular expression notation to consolidate the switches:\u003c/p\u003e\n\u003cpre class=\"screen\"\u003e\u003ccode class=\"prompt\"\u003e$\u003c/code\u003e \u003cstrong class=\"userinput\"\u003e\u003ccode\u003epg_dump -n '(east|west)*gsm' -N '*test*' mydb \u0026gt; db.sql\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\n\u003cp\u003eTo dump all database objects except for tables whose names begin with \u003ccode class=\"literal\"\u003ets_\u003c/code\u003e:\u003c/p\u003e\n\u003cpre class=\"screen\"\u003e\u003ccode class=\"prompt\"\u003e$\u003c/code\u003e \u003cstrong class=\"userinput\"\u003e\u003ccode\u003epg_dump -T 'ts_*' mydb \u0026gt; db.sql\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\n\u003cp\u003eTo specify an upper-case or mixed-case name in \u003ccode class=\"option\"\u003e-t\u003c/code\u003e and related switches, you need to double-quote the name; else it will be folded to lower case (see \u003ca class=\"xref\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003ePatterns\u003c/a\u003e). But double quotes are special to the shell, so in turn they must be quoted. Thus, to dump a single table with a mixed-case name, you need something like\u003c/p\u003e\n\u003cpre class=\"screen\"\u003e\u003ccode class=\"prompt\"\u003e$\u003c/code\u003e \u003cstrong class=\"userinput\"\u003e\u003ccode\u003epg_dump -t \"\\\"MixedCaseName\\\"\" mydb \u0026gt; mytab.sql\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\n\u003cp\u003eTo dump all tables whose names start with \u003ccode class=\"literal\"\u003emytable\u003c/code\u003e, except for table \u003ccode class=\"literal\"\u003emytable2\u003c/code\u003e, specify a filter file \u003ccode class=\"filename\"\u003efilter.txt\u003c/code\u003e like:\u003c/p\u003e\n\u003cpre class=\"programlisting\"\u003einclude table mytable*\nexclude table mytable2\n\u003c/pre\u003e\n\u003cpre class=\"screen\"\u003e\u003ccode class=\"prompt\"\u003e$\u003c/code\u003e \u003cstrong class=\"userinput\"\u003e\u003ccode\u003epg_dump --filter=filter.txt mydb \u0026gt; db.sql\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"id-1.9.4.14.11\"\u003e\n\u003ch2\u003eSee Also\u003c/h2\u003e\u003cspan class=\"simplelist\"\u003e\u003ca class=\"xref\" href=\"/docs/18/app-pg-dumpall.html\" title=\"pg_dumpall\"\u003e\u003cspan class=\"refentrytitle\"\u003e\u003cspan class=\"application\"\u003epg_dumpall\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e, \u003ca class=\"xref\" href=\"/docs/18/app-pgrestore.html\" title=\"pg_restore\"\u003e\u003cspan class=\"refentrytitle\"\u003e\u003cspan class=\"application\"\u003epg_restore\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e, \u003ca class=\"xref\" href=\"/docs/18/app-psql.html\" title=\"psql\"\u003e\u003cspan class=\"refentrytitle\"\u003e\u003cspan class=\"application\"\u003epsql\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003c/span\u003e\n\u003c/div\u003e\n\u003c/div\u003e\u003c/div\u003e","manual_path":"app-pgdump.html","options":[{"description":"Dump only the data, not the schema (data definitions) or statistics. Table data, large objects, and sequence values are dumped. This option is similar to, but for historical reasons not identical to, specifying --section=data .","names":["-a","--data-only"],"signature":"-a --data-only","source_url":"/docs/18/app-pgdump.html","summary":"Dump only the data, not the schema (data definitions) or statistics. Table data, large objects, and sequence values are dumped."},{"description":"Include large objects in the dump. This is the default behavior except when --schema , --table , --schema-only , --statistics-only , or --no-data is specified. The -b switch is therefore only useful to add large objects to dumps where a specific schema or table has been requested. Note that large objects are considered data and therefore will be included when --data-only is used, but not when --schema-only or --statistics-only is.","names":["-b","--large-objects","--blobs"],"signature":"-b --large-objects --blobs (deprecated)","source_url":"/docs/18/app-pgdump.html","summary":"Include large objects in the dump. This is the default behavior except when --schema , --table , --schema-only , --statistics-only , or --no-data is specified. The -b switch is therefore only useful to add large objects to dumps where a specific schema or table has been requested. Note that large objects are considered data and therefore will be included when --data-only is used, but not when --schema-only or --statistics-only is."},{"description":"Exclude large objects in the dump. When both -b and -B are given, the behavior is to output large objects, when data is being dumped, see the -b documentation.","names":["-B","--no-large-objects","--no-blobs"],"signature":"-B --no-large-objects --no-blobs (deprecated)","source_url":"/docs/18/app-pgdump.html","summary":"Exclude large objects in the dump."},{"description":"Output commands to DROP all the dumped database objects prior to outputting the commands for creating them. This option is useful when the restore is to overwrite an existing database. If any of the objects do not exist in the destination database, ignorable error messages will be reported during restore, unless --if-exists is also specified. This option is ignored when emitting an archive (non-text) output file. For the archive formats, you can specify the option when you call pg_restore .","names":["-c","--clean"],"signature":"-c --clean","source_url":"/docs/18/app-pgdump.html","summary":"Output commands to DROP all the dumped database objects prior to outputting the commands for creating them. This option is useful when the restore is to overwrite an existing database. If any of the objects do not exist in the destination database, ignorable error messages will be reported during restore, unless --if-exists is also specified."},{"description":"Begin the output with a command to create the database itself and reconnect to the created database. (With a script of this form, it doesn't matter which database in the destination installation you connect to before running the script.) If --clean is also specified, the script drops and recreates the target database before reconnecting to it. With --create , the output also includes the database's comment if any, and any configuration variable settings that are specific to this database, that is, any ALTER DATABASE ... SET ... and ALTER ROLE ... IN DATABASE ... SET ... commands that mention this database. Access privileges for the database itself are also dumped, unless --no-acl is specified. This option is ignored when emitting an archive (non-text) output file. For the archive formats, you can specify the option when you call pg_restore .","names":["-C","--create"],"signature":"-C --create","source_url":"/docs/18/app-pgdump.html","summary":"Begin the output with a command to create the database itself and reconnect to the created database. (With a script of this form, it doesn't matter which database in the destination installation you connect to before running the script.) If --clean is also specified, the script drops and recreates the target database before reconnecting to it."},{"description":"Dump only extensions matching pattern . When this option is not specified, all non-system extensions in the target database will be dumped. Multiple extensions can be selected by writing multiple -e switches. The pattern parameter is interpreted as a pattern according to the same rules used by psql 's \\d commands (see Patterns ), so multiple extensions can also be selected by writing wildcard characters in the pattern. When using wildcards, be careful to quote the pattern if needed to prevent the shell from expanding the wildcards. Any configuration relation registered by pg_extension_config_dump is included in the dump if its extension is specified by --extension . Note When -e is specified, pg_dump makes no attempt to dump any other database objects that the selected extension(s) might depend upon. Therefore, there is no guarantee that the results of a specific-extension dump can be successfully restored by themselves into a clean database.","names":["-e pattern","--extension= pattern"],"signature":"-e pattern --extension= pattern","source_url":"/docs/18/app-pgdump.html","summary":"Dump only extensions matching pattern . When this option is not specified, all non-system extensions in the target database will be dumped. Multiple extensions can be selected by writing multiple -e switches. The pattern parameter is interpreted as a pattern according to the same rules used by psql 's \\d commands (see Patterns ), so multiple extensions can also be selected by writing wildcard characters in the pattern. When using wildcards, be careful to quote the pattern if needed to prevent the shell from expanding the wildcards."},{"description":"Create the dump in the specified character set encoding. By default, the dump is created in the database encoding. (Another way to get the same result is to set the PGCLIENTENCODING environment variable to the desired dump encoding.) The supported encodings are described in Section 23.3.1 .","names":["-E encoding","--encoding= encoding"],"signature":"-E encoding --encoding= encoding","source_url":"/docs/18/app-pgdump.html","summary":"Create the dump in the specified character set encoding. By default, the dump is created in the database encoding. (Another way to get the same result is to set the PGCLIENTENCODING environment variable to the desired dump encoding.) The supported encodings are described in Section 23.3.1 ."},{"description":"Send output to the specified file. This parameter can be omitted for file based output formats, in which case the standard output is used. It must be given for the directory output format however, where it specifies the target directory instead of a file. In this case the directory is created by pg_dump and must not exist before.","names":["-f file","--file= file"],"signature":"-f file --file= file","source_url":"/docs/18/app-pgdump.html","summary":"Send output to the specified file. This parameter can be omitted for file based output formats, in which case the standard output is used. It must be given for the directory output format however, where it specifies the target directory instead of a file. In this case the directory is created by pg_dump and must not exist before."},{"description":"Selects the format of the output. format can be one of the following: p plain Output a plain-text SQL script file (the default). c custom Output a custom-format archive suitable for input into pg_restore . Together with the directory output format, this is the most flexible output format in that it allows manual selection and reordering of archived items during restore. This format is also compressed by default. d directory Output a directory-format archive suitable for input into pg_restore . This will create a directory with one file for each table and large object being dumped, plus a so-called Table of Contents file describing the dumped objects in a machine-readable format that pg_restore can read. A directory format archive can be manipulated with standard Unix tools; for example, files in an uncompressed archive can be compressed with the gzip , lz4 , or zstd tools. This format is compressed by default using gzip and also supports parallel dumps. t tar Output a tar -format archive suitable for input into pg_restore . The tar format is compatible with the directory format: extracting a tar-format archive produces a valid directory-format archive. However, the tar format does not support compression. Also, when using tar format the relative order of table data items cannot be changed during restore.","names":["-F format","--format= format"],"signature":"-F format --format= format","source_url":"/docs/18/app-pgdump.html","summary":"Selects the format of the output. format can be one of the following:"},{"description":"Run the dump in parallel by dumping njobs tables simultaneously. This option may reduce the time needed to perform the dump but it also increases the load on the database server. You can only use this option with the directory output format because this is the only output format where multiple processes can write their data at the same time. pg_dump will open njobs + 1 connections to the database, so make sure your max_connections setting is high enough to accommodate all connections. Requesting exclusive locks on database objects while running a parallel dump could cause the dump to fail. The reason is that the pg_dump leader process requests shared locks ( ACCESS SHARE ) on the objects that the worker processes are going to dump later in order to make sure that nobody deletes them and makes them go away while the dump is running. If another client then requests an exclusive lock on a table, that lock will not be granted but will be queued waiting for the shared lock of the leader process to be released. Consequently any other access to the table will not be granted either and will queue after the exclusive lock request. This includes the worker process trying to dump the table. Without any precautions this would be a classic deadlock situation. To detect this conflict, the pg_dump worker process requests another shared lock using the NOWAIT option. If the worker process is not granted this shared lock, somebody else must have requested an exclusive lock in the meantime and there is no way to continue with the dump, so pg_dump has no choice but to abort the dump. To perform a parallel dump, the database server needs to support synchronized snapshots, a feature that was introduced in PostgreSQL 9.2 for primary servers and 10 for standbys. With this feature, database clients can ensure they see the same data set even though they use different connections. pg_dump -j uses multiple database connections; it connects to the database once with the leader process and once again for each worker job. Without the synchronized snapshot feature, the different worker jobs wouldn't be guaranteed to see the same data in each connection, which could lead to an inconsistent backup.","names":["-j njobs","--jobs= njobs"],"signature":"-j njobs --jobs= njobs","source_url":"/docs/18/app-pgdump.html","summary":"Run the dump in parallel by dumping njobs tables simultaneously. This option may reduce the time needed to perform the dump but it also increases the load on the database server. You can only use this option with the directory output format because this is the only output format where multiple processes can write their data at the same time."},{"description":"Dump only schemas matching pattern ; this selects both the schema itself, and all its contained objects. When this option is not specified, all non-system schemas in the target database will be dumped. Multiple schemas can be selected by writing multiple -n switches. The pattern parameter is interpreted as a pattern according to the same rules used by psql 's \\d commands (see Patterns ), so multiple schemas can also be selected by writing wildcard characters in the pattern. When using wildcards, be careful to quote the pattern if needed to prevent the shell from expanding the wildcards; see Examples below. Note When -n is specified, pg_dump makes no attempt to dump any other database objects that the selected schema(s) might depend upon. Therefore, there is no guarantee that the results of a specific-schema dump can be successfully restored by themselves into a clean database. Note Non-schema objects such as large objects are not dumped when -n is specified. You can add large objects back to the dump with the --large-objects switch.","names":["-n pattern","--schema= pattern"],"signature":"-n pattern --schema= pattern","source_url":"/docs/18/app-pgdump.html","summary":"Dump only schemas matching pattern ; this selects both the schema itself, and all its contained objects. When this option is not specified, all non-system schemas in the target database will be dumped. Multiple schemas can be selected by writing multiple -n switches. The pattern parameter is interpreted as a pattern according to the same rules used by psql 's \\d commands (see Patterns ), so multiple schemas can also be selected by writing wildcard characters in the pattern. When using wildcards, be careful to quote the pattern if needed to prevent the shell from expanding the wildcards; see Examples below."},{"description":"Do not dump any schemas matching pattern . The pattern is interpreted according to the same rules as for -n . -N can be given more than once to exclude schemas matching any of several patterns. When both -n and -N are given, the behavior is to dump just the schemas that match at least one -n switch but no -N switches. If -N appears without -n , then schemas matching -N are excluded from what is otherwise a normal dump.","names":["-N pattern","--exclude-schema= pattern"],"signature":"-N pattern --exclude-schema= pattern","source_url":"/docs/18/app-pgdump.html","summary":"Do not dump any schemas matching pattern . The pattern is interpreted according to the same rules as for -n . -N can be given more than once to exclude schemas matching any of several patterns."},{"description":"Do not output commands to set ownership of objects to match the original database. By default, pg_dump issues ALTER OWNER or SET SESSION AUTHORIZATION statements to set ownership of created database objects. These statements will fail when the script is run unless it is started by a superuser (or the same user that owns all of the objects in the script). To make a script that can be restored by any user, but will give that user ownership of all the objects, specify -O . This option is ignored when emitting an archive (non-text) output file. For the archive formats, you can specify the option when you call pg_restore .","names":["-O","--no-owner"],"signature":"-O --no-owner","source_url":"/docs/18/app-pgdump.html","summary":"Do not output commands to set ownership of objects to match the original database. By default, pg_dump issues ALTER OWNER or SET SESSION AUTHORIZATION statements to set ownership of created database objects. These statements will fail when the script is run unless it is started by a superuser (or the same user that owns all of the objects in the script). To make a script that can be restored by any user, but will give that user ownership of all the objects, specify -O ."},{"description":"This option is obsolete but still accepted for backwards compatibility.","names":["-R","--no-reconnect"],"signature":"-R --no-reconnect","source_url":"/docs/18/app-pgdump.html","summary":"This option is obsolete but still accepted for backwards compatibility."},{"description":"Dump only the object definitions (schema), not data or statistics. This option cannot be used with --data-only or --statistics-only . It is similar to, but for historical reasons not identical to, specifying --section=pre-data --section=post-data . (Do not confuse this with the --schema option, which uses the word “ schema ” in a different meaning.) To exclude table data for only a subset of tables in the database, see --exclude-table-data .","names":["-s","--schema-only"],"signature":"-s --schema-only","source_url":"/docs/18/app-pgdump.html","summary":"Dump only the object definitions (schema), not data or statistics."},{"description":"Specify the superuser user name to use when disabling triggers. This is relevant only if --disable-triggers is used. (Usually, it's better to leave this out, and instead start the resulting script as superuser.)","names":["-S username","--superuser= username"],"signature":"-S username --superuser= username","source_url":"/docs/18/app-pgdump.html","summary":"Specify the superuser user name to use when disabling triggers. This is relevant only if --disable-triggers is used. (Usually, it's better to leave this out, and instead start the resulting script as superuser.)"},{"description":"Dump only tables with names matching pattern . Multiple tables can be selected by writing multiple -t switches. The pattern parameter is interpreted as a pattern according to the same rules used by psql 's \\d commands (see Patterns ), so multiple tables can also be selected by writing wildcard characters in the pattern. When using wildcards, be careful to quote the pattern if needed to prevent the shell from expanding the wildcards; see Examples below. As well as tables, this option can be used to dump the definition of matching views, materialized views, foreign tables, and sequences. It will not dump the contents of views or materialized views, and the contents of foreign tables will only be dumped if the corresponding foreign server is specified with --include-foreign-data . The -n and -N switches have no effect when -t is used, because tables selected by -t will be dumped regardless of those switches, and non-table objects will not be dumped. Note When -t is specified, pg_dump makes no attempt to dump any other database objects that the selected table(s) might depend upon. Therefore, there is no guarantee that the results of a specific-table dump can be successfully restored by themselves into a clean database.","names":["-t pattern","--table= pattern"],"signature":"-t pattern --table= pattern","source_url":"/docs/18/app-pgdump.html","summary":"Dump only tables with names matching pattern . Multiple tables can be selected by writing multiple -t switches. The pattern parameter is interpreted as a pattern according to the same rules used by psql 's \\d commands (see Patterns ), so multiple tables can also be selected by writing wildcard characters in the pattern. When using wildcards, be careful to quote the pattern if needed to prevent the shell from expanding the wildcards; see Examples below."},{"description":"Do not dump any tables matching pattern . The pattern is interpreted according to the same rules as for -t . -T can be given more than once to exclude tables matching any of several patterns. When both -t and -T are given, the behavior is to dump just the tables that match at least one -t switch but no -T switches. If -T appears without -t , then tables matching -T are excluded from what is otherwise a normal dump.","names":["-T pattern","--exclude-table= pattern"],"signature":"-T pattern --exclude-table= pattern","source_url":"/docs/18/app-pgdump.html","summary":"Do not dump any tables matching pattern . The pattern is interpreted according to the same rules as for -t . -T can be given more than once to exclude tables matching any of several patterns."},{"description":"Specifies verbose mode. This will cause pg_dump to output detailed object comments and start/stop times to the dump file, and progress messages to standard error. Repeating the option causes additional debug-level messages to appear on standard error.","names":["-v","--verbose"],"signature":"-v --verbose","source_url":"/docs/18/app-pgdump.html","summary":"Specifies verbose mode. This will cause pg_dump to output detailed object comments and start/stop times to the dump file, and progress messages to standard error. Repeating the option causes additional debug-level messages to appear on standard error."},{"description":"Print the pg_dump version and exit.","names":["-V","--version"],"signature":"-V --version","source_url":"/docs/18/app-pgdump.html","summary":"Print the pg_dump version and exit."},{"description":"Prevent dumping of access privileges (grant/revoke commands).","names":["-x","--no-privileges","--no-acl"],"signature":"-x --no-privileges --no-acl","source_url":"/docs/18/app-pgdump.html","summary":"Prevent dumping of access privileges (grant/revoke commands)."},{"description":"Specify the compression method and/or the compression level to use. The compression method can be set to gzip , lz4 , zstd , or none for no compression. A compression detail string can optionally be specified. If the detail string is an integer, it specifies the compression level. Otherwise, it should be a comma-separated list of items, each of the form keyword or keyword=value . Currently, the supported keywords are level and long . If no compression level is specified, the default compression level will be used. If only a level is specified without mentioning an algorithm, gzip compression will be used if the level is greater than 0 , and no compression will be used if the level is 0 . For the custom and directory archive formats, this specifies compression of individual table-data segments, and the default is to compress using gzip at a moderate level. For plain text output, setting a nonzero compression level causes the entire output file to be compressed, as though it had been fed through gzip , lz4 , or zstd ; but the default is not to compress. With zstd compression, long mode may improve the compression ratio, at the cost of increased memory use. The tar archive format currently does not support compression at all.","names":["-Z level","-Z method","--compress= level","--compress= method"],"signature":"-Z level -Z method [: detail ] --compress= level --compress= method [: detail ]","source_url":"/docs/18/app-pgdump.html","summary":"Specify the compression method and/or the compression level to use. The compression method can be set to gzip , lz4 , zstd , or none for no compression. A compression detail string can optionally be specified. If the detail string is an integer, it specifies the compression level. Otherwise, it should be a comma-separated list of items, each of the form keyword or keyword=value . Currently, the supported keywords are level and long ."},{"description":"This option is for use by in-place upgrade utilities. Its use for other purposes is not recommended or supported. The behavior of the option may change in future releases without notice.","names":["--binary-upgrade"],"signature":"--binary-upgrade","source_url":"/docs/18/app-pgdump.html","summary":"This option is for use by in-place upgrade utilities. Its use for other purposes is not recommended or supported. The behavior of the option may change in future releases without notice."},{"description":"Dump data as INSERT commands with explicit column names ( INSERT INTO table ( column , ...) VALUES ... ). This will make restoration very slow; it is mainly useful for making dumps that can be loaded into non- PostgreSQL databases. Any error during restoring will cause only rows that are part of the problematic INSERT to be lost, rather than the entire table contents.","names":["--column-inserts","--attribute-inserts"],"signature":"--column-inserts --attribute-inserts","source_url":"/docs/18/app-pgdump.html","summary":"Dump data as INSERT commands with explicit column names ( INSERT INTO table ( column , ...) VALUES ... ). This will make restoration very slow; it is mainly useful for making dumps that can be loaded into non- PostgreSQL databases. Any error during restoring will cause only rows that are part of the problematic INSERT to be lost, rather than the entire table contents."},{"description":"This option disables the use of dollar quoting for function bodies, and forces them to be quoted using SQL standard string syntax.","names":["--disable-dollar-quoting"],"signature":"--disable-dollar-quoting","source_url":"/docs/18/app-pgdump.html","summary":"This option disables the use of dollar quoting for function bodies, and forces them to be quoted using SQL standard string syntax."},{"description":"This option is relevant only when creating a dump that includes data but does not include schema. It instructs pg_dump to include commands to temporarily disable triggers on the target tables while the data is restored. Use this if you have referential integrity checks or other triggers on the tables that you do not want to invoke during data restore. Presently, the commands emitted for --disable-triggers must be done as superuser. So, you should also specify a superuser name with -S , or preferably be careful to start the resulting script as a superuser. This option is ignored when emitting an archive (non-text) output file. For the archive formats, you can specify the option when you call pg_restore .","names":["--disable-triggers"],"signature":"--disable-triggers","source_url":"/docs/18/app-pgdump.html","summary":"This option is relevant only when creating a dump that includes data but does not include schema. It instructs pg_dump to include commands to temporarily disable triggers on the target tables while the data is restored. Use this if you have referential integrity checks or other triggers on the tables that you do not want to invoke during data restore."},{"description":"This option is relevant only when dumping the contents of a table which has row security. By default, pg_dump will set row_security to off, to ensure that all data is dumped from the table. If the user does not have sufficient privileges to bypass row security, then an error is thrown. This parameter instructs pg_dump to set row_security to on instead, allowing the user to dump the parts of the contents of the table that they have access to. Note that if you use this option currently, you probably also want the dump be in INSERT format, as the COPY FROM during restore does not support row security.","names":["--enable-row-security"],"signature":"--enable-row-security","source_url":"/docs/18/app-pgdump.html","summary":"This option is relevant only when dumping the contents of a table which has row security. By default, pg_dump will set row_security to off, to ensure that all data is dumped from the table. If the user does not have sufficient privileges to bypass row security, then an error is thrown. This parameter instructs pg_dump to set row_security to on instead, allowing the user to dump the parts of the contents of the table that they have access to."},{"description":"Do not dump any extensions matching pattern . The pattern is interpreted according to the same rules as for -e . --exclude-extension can be given more than once to exclude extensions matching any of several patterns. When both -e and --exclude-extension are given, the behavior is to dump just the extensions that match at least one -e switch but no --exclude-extension switches. If --exclude-extension appears without -e , then extensions matching --exclude-extension are excluded from what is otherwise a normal dump.","names":["--exclude-extension= pattern"],"signature":"--exclude-extension= pattern","source_url":"/docs/18/app-pgdump.html","summary":"Do not dump any extensions matching pattern . The pattern is interpreted according to the same rules as for -e . --exclude-extension can be given more than once to exclude extensions matching any of several patterns."},{"description":"This is the same as the -T / --exclude-table option, except that it also excludes any partitions or inheritance child tables of the table(s) matching the pattern .","names":["--exclude-table-and-children= pattern"],"signature":"--exclude-table-and-children= pattern","source_url":"/docs/18/app-pgdump.html","summary":"This is the same as the -T / --exclude-table option, except that it also excludes any partitions or inheritance child tables of the table(s) matching the pattern ."},{"description":"Do not dump data for any tables matching pattern . The pattern is interpreted according to the same rules as for -t . --exclude-table-data can be given more than once to exclude tables matching any of several patterns. This option is useful when you need the definition of a particular table even though you do not need the data in it. To exclude data for all tables in the database, see --schema-only or --statistics-only .","names":["--exclude-table-data= pattern"],"signature":"--exclude-table-data= pattern","source_url":"/docs/18/app-pgdump.html","summary":"Do not dump data for any tables matching pattern . The pattern is interpreted according to the same rules as for -t . --exclude-table-data can be given more than once to exclude tables matching any of several patterns. This option is useful when you need the definition of a particular table even though you do not need the data in it."},{"description":"This is the same as the --exclude-table-data option, except that it also excludes data of any partitions or inheritance child tables of the table(s) matching the pattern .","names":["--exclude-table-data-and-children= pattern"],"signature":"--exclude-table-data-and-children= pattern","source_url":"/docs/18/app-pgdump.html","summary":"This is the same as the --exclude-table-data option, except that it also excludes data of any partitions or inheritance child tables of the table(s) matching the pattern ."},{"description":"Use the specified value of extra_float_digits when dumping floating-point data, instead of the maximum available precision. Routine dumps made for backup purposes should not use this option.","names":["--extra-float-digits= ndigits"],"signature":"--extra-float-digits= ndigits","source_url":"/docs/18/app-pgdump.html","summary":"Use the specified value of extra_float_digits when dumping floating-point data, instead of the maximum available precision. Routine dumps made for backup purposes should not use this option."},{"description":"Specify a filename from which to read patterns for objects to include or exclude from the dump. The patterns are interpreted according to the same rules as the corresponding options: -t / --table , --table-and-children , -T / --exclude-table , and --exclude-table-and-children for tables, -n / --schema and -N / --exclude-schema for schemas, --include-foreign-data for data on foreign servers, --exclude-table-data and --exclude-table-data-and-children for table data, and -e / --extension and --exclude-extension for extensions. To read from STDIN , use - as the filename. The --filter option can be specified in conjunction with the above listed options for including or excluding objects, and can also be specified more than once for multiple filter files. The file lists one object pattern per row, with the following format: { include | exclude } { extension | foreign_data | table | table_and_children | table_data | table_data_and_children | schema } PATTERN The first keyword specifies whether the objects matched by the pattern are to be included or excluded. The second keyword specifies the type of object to be filtered using the pattern: extension : extensions. This works like the -e / --extension or --exclude-extension option. foreign_data : data on foreign servers. This works like the --include-foreign-data option. This keyword can only be used with the include keyword. table : tables. This works like the -t / --table or -T / --exclude-table option. table_and_children : tables including any partitions or inheritance child tables. This works like the --table-and-children or --exclude-table-and-children option. table_data : table data of any tables matching pattern . This works like the --exclude-table-data option. This keyword can only be used with the exclude keyword. table_data_and_children : table data of any tables matching pattern as well as any partitions or inheritance children of the table(s). This works like the --exclude-table-data-and-children option. This keyword can only be used with the exclude keyword. schema : schemas. This works like the -n / --schema or -N / --exclude-schema option. Lines starting with # are considered comments and ignored. Comments can be placed after an object pattern row as well. Blank lines are also ignored. See Patterns for how to perform quoting in patterns. Example files are listed below in the Examples section.","names":["--filter= filename"],"signature":"--filter= filename","source_url":"/docs/18/app-pgdump.html","summary":"Specify a filename from which to read patterns for objects to include or exclude from the dump. The patterns are interpreted according to the same rules as the corresponding options: -t / --table , --table-and-children , -T / --exclude-table , and --exclude-table-and-children for tables, -n / --schema and -N / --exclude-schema for schemas, --include-foreign-data for data on foreign servers, --exclude-table-data and --exclude-table-data-and-children for table data, and -e / --extension and --exclude-extension for extensions. To read from STDIN , use - as the filename. The --filter option can be specified in conjunction with the above listed options for including or excluding objects, and can also be specified more than once for multiple filter files."},{"description":"Use DROP ... IF EXISTS commands to drop objects in --clean mode. This suppresses “ does not exist ” errors that might otherwise be reported. This option is not valid unless --clean is also specified.","names":["--if-exists"],"signature":"--if-exists","source_url":"/docs/18/app-pgdump.html","summary":"Use DROP ... IF EXISTS commands to drop objects in --clean mode. This suppresses “ does not exist ” errors that might otherwise be reported. This option is not valid unless --clean is also specified."},{"description":"Dump the data for any foreign table with a foreign server matching foreignserver pattern. Multiple foreign servers can be selected by writing multiple --include-foreign-data switches. Also, the foreignserver parameter is interpreted as a pattern according to the same rules used by psql 's \\d commands (see Patterns ), so multiple foreign servers can also be selected by writing wildcard characters in the pattern. When using wildcards, be careful to quote the pattern if needed to prevent the shell from expanding the wildcards; see Examples below. The only exception is that an empty pattern is disallowed. Note Using wildcards in --include-foreign-data may result in access to unexpected foreign servers. Also, to use this option securely, make sure that the named server must have a trusted owner. Note When --include-foreign-data is specified, pg_dump does not check that the foreign table is writable. Therefore, there is no guarantee that the results of a foreign table dump can be successfully restored.","names":["--include-foreign-data= foreignserver"],"signature":"--include-foreign-data= foreignserver","source_url":"/docs/18/app-pgdump.html","summary":"Dump the data for any foreign table with a foreign server matching foreignserver pattern. Multiple foreign servers can be selected by writing multiple --include-foreign-data switches. Also, the foreignserver parameter is interpreted as a pattern according to the same rules used by psql 's \\d commands (see Patterns ), so multiple foreign servers can also be selected by writing wildcard characters in the pattern. When using wildcards, be careful to quote the pattern if needed to prevent the shell from expanding the wildcards; see Examples below. The only exception is that an empty pattern is disallowed."},{"description":"Dump data as INSERT commands (rather than COPY ). This will make restoration very slow; it is mainly useful for making dumps that can be loaded into non- PostgreSQL databases. Any error during restoring will cause only rows that are part of the problematic INSERT to be lost, rather than the entire table contents. Note that the restore might fail altogether if you have rearranged column order. The --column-inserts option is safe against column order changes, though even slower.","names":["--inserts"],"signature":"--inserts","source_url":"/docs/18/app-pgdump.html","summary":"Dump data as INSERT commands (rather than COPY ). This will make restoration very slow; it is mainly useful for making dumps that can be loaded into non- PostgreSQL databases. Any error during restoring will cause only rows that are part of the problematic INSERT to be lost, rather than the entire table contents. Note that the restore might fail altogether if you have rearranged column order. The --column-inserts option is safe against column order changes, though even slower."},{"description":"When dumping data for a table partition, make the COPY or INSERT statements target the root of the partitioning hierarchy that contains it, rather than the partition itself. This causes the appropriate partition to be re-determined for each row when the data is loaded. This may be useful when restoring data on a server where rows do not always fall into the same partitions as they did on the original server. That could happen, for example, if the partitioning column is of type text and the two systems have different definitions of the collation used to sort the partitioning column.","names":["--load-via-partition-root"],"signature":"--load-via-partition-root","source_url":"/docs/18/app-pgdump.html","summary":"When dumping data for a table partition, make the COPY or INSERT statements target the root of the partitioning hierarchy that contains it, rather than the partition itself. This causes the appropriate partition to be re-determined for each row when the data is loaded. This may be useful when restoring data on a server where rows do not always fall into the same partitions as they did on the original server. That could happen, for example, if the partitioning column is of type text and the two systems have different definitions of the collation used to sort the partitioning column."},{"description":"Do not wait forever to acquire shared table locks at the beginning of the dump. Instead fail if unable to lock a table within the specified timeout . The timeout may be specified in any of the formats accepted by SET statement_timeout . (Allowed formats vary depending on the server version you are dumping from, but an integer number of milliseconds is accepted by all versions.)","names":["--lock-wait-timeout= timeout"],"signature":"--lock-wait-timeout= timeout","source_url":"/docs/18/app-pgdump.html","summary":"Do not wait forever to acquire shared table locks at the beginning of the dump. Instead fail if unable to lock a table within the specified timeout . The timeout may be specified in any of the formats accepted by SET statement_timeout . (Allowed formats vary depending on the server version you are dumping from, but an integer number of milliseconds is accepted by all versions.)"},{"description":"Do not dump COMMENT commands.","names":["--no-comments"],"signature":"--no-comments","source_url":"/docs/18/app-pgdump.html","summary":"Do not dump COMMENT commands."},{"description":"Do not dump data.","names":["--no-data"],"signature":"--no-data","source_url":"/docs/18/app-pgdump.html","summary":"Do not dump data."},{"description":"Do not dump row security policies.","names":["--no-policies"],"signature":"--no-policies","source_url":"/docs/18/app-pgdump.html","summary":"Do not dump row security policies."},{"description":"Do not dump publications.","names":["--no-publications"],"signature":"--no-publications","source_url":"/docs/18/app-pgdump.html","summary":"Do not dump publications."},{"description":"Do not dump schema (data definitions).","names":["--no-schema"],"signature":"--no-schema","source_url":"/docs/18/app-pgdump.html","summary":"Do not dump schema (data definitions)."},{"description":"Do not dump security labels.","names":["--no-security-labels"],"signature":"--no-security-labels","source_url":"/docs/18/app-pgdump.html","summary":"Do not dump security labels."},{"description":"Do not dump statistics. This is the default.","names":["--no-statistics"],"signature":"--no-statistics","source_url":"/docs/18/app-pgdump.html","summary":"Do not dump statistics. This is the default."},{"description":"Do not dump subscriptions.","names":["--no-subscriptions"],"signature":"--no-subscriptions","source_url":"/docs/18/app-pgdump.html","summary":"Do not dump subscriptions."},{"description":"By default, pg_dump will wait for all files to be written safely to disk. This option causes pg_dump to return without waiting, which is faster, but means that a subsequent operating system crash can leave the dump corrupt. Generally, this option is useful for testing but should not be used when dumping data from production installation.","names":["--no-sync"],"signature":"--no-sync","source_url":"/docs/18/app-pgdump.html","summary":"By default, pg_dump will wait for all files to be written safely to disk. This option causes pg_dump to return without waiting, which is faster, but means that a subsequent operating system crash can leave the dump corrupt. Generally, this option is useful for testing but should not be used when dumping data from production installation."},{"description":"Do not output commands to select table access methods. With this option, all objects will be created with whichever table access method is the default during restore. This option is ignored when emitting an archive (non-text) output file. For the archive formats, you can specify the option when you call pg_restore .","names":["--no-table-access-method"],"signature":"--no-table-access-method","source_url":"/docs/18/app-pgdump.html","summary":"Do not output commands to select table access methods. With this option, all objects will be created with whichever table access method is the default during restore."},{"description":"Do not output commands to select tablespaces. With this option, all objects will be created in whichever tablespace is the default during restore. This option is ignored when emitting an archive (non-text) output file. For the archive formats, you can specify the option when you call pg_restore .","names":["--no-tablespaces"],"signature":"--no-tablespaces","source_url":"/docs/18/app-pgdump.html","summary":"Do not output commands to select tablespaces. With this option, all objects will be created in whichever tablespace is the default during restore."},{"description":"Do not output commands to set TOAST compression methods. With this option, all columns will be restored with the default compression setting.","names":["--no-toast-compression"],"signature":"--no-toast-compression","source_url":"/docs/18/app-pgdump.html","summary":"Do not output commands to set TOAST compression methods. With this option, all columns will be restored with the default compression setting."},{"description":"Do not dump the contents of unlogged tables and sequences. This option has no effect on whether or not the table and sequence definitions (schema) are dumped; it only suppresses dumping the table and sequence data. Data in unlogged tables and sequences is always excluded when dumping from a standby server.","names":["--no-unlogged-table-data"],"signature":"--no-unlogged-table-data","source_url":"/docs/18/app-pgdump.html","summary":"Do not dump the contents of unlogged tables and sequences. This option has no effect on whether or not the table and sequence definitions (schema) are dumped; it only suppresses dumping the table and sequence data. Data in unlogged tables and sequences is always excluded when dumping from a standby server."},{"description":"Add ON CONFLICT DO NOTHING to INSERT commands. This option is not valid unless --inserts , --column-inserts or --rows-per-insert is also specified.","names":["--on-conflict-do-nothing"],"signature":"--on-conflict-do-nothing","source_url":"/docs/18/app-pgdump.html","summary":"Add ON CONFLICT DO NOTHING to INSERT commands. This option is not valid unless --inserts , --column-inserts or --rows-per-insert is also specified."},{"description":"Force quoting of all identifiers. This option is recommended when dumping a database from a server whose PostgreSQL major version is different from pg_dump 's, or when the output is intended to be loaded into a server of a different major version. By default, pg_dump quotes only identifiers that are reserved words in its own major version. This sometimes results in compatibility issues when dealing with servers of other versions that may have slightly different sets of reserved words. Using --quote-all-identifiers prevents such issues, at the price of a harder-to-read dump script.","names":["--quote-all-identifiers"],"signature":"--quote-all-identifiers","source_url":"/docs/18/app-pgdump.html","summary":"Force quoting of all identifiers. This option is recommended when dumping a database from a server whose PostgreSQL major version is different from pg_dump 's, or when the output is intended to be loaded into a server of a different major version. By default, pg_dump quotes only identifiers that are reserved words in its own major version. This sometimes results in compatibility issues when dealing with servers of other versions that may have slightly different sets of reserved words. Using --quote-all-identifiers prevents such issues, at the price of a harder-to-read dump script."},{"description":"Use the provided string as the psql \\restrict key in the dump output. This can only be specified for plain-text dumps, i.e., when --format is set to plain or the --format option is omitted. If no restrict key is specified, pg_dump will generate a random one as needed. Keys may contain only alphanumeric characters. This option is primarily intended for testing purposes and other scenarios that require repeatable output (e.g., comparing dump files). It is not recommended for general use, as a malicious server with advance knowledge of the key may be able to inject arbitrary code that will be executed on the machine that runs psql with the dump output.","names":["--restrict-key= restrict_key"],"signature":"--restrict-key= restrict_key","source_url":"/docs/18/app-pgdump.html","summary":"Use the provided string as the psql \\restrict key in the dump output. This can only be specified for plain-text dumps, i.e., when --format is set to plain or the --format option is omitted. If no restrict key is specified, pg_dump will generate a random one as needed. Keys may contain only alphanumeric characters."},{"description":"Dump data as INSERT commands (rather than COPY ). Controls the maximum number of rows per INSERT command. The value specified must be a number greater than zero. Any error during restoring will cause only rows that are part of the problematic INSERT to be lost, rather than the entire table contents.","names":["--rows-per-insert= nrows"],"signature":"--rows-per-insert= nrows","source_url":"/docs/18/app-pgdump.html","summary":"Dump data as INSERT commands (rather than COPY ). Controls the maximum number of rows per INSERT command. The value specified must be a number greater than zero. Any error during restoring will cause only rows that are part of the problematic INSERT to be lost, rather than the entire table contents."},{"description":"Only dump the named section. The section name can be pre-data , data , or post-data . This option can be specified more than once to select multiple sections. The default is to dump all sections. The data section contains actual table data, large-object contents, sequence values, and statistics for tables, materialized views, and foreign tables. Post-data items include definitions of indexes, triggers, rules, statistics for indexes, and constraints other than validated check and not-null constraints. Pre-data items include all other data definition items.","names":["--section= sectionname"],"signature":"--section= sectionname","source_url":"/docs/18/app-pgdump.html","summary":"Only dump the named section. The section name can be pre-data , data , or post-data . This option can be specified more than once to select multiple sections. The default is to dump all sections."},{"description":"Include sequence data in the dump. This is the default behavior except when --no-data , --schema-only , or --statistics-only is specified.","names":["--sequence-data"],"signature":"--sequence-data","source_url":"/docs/18/app-pgdump.html","summary":"Include sequence data in the dump. This is the default behavior except when --no-data , --schema-only , or --statistics-only is specified."},{"description":"Use a serializable transaction for the dump, to ensure that the snapshot used is consistent with later database states; but do this by waiting for a point in the transaction stream at which no anomalies can be present, so that there isn't a risk of the dump failing or causing other transactions to roll back with a serialization_failure . See Chapter 13 for more information about transaction isolation and concurrency control. This option is not beneficial for a dump which is intended only for disaster recovery. It could be useful for a dump used to load a copy of the database for reporting or other read-only load sharing while the original database continues to be updated. Without it the dump may reflect a state which is not consistent with any serial execution of the transactions eventually committed. For example, if batch processing techniques are used, a batch may show as closed in the dump without all of the items which are in the batch appearing. This option will make no difference if there are no read-write transactions active when pg_dump is started. If read-write transactions are active, the start of the dump may be delayed for an indeterminate length of time. Once running, performance with or without the switch is the same.","names":["--serializable-deferrable"],"signature":"--serializable-deferrable","source_url":"/docs/18/app-pgdump.html","summary":"Use a serializable transaction for the dump, to ensure that the snapshot used is consistent with later database states; but do this by waiting for a point in the transaction stream at which no anomalies can be present, so that there isn't a risk of the dump failing or causing other transactions to roll back with a serialization_failure . See Chapter 13 for more information about transaction isolation and concurrency control."},{"description":"Use the specified synchronized snapshot when making a dump of the database (see Table 9.100 for more details). This option is useful when needing to synchronize the dump with a logical replication slot (see Chapter 47 ) or with a concurrent session. In the case of a parallel dump, the snapshot name defined by this option is used rather than taking a new snapshot.","names":["--snapshot= snapshotname"],"signature":"--snapshot= snapshotname","source_url":"/docs/18/app-pgdump.html","summary":"Use the specified synchronized snapshot when making a dump of the database (see Table 9.100 for more details)."},{"description":"Dump optimizer statistics.","names":["--statistics"],"signature":"--statistics","source_url":"/docs/18/app-pgdump.html","summary":"Dump optimizer statistics."},{"description":"Dump only the statistics, not the schema (data definitions) or data. Optimizer statistics for tables, materialized views, foreign tables, and indexes are dumped.","names":["--statistics-only"],"signature":"--statistics-only","source_url":"/docs/18/app-pgdump.html","summary":"Dump only the statistics, not the schema (data definitions) or data. Optimizer statistics for tables, materialized views, foreign tables, and indexes are dumped."},{"description":"Require that each extension ( -e / --extension ), schema ( -n / --schema ) and table ( -t / --table ) pattern match at least one extension/schema/table in the database to be dumped. This also applies to filters used with --filter . Note that if none of the extension/schema/table patterns find matches, pg_dump will generate an error even without --strict-names . This option has no effect on --exclude-extension , -N / --exclude-schema , -T / --exclude-table , or --exclude-table-data . An exclude pattern failing to match any objects is not considered an error.","names":["--strict-names"],"signature":"--strict-names","source_url":"/docs/18/app-pgdump.html","summary":"Require that each extension ( -e / --extension ), schema ( -n / --schema ) and table ( -t / --table ) pattern match at least one extension/schema/table in the database to be dumped. This also applies to filters used with --filter . Note that if none of the extension/schema/table patterns find matches, pg_dump will generate an error even without --strict-names ."},{"description":"When set to fsync , which is the default, pg_dump --format=directory will recursively open and synchronize all files in the archive directory. On Linux, syncfs may be used instead to ask the operating system to synchronize the whole file system that contains the archive directory. See recovery_init_sync_method for information about the caveats to be aware of when using syncfs . This option has no effect when --no-sync is used or --format is not set to directory .","names":["--sync-method= method"],"signature":"--sync-method= method","source_url":"/docs/18/app-pgdump.html","summary":"When set to fsync , which is the default, pg_dump --format=directory will recursively open and synchronize all files in the archive directory."},{"description":"This is the same as the -t / --table option, except that it also includes any partitions or inheritance child tables of the table(s) matching the pattern .","names":["--table-and-children= pattern"],"signature":"--table-and-children= pattern","source_url":"/docs/18/app-pgdump.html","summary":"This is the same as the -t / --table option, except that it also includes any partitions or inheritance child tables of the table(s) matching the pattern ."},{"description":"Output SQL-standard SET SESSION AUTHORIZATION commands instead of ALTER OWNER commands to determine object ownership. This makes the dump more standards-compatible, but depending on the history of the objects in the dump, might not restore properly. Also, a dump using SET SESSION AUTHORIZATION will certainly require superuser privileges to restore correctly, whereas ALTER OWNER requires lesser privileges.","names":["--use-set-session-authorization"],"signature":"--use-set-session-authorization","source_url":"/docs/18/app-pgdump.html","summary":"Output SQL-standard SET SESSION AUTHORIZATION commands instead of ALTER OWNER commands to determine object ownership. This makes the dump more standards-compatible, but depending on the history of the objects in the dump, might not restore properly. Also, a dump using SET SESSION AUTHORIZATION will certainly require superuser privileges to restore correctly, whereas ALTER OWNER requires lesser privileges."},{"description":"Show help about pg_dump command line arguments, and exit.","names":["-?","--help"],"signature":"-? --help","source_url":"/docs/18/app-pgdump.html","summary":"Show help about pg_dump command line arguments, and exit."},{"description":"Specifies the name of the database to connect to. This is equivalent to specifying dbname as the first non-option argument on the command line. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options.","names":["-d dbname","--dbname= dbname"],"signature":"-d dbname --dbname= dbname","source_url":"/docs/18/app-pgdump.html","summary":"Specifies the name of the database to connect to. This is equivalent to specifying dbname as the first non-option argument on the command line. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options."},{"description":"Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket. The default is taken from the PGHOST environment variable, if set, else a Unix domain socket connection is attempted.","names":["-h host","--host= host"],"signature":"-h host --host= host","source_url":"/docs/18/app-pgdump.html","summary":"Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket. The default is taken from the PGHOST environment variable, if set, else a Unix domain socket connection is attempted."},{"description":"Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default.","names":["-p port","--port= port"],"signature":"-p port --port= port","source_url":"/docs/18/app-pgdump.html","summary":"Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default."},{"description":"User name to connect as.","names":["-U username","--username= username"],"signature":"-U username --username= username","source_url":"/docs/18/app-pgdump.html","summary":"User name to connect as."},{"description":"Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password.","names":["-w","--no-password"],"signature":"-w --no-password","source_url":"/docs/18/app-pgdump.html","summary":"Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password."},{"description":"Force pg_dump to prompt for a password before connecting to a database. This option is never essential, since pg_dump will automatically prompt for a password if the server demands password authentication. However, pg_dump will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing -W to avoid the extra connection attempt.","names":["-W","--password"],"signature":"-W --password","source_url":"/docs/18/app-pgdump.html","summary":"Force pg_dump to prompt for a password before connecting to a database."},{"description":"Specifies a role name to be used to create the dump. This option causes pg_dump to issue a SET ROLE rolename command after connecting to the database. It is useful when the authenticated user (specified by -U ) lacks privileges needed by pg_dump , but can switch to a role with the required rights. Some installations have a policy against logging in directly as a superuser, and use of this option allows dumps to be made without violating the policy.","names":["--role= rolename"],"signature":"--role= rolename","source_url":"/docs/18/app-pgdump.html","summary":"Specifies a role name to be used to create the dump. This option causes pg_dump to issue a SET ROLE rolename command after connecting to the database. It is useful when the authenticated user (specified by -U ) lacks privileges needed by pg_dump , but can switch to a role with the required rights. Some installations have a policy against logging in directly as a superuser, and use of this option allows dumps to be made without violating the policy."}],"related":[{"label":"libpq connection parameters","url":"/wiki/conn/?v=18"}],"release":{"channel":"stable","evidence_kind":"English manual and source declarations","label":"18.6","major":"18","manifest":{"index":"index.html","major":"18","pages":1148,"pdf":{"A4":{"built_at":"2026-09-26","bytes":15865106,"pages":3154,"sha256":"19512c405da53f9f7fcf0abba359223aa65f021be025bf3411381918f92e3190","url":"/files/documentation/pdf/18/postgresql-18-A4.pdf"},"US":{"built_at":"2026-09-26","bytes":15748059,"pages":3328,"sha256":"facbe6c229e598b872d3d98bef53308f46e06746006fa4590de9a7de9dd46319","url":"/files/documentation/pdf/18/postgresql-18-US.pdf"}},"release":"18.6","source_mode":"en SGML built with pinned official archive","source_sha256":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f","source_url":"https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2","svg_assets":3,"tree":"18"},"ref":"https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2","revision":"ee8d1a3612338fd9adf250730cb640fcc5233b5491337cc00a316a44e3a0b9f8","source_sha256":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f"},"sections":[],"signature":"pg_dump [ connection-option ...] [ option ...] [ dbname ]","sources":[{"anchor":"","file":"app-pgdump.html","label":"18.6 English manual · app-pgdump.html","sha256":"758860baaa3462061cc6343b8d04559ec3fbc9e77c00e426f5eb8b32c863509e","url":"/docs/18/app-pgdump.html"},{"anchor":"","file":"reference-client.html","label":"Client applications inventory","sha256":"68f726af77272fe73a827be2b7b5958d0f2239a6f8ed44264e9d42496bfa4fd0","url":"/docs/18/reference-client.html"}],"synopsis":["pg_dump [ connection-option ...] [ option ...] [ dbname ]"],"tables":[{"columns":[{"key":"signature","label":"Option and arguments"},{"key":"summary","label":"Description"}],"key":"options","rows":[{"signature":{"text":"-a --data-only","url":"/docs/18/app-pgdump.html"},"summary":"Dump only the data, not the schema (data definitions) or statistics. Table data, large objects, and sequence values are dumped."},{"signature":{"text":"-b --large-objects --blobs (deprecated)","url":"/docs/18/app-pgdump.html"},"summary":"Include large objects in the dump. This is the default behavior except when --schema , --table , --schema-only , --statistics-only , or --no-data is specified. The -b switch is therefore only useful to add large objects to dumps where a specific schema or table has been requested. Note that large objects are considered data and therefore will be included when --data-only is used, but not when --schema-only or --statistics-only is."},{"signature":{"text":"-B --no-large-objects --no-blobs (deprecated)","url":"/docs/18/app-pgdump.html"},"summary":"Exclude large objects in the dump."},{"signature":{"text":"-c --clean","url":"/docs/18/app-pgdump.html"},"summary":"Output commands to DROP all the dumped database objects prior to outputting the commands for creating them. This option is useful when the restore is to overwrite an existing database. If any of the objects do not exist in the destination database, ignorable error messages will be reported during restore, unless --if-exists is also specified."},{"signature":{"text":"-C --create","url":"/docs/18/app-pgdump.html"},"summary":"Begin the output with a command to create the database itself and reconnect to the created database. (With a script of this form, it doesn't matter which database in the destination installation you connect to before running the script.) If --clean is also specified, the script drops and recreates the target database before reconnecting to it."},{"signature":{"text":"-e pattern --extension= pattern","url":"/docs/18/app-pgdump.html"},"summary":"Dump only extensions matching pattern . When this option is not specified, all non-system extensions in the target database will be dumped. Multiple extensions can be selected by writing multiple -e switches. The pattern parameter is interpreted as a pattern according to the same rules used by psql 's \\d commands (see Patterns ), so multiple extensions can also be selected by writing wildcard characters in the pattern. When using wildcards, be careful to quote the pattern if needed to prevent the shell from expanding the wildcards."},{"signature":{"text":"-E encoding --encoding= encoding","url":"/docs/18/app-pgdump.html"},"summary":"Create the dump in the specified character set encoding. By default, the dump is created in the database encoding. (Another way to get the same result is to set the PGCLIENTENCODING environment variable to the desired dump encoding.) The supported encodings are described in Section 23.3.1 ."},{"signature":{"text":"-f file --file= file","url":"/docs/18/app-pgdump.html"},"summary":"Send output to the specified file. This parameter can be omitted for file based output formats, in which case the standard output is used. It must be given for the directory output format however, where it specifies the target directory instead of a file. In this case the directory is created by pg_dump and must not exist before."},{"signature":{"text":"-F format --format= format","url":"/docs/18/app-pgdump.html"},"summary":"Selects the format of the output. format can be one of the following:"},{"signature":{"text":"-j njobs --jobs= njobs","url":"/docs/18/app-pgdump.html"},"summary":"Run the dump in parallel by dumping njobs tables simultaneously. This option may reduce the time needed to perform the dump but it also increases the load on the database server. You can only use this option with the directory output format because this is the only output format where multiple processes can write their data at the same time."},{"signature":{"text":"-n pattern --schema= pattern","url":"/docs/18/app-pgdump.html"},"summary":"Dump only schemas matching pattern ; this selects both the schema itself, and all its contained objects. When this option is not specified, all non-system schemas in the target database will be dumped. Multiple schemas can be selected by writing multiple -n switches. The pattern parameter is interpreted as a pattern according to the same rules used by psql 's \\d commands (see Patterns ), so multiple schemas can also be selected by writing wildcard characters in the pattern. When using wildcards, be careful to quote the pattern if needed to prevent the shell from expanding the wildcards; see Examples below."},{"signature":{"text":"-N pattern --exclude-schema= pattern","url":"/docs/18/app-pgdump.html"},"summary":"Do not dump any schemas matching pattern . The pattern is interpreted according to the same rules as for -n . -N can be given more than once to exclude schemas matching any of several patterns."},{"signature":{"text":"-O --no-owner","url":"/docs/18/app-pgdump.html"},"summary":"Do not output commands to set ownership of objects to match the original database. By default, pg_dump issues ALTER OWNER or SET SESSION AUTHORIZATION statements to set ownership of created database objects. These statements will fail when the script is run unless it is started by a superuser (or the same user that owns all of the objects in the script). To make a script that can be restored by any user, but will give that user ownership of all the objects, specify -O ."},{"signature":{"text":"-R --no-reconnect","url":"/docs/18/app-pgdump.html"},"summary":"This option is obsolete but still accepted for backwards compatibility."},{"signature":{"text":"-s --schema-only","url":"/docs/18/app-pgdump.html"},"summary":"Dump only the object definitions (schema), not data or statistics."},{"signature":{"text":"-S username --superuser= username","url":"/docs/18/app-pgdump.html"},"summary":"Specify the superuser user name to use when disabling triggers. This is relevant only if --disable-triggers is used. (Usually, it's better to leave this out, and instead start the resulting script as superuser.)"},{"signature":{"text":"-t pattern --table= pattern","url":"/docs/18/app-pgdump.html"},"summary":"Dump only tables with names matching pattern . Multiple tables can be selected by writing multiple -t switches. The pattern parameter is interpreted as a pattern according to the same rules used by psql 's \\d commands (see Patterns ), so multiple tables can also be selected by writing wildcard characters in the pattern. When using wildcards, be careful to quote the pattern if needed to prevent the shell from expanding the wildcards; see Examples below."},{"signature":{"text":"-T pattern --exclude-table= pattern","url":"/docs/18/app-pgdump.html"},"summary":"Do not dump any tables matching pattern . The pattern is interpreted according to the same rules as for -t . -T can be given more than once to exclude tables matching any of several patterns."},{"signature":{"text":"-v --verbose","url":"/docs/18/app-pgdump.html"},"summary":"Specifies verbose mode. This will cause pg_dump to output detailed object comments and start/stop times to the dump file, and progress messages to standard error. Repeating the option causes additional debug-level messages to appear on standard error."},{"signature":{"text":"-V --version","url":"/docs/18/app-pgdump.html"},"summary":"Print the pg_dump version and exit."},{"signature":{"text":"-x --no-privileges --no-acl","url":"/docs/18/app-pgdump.html"},"summary":"Prevent dumping of access privileges (grant/revoke commands)."},{"signature":{"text":"-Z level -Z method [: detail ] --compress= level --compress= method [: detail ]","url":"/docs/18/app-pgdump.html"},"summary":"Specify the compression method and/or the compression level to use. The compression method can be set to gzip , lz4 , zstd , or none for no compression. A compression detail string can optionally be specified. If the detail string is an integer, it specifies the compression level. Otherwise, it should be a comma-separated list of items, each of the form keyword or keyword=value . Currently, the supported keywords are level and long ."},{"signature":{"text":"--binary-upgrade","url":"/docs/18/app-pgdump.html"},"summary":"This option is for use by in-place upgrade utilities. Its use for other purposes is not recommended or supported. The behavior of the option may change in future releases without notice."},{"signature":{"text":"--column-inserts --attribute-inserts","url":"/docs/18/app-pgdump.html"},"summary":"Dump data as INSERT commands with explicit column names ( INSERT INTO table ( column , ...) VALUES ... ). This will make restoration very slow; it is mainly useful for making dumps that can be loaded into non- PostgreSQL databases. Any error during restoring will cause only rows that are part of the problematic INSERT to be lost, rather than the entire table contents."},{"signature":{"text":"--disable-dollar-quoting","url":"/docs/18/app-pgdump.html"},"summary":"This option disables the use of dollar quoting for function bodies, and forces them to be quoted using SQL standard string syntax."},{"signature":{"text":"--disable-triggers","url":"/docs/18/app-pgdump.html"},"summary":"This option is relevant only when creating a dump that includes data but does not include schema. It instructs pg_dump to include commands to temporarily disable triggers on the target tables while the data is restored. Use this if you have referential integrity checks or other triggers on the tables that you do not want to invoke during data restore."},{"signature":{"text":"--enable-row-security","url":"/docs/18/app-pgdump.html"},"summary":"This option is relevant only when dumping the contents of a table which has row security. By default, pg_dump will set row_security to off, to ensure that all data is dumped from the table. If the user does not have sufficient privileges to bypass row security, then an error is thrown. This parameter instructs pg_dump to set row_security to on instead, allowing the user to dump the parts of the contents of the table that they have access to."},{"signature":{"text":"--exclude-extension= pattern","url":"/docs/18/app-pgdump.html"},"summary":"Do not dump any extensions matching pattern . The pattern is interpreted according to the same rules as for -e . --exclude-extension can be given more than once to exclude extensions matching any of several patterns."},{"signature":{"text":"--exclude-table-and-children= pattern","url":"/docs/18/app-pgdump.html"},"summary":"This is the same as the -T / --exclude-table option, except that it also excludes any partitions or inheritance child tables of the table(s) matching the pattern ."},{"signature":{"text":"--exclude-table-data= pattern","url":"/docs/18/app-pgdump.html"},"summary":"Do not dump data for any tables matching pattern . The pattern is interpreted according to the same rules as for -t . --exclude-table-data can be given more than once to exclude tables matching any of several patterns. This option is useful when you need the definition of a particular table even though you do not need the data in it."},{"signature":{"text":"--exclude-table-data-and-children= pattern","url":"/docs/18/app-pgdump.html"},"summary":"This is the same as the --exclude-table-data option, except that it also excludes data of any partitions or inheritance child tables of the table(s) matching the pattern ."},{"signature":{"text":"--extra-float-digits= ndigits","url":"/docs/18/app-pgdump.html"},"summary":"Use the specified value of extra_float_digits when dumping floating-point data, instead of the maximum available precision. Routine dumps made for backup purposes should not use this option."},{"signature":{"text":"--filter= filename","url":"/docs/18/app-pgdump.html"},"summary":"Specify a filename from which to read patterns for objects to include or exclude from the dump. The patterns are interpreted according to the same rules as the corresponding options: -t / --table , --table-and-children , -T / --exclude-table , and --exclude-table-and-children for tables, -n / --schema and -N / --exclude-schema for schemas, --include-foreign-data for data on foreign servers, --exclude-table-data and --exclude-table-data-and-children for table data, and -e / --extension and --exclude-extension for extensions. To read from STDIN , use - as the filename. The --filter option can be specified in conjunction with the above listed options for including or excluding objects, and can also be specified more than once for multiple filter files."},{"signature":{"text":"--if-exists","url":"/docs/18/app-pgdump.html"},"summary":"Use DROP ... IF EXISTS commands to drop objects in --clean mode. This suppresses “ does not exist ” errors that might otherwise be reported. This option is not valid unless --clean is also specified."},{"signature":{"text":"--include-foreign-data= foreignserver","url":"/docs/18/app-pgdump.html"},"summary":"Dump the data for any foreign table with a foreign server matching foreignserver pattern. Multiple foreign servers can be selected by writing multiple --include-foreign-data switches. Also, the foreignserver parameter is interpreted as a pattern according to the same rules used by psql 's \\d commands (see Patterns ), so multiple foreign servers can also be selected by writing wildcard characters in the pattern. When using wildcards, be careful to quote the pattern if needed to prevent the shell from expanding the wildcards; see Examples below. The only exception is that an empty pattern is disallowed."},{"signature":{"text":"--inserts","url":"/docs/18/app-pgdump.html"},"summary":"Dump data as INSERT commands (rather than COPY ). This will make restoration very slow; it is mainly useful for making dumps that can be loaded into non- PostgreSQL databases. Any error during restoring will cause only rows that are part of the problematic INSERT to be lost, rather than the entire table contents. Note that the restore might fail altogether if you have rearranged column order. The --column-inserts option is safe against column order changes, though even slower."},{"signature":{"text":"--load-via-partition-root","url":"/docs/18/app-pgdump.html"},"summary":"When dumping data for a table partition, make the COPY or INSERT statements target the root of the partitioning hierarchy that contains it, rather than the partition itself. This causes the appropriate partition to be re-determined for each row when the data is loaded. This may be useful when restoring data on a server where rows do not always fall into the same partitions as they did on the original server. That could happen, for example, if the partitioning column is of type text and the two systems have different definitions of the collation used to sort the partitioning column."},{"signature":{"text":"--lock-wait-timeout= timeout","url":"/docs/18/app-pgdump.html"},"summary":"Do not wait forever to acquire shared table locks at the beginning of the dump. Instead fail if unable to lock a table within the specified timeout . The timeout may be specified in any of the formats accepted by SET statement_timeout . (Allowed formats vary depending on the server version you are dumping from, but an integer number of milliseconds is accepted by all versions.)"},{"signature":{"text":"--no-comments","url":"/docs/18/app-pgdump.html"},"summary":"Do not dump COMMENT commands."},{"signature":{"text":"--no-data","url":"/docs/18/app-pgdump.html"},"summary":"Do not dump data."},{"signature":{"text":"--no-policies","url":"/docs/18/app-pgdump.html"},"summary":"Do not dump row security policies."},{"signature":{"text":"--no-publications","url":"/docs/18/app-pgdump.html"},"summary":"Do not dump publications."},{"signature":{"text":"--no-schema","url":"/docs/18/app-pgdump.html"},"summary":"Do not dump schema (data definitions)."},{"signature":{"text":"--no-security-labels","url":"/docs/18/app-pgdump.html"},"summary":"Do not dump security labels."},{"signature":{"text":"--no-statistics","url":"/docs/18/app-pgdump.html"},"summary":"Do not dump statistics. This is the default."},{"signature":{"text":"--no-subscriptions","url":"/docs/18/app-pgdump.html"},"summary":"Do not dump subscriptions."},{"signature":{"text":"--no-sync","url":"/docs/18/app-pgdump.html"},"summary":"By default, pg_dump will wait for all files to be written safely to disk. This option causes pg_dump to return without waiting, which is faster, but means that a subsequent operating system crash can leave the dump corrupt. Generally, this option is useful for testing but should not be used when dumping data from production installation."},{"signature":{"text":"--no-table-access-method","url":"/docs/18/app-pgdump.html"},"summary":"Do not output commands to select table access methods. With this option, all objects will be created with whichever table access method is the default during restore."},{"signature":{"text":"--no-tablespaces","url":"/docs/18/app-pgdump.html"},"summary":"Do not output commands to select tablespaces. With this option, all objects will be created in whichever tablespace is the default during restore."},{"signature":{"text":"--no-toast-compression","url":"/docs/18/app-pgdump.html"},"summary":"Do not output commands to set TOAST compression methods. With this option, all columns will be restored with the default compression setting."},{"signature":{"text":"--no-unlogged-table-data","url":"/docs/18/app-pgdump.html"},"summary":"Do not dump the contents of unlogged tables and sequences. This option has no effect on whether or not the table and sequence definitions (schema) are dumped; it only suppresses dumping the table and sequence data. Data in unlogged tables and sequences is always excluded when dumping from a standby server."},{"signature":{"text":"--on-conflict-do-nothing","url":"/docs/18/app-pgdump.html"},"summary":"Add ON CONFLICT DO NOTHING to INSERT commands. This option is not valid unless --inserts , --column-inserts or --rows-per-insert is also specified."},{"signature":{"text":"--quote-all-identifiers","url":"/docs/18/app-pgdump.html"},"summary":"Force quoting of all identifiers. This option is recommended when dumping a database from a server whose PostgreSQL major version is different from pg_dump 's, or when the output is intended to be loaded into a server of a different major version. By default, pg_dump quotes only identifiers that are reserved words in its own major version. This sometimes results in compatibility issues when dealing with servers of other versions that may have slightly different sets of reserved words. Using --quote-all-identifiers prevents such issues, at the price of a harder-to-read dump script."},{"signature":{"text":"--restrict-key= restrict_key","url":"/docs/18/app-pgdump.html"},"summary":"Use the provided string as the psql \\restrict key in the dump output. This can only be specified for plain-text dumps, i.e., when --format is set to plain or the --format option is omitted. If no restrict key is specified, pg_dump will generate a random one as needed. Keys may contain only alphanumeric characters."},{"signature":{"text":"--rows-per-insert= nrows","url":"/docs/18/app-pgdump.html"},"summary":"Dump data as INSERT commands (rather than COPY ). Controls the maximum number of rows per INSERT command. The value specified must be a number greater than zero. Any error during restoring will cause only rows that are part of the problematic INSERT to be lost, rather than the entire table contents."},{"signature":{"text":"--section= sectionname","url":"/docs/18/app-pgdump.html"},"summary":"Only dump the named section. The section name can be pre-data , data , or post-data . This option can be specified more than once to select multiple sections. The default is to dump all sections."},{"signature":{"text":"--sequence-data","url":"/docs/18/app-pgdump.html"},"summary":"Include sequence data in the dump. This is the default behavior except when --no-data , --schema-only , or --statistics-only is specified."},{"signature":{"text":"--serializable-deferrable","url":"/docs/18/app-pgdump.html"},"summary":"Use a serializable transaction for the dump, to ensure that the snapshot used is consistent with later database states; but do this by waiting for a point in the transaction stream at which no anomalies can be present, so that there isn't a risk of the dump failing or causing other transactions to roll back with a serialization_failure . See Chapter 13 for more information about transaction isolation and concurrency control."},{"signature":{"text":"--snapshot= snapshotname","url":"/docs/18/app-pgdump.html"},"summary":"Use the specified synchronized snapshot when making a dump of the database (see Table 9.100 for more details)."},{"signature":{"text":"--statistics","url":"/docs/18/app-pgdump.html"},"summary":"Dump optimizer statistics."},{"signature":{"text":"--statistics-only","url":"/docs/18/app-pgdump.html"},"summary":"Dump only the statistics, not the schema (data definitions) or data. Optimizer statistics for tables, materialized views, foreign tables, and indexes are dumped."},{"signature":{"text":"--strict-names","url":"/docs/18/app-pgdump.html"},"summary":"Require that each extension ( -e / --extension ), schema ( -n / --schema ) and table ( -t / --table ) pattern match at least one extension/schema/table in the database to be dumped. This also applies to filters used with --filter . Note that if none of the extension/schema/table patterns find matches, pg_dump will generate an error even without --strict-names ."},{"signature":{"text":"--sync-method= method","url":"/docs/18/app-pgdump.html"},"summary":"When set to fsync , which is the default, pg_dump --format=directory will recursively open and synchronize all files in the archive directory."},{"signature":{"text":"--table-and-children= pattern","url":"/docs/18/app-pgdump.html"},"summary":"This is the same as the -t / --table option, except that it also includes any partitions or inheritance child tables of the table(s) matching the pattern ."},{"signature":{"text":"--use-set-session-authorization","url":"/docs/18/app-pgdump.html"},"summary":"Output SQL-standard SET SESSION AUTHORIZATION commands instead of ALTER OWNER commands to determine object ownership. This makes the dump more standards-compatible, but depending on the history of the objects in the dump, might not restore properly. Also, a dump using SET SESSION AUTHORIZATION will certainly require superuser privileges to restore correctly, whereas ALTER OWNER requires lesser privileges."},{"signature":{"text":"-? --help","url":"/docs/18/app-pgdump.html"},"summary":"Show help about pg_dump command line arguments, and exit."},{"signature":{"text":"-d dbname --dbname= dbname","url":"/docs/18/app-pgdump.html"},"summary":"Specifies the name of the database to connect to. This is equivalent to specifying dbname as the first non-option argument on the command line. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options."},{"signature":{"text":"-h host --host= host","url":"/docs/18/app-pgdump.html"},"summary":"Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket. The default is taken from the PGHOST environment variable, if set, else a Unix domain socket connection is attempted."},{"signature":{"text":"-p port --port= port","url":"/docs/18/app-pgdump.html"},"summary":"Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default."},{"signature":{"text":"-U username --username= username","url":"/docs/18/app-pgdump.html"},"summary":"User name to connect as."},{"signature":{"text":"-w --no-password","url":"/docs/18/app-pgdump.html"},"summary":"Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password."},{"signature":{"text":"-W --password","url":"/docs/18/app-pgdump.html"},"summary":"Force pg_dump to prompt for a password before connecting to a database."},{"signature":{"text":"--role= rolename","url":"/docs/18/app-pgdump.html"},"summary":"Specifies a role name to be used to create the dump. This option causes pg_dump to issue a SET ROLE rolename command after connecting to the database. It is useful when the authenticated user (specified by -U ) lacks privileges needed by pg_dump , but can switch to a role with the required rights. Some installations have a policy against logging in directly as a superuser, and use of this option allows dumps to be made without violating the policy."}],"title":"Documented options"},{"columns":[{"key":"name","label":"Variable"},{"key":"description","label":"Meaning"}],"key":"environment","rows":[{"description":"Default connection parameters.","name":"PGDATABASE PGHOST PGOPTIONS PGPORT PGUSER"},{"description":"Specifies whether to use color in diagnostic messages. Possible values are always , auto and never .","name":"PG_COLOR"}],"title":"Environment variables"}]},"ManualEvidence":{"manual_path":"app-pgdump.html","release":{"channel":"stable","evidence_kind":"English manual and source declarations","label":"18.6","major":"18","manifest":{"index":"index.html","major":"18","pages":1148,"pdf":{"A4":{"built_at":"2026-09-26","bytes":15865106,"pages":3154,"sha256":"19512c405da53f9f7fcf0abba359223aa65f021be025bf3411381918f92e3190","url":"/files/documentation/pdf/18/postgresql-18-A4.pdf"},"US":{"built_at":"2026-09-26","bytes":15748059,"pages":3328,"sha256":"facbe6c229e598b872d3d98bef53308f46e06746006fa4590de9a7de9dd46319","url":"/files/documentation/pdf/18/postgresql-18-US.pdf"}},"release":"18.6","source_mode":"en SGML built with pinned official archive","source_sha256":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f","source_url":"https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2","svg_assets":3,"tree":"18"},"ref":"https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2","revision":"ee8d1a3612338fd9adf250730cb640fcc5233b5491337cc00a316a44e3a0b9f8","source_sha256":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f"},"sources":[{"anchor":"","file":"app-pgdump.html","label":"18.6 English manual · app-pgdump.html","sha256":"758860baaa3462061cc6343b8d04559ec3fbc9e77c00e426f5eb8b32c863509e","url":"/docs/18/app-pgdump.html"},{"anchor":"","file":"reference-client.html","label":"Client applications inventory","sha256":"68f726af77272fe73a827be2b7b5958d0f2239a6f8ed44264e9d42496bfa4fd0","url":"/docs/18/reference-client.html"}]},"MeasuredEvidence":{}},"Text":{"Collection":"tool","Key":"pg-dump","SourceDatabase":"center","Version":"18","Locale":"en","Title":"pg_dump","Summary":"pg_dump — export a PostgreSQL database as an SQL script or to other formats","BodyHTML":"\u003cdiv\u003e\u003cdiv id=\"APP-PGDUMP\"\u003e\n\u003cdiv\u003e\u003c/div\u003e\n\u003cdiv\u003e\n\u003ch2\u003e\u003cspan\u003e\u003cspan\u003epg_dump\u003c/span\u003e\u003c/span\u003e\u003c/h2\u003e\n\u003cp\u003epg_dump — export a \u003cspan\u003ePostgreSQL\u003c/span\u003e database as an SQL script or to other formats\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv\u003e\n\u003ch2\u003eSynopsis\u003c/h2\u003e\n\u003cdiv\u003e\n\u003cp id=\"id-1.9.4.14.4.1\"\u003e\u003ccode\u003epg_dump\u003c/code\u003e [\u003cem\u003e\u003ccode\u003econnection-option\u003c/code\u003e\u003c/em\u003e...] [\u003cem\u003e\u003ccode\u003eoption\u003c/code\u003e\u003c/em\u003e...] [\u003cem\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e]\u003c/p\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cdiv id=\"PG-DUMP-DESCRIPTION\"\u003e\n\u003ch2\u003eDescription\u003c/h2\u003e\n\u003cp\u003e\u003cspan\u003epg_dump\u003c/span\u003e is a utility for exporting a \u003cspan\u003ePostgreSQL\u003c/span\u003e database. It makes consistent exports even if the database is being used concurrently. \u003cspan\u003epg_dump\u003c/span\u003e does not block other users accessing the database (readers or writers). Note, however, that except in simple cases, \u003cspan\u003epg_dump\u003c/span\u003e is generally not the right choice for taking regular backups of production databases. See \u003ca href=\"/docs/18/backup.html\" rel=\"nofollow\"\u003eChapter 25\u003c/a\u003e for further discussion.\u003c/p\u003e\n\u003cp\u003e\u003cspan\u003epg_dump\u003c/span\u003e only dumps a single database. To export an entire cluster, or to export global objects that are common to all databases in a cluster (such as roles and tablespaces), use \u003ca href=\"/docs/18/app-pg-dumpall.html\" title=\"pg_dumpall\" rel=\"nofollow\"\u003e\u003cspan\u003e\u003cspan\u003epg_dumpall\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e.\u003c/p\u003e\n\u003cp\u003eDumps can be output in script or archive file formats. Script dumps are plain-text files containing the SQL commands required to reconstruct the database to the state it was in at the time it was saved. To restore from such a script, feed it to \u003ca href=\"/docs/18/app-psql.html\" title=\"psql\" rel=\"nofollow\"\u003e\u003cspan\u003e\u003cspan\u003epsql\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e. Script files can be used to reconstruct the database even on other machines and other architectures; with some modifications, even on other SQL database products.\u003c/p\u003e\n\u003cp\u003eThe alternative archive file formats must be used with \u003ca href=\"/docs/18/app-pgrestore.html\" title=\"pg_restore\" rel=\"nofollow\"\u003e\u003cspan\u003e\u003cspan\u003epg_restore\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e to rebuild the database. They allow \u003cspan\u003epg_restore\u003c/span\u003e to be selective about what is restored, or even to reorder the items prior to being restored. The archive file formats are designed to be portable across architectures.\u003c/p\u003e\n\u003cp\u003eWhen used with one of the archive file formats and combined with \u003cspan\u003epg_restore\u003c/span\u003e, \u003cspan\u003epg_dump\u003c/span\u003e provides a flexible archival and transfer mechanism. \u003cspan\u003epg_dump\u003c/span\u003e can be used to export an entire database, then \u003cspan\u003epg_restore\u003c/span\u003e can be used to examine the archive and/or select which parts of the database are to be restored. The most flexible output file formats are the \u003cspan\u003e“\u003cspan\u003ecustom\u003c/span\u003e”\u003c/span\u003e format (\u003ccode\u003e-Fc\u003c/code\u003e) and the \u003cspan\u003e“\u003cspan\u003edirectory\u003c/span\u003e”\u003c/span\u003e format (\u003ccode\u003e-Fd\u003c/code\u003e). They allow for selection and reordering of all archived items, support parallel restoration, and are compressed by default. The \u003cspan\u003e“\u003cspan\u003edirectory\u003c/span\u003e”\u003c/span\u003e format is the only format that supports parallel dumps.\u003c/p\u003e\n\u003cp\u003eWhile running \u003cspan\u003epg_dump\u003c/span\u003e, one should examine the output for any warnings (printed on standard error), especially in light of the limitations listed below.\u003c/p\u003e\n\u003cdiv\u003e\n\u003ch3\u003eWarning\u003c/h3\u003e\n\u003cp\u003eRestoring a dump causes the destination to execute arbitrary code of the source superusers\u0026#39; choice. Partial dumps and partial restores do not limit that. If the source superusers are not trusted, the dumped SQL statements must be inspected before restoring. Non-plain-text dumps can be inspected by using \u003cspan\u003epg_restore\u003c/span\u003e\u0026#39;s \u003ccode\u003e--file\u003c/code\u003e option. Note that the client running the dump and restore need not trust the source or destination superusers.\u003c/p\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cdiv id=\"PG-DUMP-OPTIONS\"\u003e\n\u003ch2\u003eOptions\u003c/h2\u003e\n\u003cp\u003eThe following command-line options control the content and format of the output.\u003c/p\u003e\n\u003cdiv\u003e\n\u003cdl\u003e\n\u003cdt\u003e\u003cspan\u003e\u003cem\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the name of the database to be dumped. If this is not specified, the environment variable \u003ccode\u003ePGDATABASE\u003c/code\u003e is used. If that is not set, the user name specified for the connection is used.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-a\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--data-only\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDump only the data, not the schema (data definitions) or statistics. Table data, large objects, and sequence values are dumped.\u003c/p\u003e\n\u003cp\u003eThis option is similar to, but for historical reasons not identical to, specifying \u003ccode\u003e--section=data\u003c/code\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-b\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--large-objects\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--blobs\u003c/code\u003e (deprecated)\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eInclude large objects in the dump. This is the default behavior except when \u003ccode\u003e--schema\u003c/code\u003e, \u003ccode\u003e--table\u003c/code\u003e, \u003ccode\u003e--schema-only\u003c/code\u003e, \u003ccode\u003e--statistics-only\u003c/code\u003e, or \u003ccode\u003e--no-data\u003c/code\u003e is specified. The \u003ccode\u003e-b\u003c/code\u003e switch is therefore only useful to add large objects to dumps where a specific schema or table has been requested. Note that large objects are considered data and therefore will be included when \u003ccode\u003e--data-only\u003c/code\u003e is used, but not when \u003ccode\u003e--schema-only\u003c/code\u003e or \u003ccode\u003e--statistics-only\u003c/code\u003e is.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-B\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--no-large-objects\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--no-blobs\u003c/code\u003e (deprecated)\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eExclude large objects in the dump.\u003c/p\u003e\n\u003cp\u003eWhen both \u003ccode\u003e-b\u003c/code\u003e and \u003ccode\u003e-B\u003c/code\u003e are given, the behavior is to output large objects, when data is being dumped, see the \u003ccode\u003e-b\u003c/code\u003e documentation.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-c\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--clean\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eOutput commands to \u003ccode\u003eDROP\u003c/code\u003e all the dumped database objects prior to outputting the commands for creating them. This option is useful when the restore is to overwrite an existing database. If any of the objects do not exist in the destination database, ignorable error messages will be reported during restore, unless \u003ccode\u003e--if-exists\u003c/code\u003e is also specified.\u003c/p\u003e\n\u003cp\u003eThis option is ignored when emitting an archive (non-text) output file. For the archive formats, you can specify the option when you call \u003ccode\u003epg_restore\u003c/code\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-C\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--create\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eBegin the output with a command to create the database itself and reconnect to the created database. (With a script of this form, it doesn\u0026#39;t matter which database in the destination installation you connect to before running the script.) If \u003ccode\u003e--clean\u003c/code\u003e is also specified, the script drops and recreates the target database before reconnecting to it.\u003c/p\u003e\n\u003cp\u003eWith \u003ccode\u003e--create\u003c/code\u003e, the output also includes the database\u0026#39;s comment if any, and any configuration variable settings that are specific to this database, that is, any \u003ccode\u003eALTER DATABASE ... SET ...\u003c/code\u003e and \u003ccode\u003eALTER ROLE ... IN DATABASE ... SET ...\u003c/code\u003e commands that mention this database. Access privileges for the database itself are also dumped, unless \u003ccode\u003e--no-acl\u003c/code\u003e is specified.\u003c/p\u003e\n\u003cp\u003eThis option is ignored when emitting an archive (non-text) output file. For the archive formats, you can specify the option when you call \u003ccode\u003epg_restore\u003c/code\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-e \u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--extension=\u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDump only extensions matching \u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e. When this option is not specified, all non-system extensions in the target database will be dumped. Multiple extensions can be selected by writing multiple \u003ccode\u003e-e\u003c/code\u003e switches. The \u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e parameter is interpreted as a pattern according to the same rules used by \u003cspan\u003epsql\u003c/span\u003e\u0026#39;s \u003ccode\u003e\\d\u003c/code\u003e commands (see \u003ca href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\" rel=\"nofollow\"\u003ePatterns\u003c/a\u003e), so multiple extensions can also be selected by writing wildcard characters in the pattern. When using wildcards, be careful to quote the pattern if needed to prevent the shell from expanding the wildcards.\u003c/p\u003e\n\u003cp\u003eAny configuration relation registered by \u003ccode\u003epg_extension_config_dump\u003c/code\u003e is included in the dump if its extension is specified by \u003ccode\u003e--extension\u003c/code\u003e.\u003c/p\u003e\n\u003cdiv\u003e\n\u003ch3\u003eNote\u003c/h3\u003e\n\u003cp\u003eWhen \u003ccode\u003e-e\u003c/code\u003e is specified, \u003cspan\u003epg_dump\u003c/span\u003e makes no attempt to dump any other database objects that the selected extension(s) might depend upon. Therefore, there is no guarantee that the results of a specific-extension dump can be successfully restored by themselves into a clean database.\u003c/p\u003e\n\u003c/div\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-E \u003cem\u003e\u003ccode\u003eencoding\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--encoding=\u003cem\u003e\u003ccode\u003eencoding\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eCreate the dump in the specified character set encoding. By default, the dump is created in the database encoding. (Another way to get the same result is to set the \u003ccode\u003ePGCLIENTENCODING\u003c/code\u003e environment variable to the desired dump encoding.) The supported encodings are described in \u003ca href=\"/docs/18/multibyte.html#MULTIBYTE-CHARSET-SUPPORTED\" rel=\"nofollow\"\u003eSection 23.3.1\u003c/a\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-f \u003cem\u003e\u003ccode\u003efile\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--file=\u003cem\u003e\u003ccode\u003efile\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSend output to the specified file. This parameter can be omitted for file based output formats, in which case the standard output is used. It must be given for the directory output format however, where it specifies the target directory instead of a file. In this case the directory is created by \u003ccode\u003epg_dump\u003c/code\u003e and must not exist before.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-F \u003cem\u003e\u003ccode\u003eformat\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--format=\u003cem\u003e\u003ccode\u003eformat\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSelects the format of the output. \u003cem\u003e\u003ccode\u003eformat\u003c/code\u003e\u003c/em\u003e can be one of the following:\u003c/p\u003e\n\u003cdiv\u003e\n\u003cdl\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003ep\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003eplain\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eOutput a plain-text SQL script file (the default).\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003ec\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003ecustom\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eOutput a custom-format archive suitable for input into \u003cspan\u003epg_restore\u003c/span\u003e. Together with the directory output format, this is the most flexible output format in that it allows manual selection and reordering of archived items during restore. This format is also compressed by default.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003ed\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003edirectory\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eOutput a directory-format archive suitable for input into \u003cspan\u003epg_restore\u003c/span\u003e. This will create a directory with one file for each table and large object being dumped, plus a so-called Table of Contents file describing the dumped objects in a machine-readable format that \u003cspan\u003epg_restore\u003c/span\u003e can read. A directory format archive can be manipulated with standard Unix tools; for example, files in an uncompressed archive can be compressed with the \u003cspan\u003egzip\u003c/span\u003e, \u003cspan\u003elz4\u003c/span\u003e, or \u003cspan\u003ezstd\u003c/span\u003e tools. This format is compressed by default using \u003ccode\u003egzip\u003c/code\u003e and also supports parallel dumps.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003et\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003etar\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eOutput a \u003ccode\u003etar\u003c/code\u003e-format archive suitable for input into \u003cspan\u003epg_restore\u003c/span\u003e. The tar format is compatible with the directory format: extracting a tar-format archive produces a valid directory-format archive. However, the tar format does not support compression. Also, when using tar format the relative order of table data items cannot be changed during restore.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-j \u003cem\u003e\u003ccode\u003enjobs\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--jobs=\u003cem\u003e\u003ccode\u003enjobs\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eRun the dump in parallel by dumping \u003cem\u003e\u003ccode\u003enjobs\u003c/code\u003e\u003c/em\u003e tables simultaneously. This option may reduce the time needed to perform the dump but it also increases the load on the database server. You can only use this option with the directory output format because this is the only output format where multiple processes can write their data at the same time.\u003c/p\u003e\n\u003cp\u003e\u003cspan\u003epg_dump\u003c/span\u003e will open \u003cem\u003e\u003ccode\u003enjobs\u003c/code\u003e\u003c/em\u003e + 1 connections to the database, so make sure your \u003ca href=\"/docs/18/runtime-config-connection.html#GUC-MAX-CONNECTIONS\" rel=\"nofollow\"\u003emax_connections\u003c/a\u003e setting is high enough to accommodate all connections.\u003c/p\u003e\n\u003cp\u003eRequesting exclusive locks on database objects while running a parallel dump could cause the dump to fail. The reason is that the \u003cspan\u003epg_dump\u003c/span\u003e leader process requests shared locks (\u003ca href=\"/docs/18/explicit-locking.html#LOCKING-TABLES\" rel=\"nofollow\"\u003eACCESS SHARE\u003c/a\u003e) on the objects that the worker processes are going to dump later in order to make sure that nobody deletes them and makes them go away while the dump is running. If another client then requests an exclusive lock on a table, that lock will not be granted but will be queued waiting for the shared lock of the leader process to be released. Consequently any other access to the table will not be granted either and will queue after the exclusive lock request. This includes the worker process trying to dump the table. Without any precautions this would be a classic deadlock situation. To detect this conflict, the \u003cspan\u003epg_dump\u003c/span\u003e worker process requests another shared lock using the \u003ccode\u003eNOWAIT\u003c/code\u003e option. If the worker process is not granted this shared lock, somebody else must have requested an exclusive lock in the meantime and there is no way to continue with the dump, so \u003cspan\u003epg_dump\u003c/span\u003e has no choice but to abort the dump.\u003c/p\u003e\n\u003cp\u003eTo perform a parallel dump, the database server needs to support synchronized snapshots, a feature that was introduced in \u003cspan\u003ePostgreSQL\u003c/span\u003e 9.2 for primary servers and 10 for standbys. With this feature, database clients can ensure they see the same data set even though they use different connections. \u003ccode\u003epg_dump -j\u003c/code\u003e uses multiple database connections; it connects to the database once with the leader process and once again for each worker job. Without the synchronized snapshot feature, the different worker jobs wouldn\u0026#39;t be guaranteed to see the same data in each connection, which could lead to an inconsistent backup.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-n \u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--schema=\u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDump only schemas matching \u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e; this selects both the schema itself, and all its contained objects. When this option is not specified, all non-system schemas in the target database will be dumped. Multiple schemas can be selected by writing multiple \u003ccode\u003e-n\u003c/code\u003e switches. The \u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e parameter is interpreted as a pattern according to the same rules used by \u003cspan\u003epsql\u003c/span\u003e\u0026#39;s \u003ccode\u003e\\d\u003c/code\u003e commands (see \u003ca href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\" rel=\"nofollow\"\u003ePatterns\u003c/a\u003e), so multiple schemas can also be selected by writing wildcard characters in the pattern. When using wildcards, be careful to quote the pattern if needed to prevent the shell from expanding the wildcards; see \u003ca href=\"/docs/18/app-pgdump.html#PG-DUMP-EXAMPLES\" title=\"Examples\" rel=\"nofollow\"\u003eExamples\u003c/a\u003e below.\u003c/p\u003e\n\u003cdiv\u003e\n\u003ch3\u003eNote\u003c/h3\u003e\n\u003cp\u003eWhen \u003ccode\u003e-n\u003c/code\u003e is specified, \u003cspan\u003epg_dump\u003c/span\u003e makes no attempt to dump any other database objects that the selected schema(s) might depend upon. Therefore, there is no guarantee that the results of a specific-schema dump can be successfully restored by themselves into a clean database.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv\u003e\n\u003ch3\u003eNote\u003c/h3\u003e\n\u003cp\u003eNon-schema objects such as large objects are not dumped when \u003ccode\u003e-n\u003c/code\u003e is specified. You can add large objects back to the dump with the \u003ccode\u003e--large-objects\u003c/code\u003e switch.\u003c/p\u003e\n\u003c/div\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-N \u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--exclude-schema=\u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not dump any schemas matching \u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e. The pattern is interpreted according to the same rules as for \u003ccode\u003e-n\u003c/code\u003e. \u003ccode\u003e-N\u003c/code\u003e can be given more than once to exclude schemas matching any of several patterns.\u003c/p\u003e\n\u003cp\u003eWhen both \u003ccode\u003e-n\u003c/code\u003e and \u003ccode\u003e-N\u003c/code\u003e are given, the behavior is to dump just the schemas that match at least one \u003ccode\u003e-n\u003c/code\u003e switch but no \u003ccode\u003e-N\u003c/code\u003e switches. If \u003ccode\u003e-N\u003c/code\u003e appears without \u003ccode\u003e-n\u003c/code\u003e, then schemas matching \u003ccode\u003e-N\u003c/code\u003e are excluded from what is otherwise a normal dump.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-O\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--no-owner\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not output commands to set ownership of objects to match the original database. By default, \u003cspan\u003epg_dump\u003c/span\u003e issues \u003ccode\u003eALTER OWNER\u003c/code\u003e or \u003ccode\u003eSET SESSION AUTHORIZATION\u003c/code\u003e statements to set ownership of created database objects. These statements will fail when the script is run unless it is started by a superuser (or the same user that owns all of the objects in the script). To make a script that can be restored by any user, but will give that user ownership of all the objects, specify \u003ccode\u003e-O\u003c/code\u003e.\u003c/p\u003e\n\u003cp\u003eThis option is ignored when emitting an archive (non-text) output file. For the archive formats, you can specify the option when you call \u003ccode\u003epg_restore\u003c/code\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-R\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--no-reconnect\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThis option is obsolete but still accepted for backwards compatibility.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-s\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--schema-only\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDump only the object definitions (schema), not data or statistics.\u003c/p\u003e\n\u003cp\u003eThis option cannot be used with \u003ccode\u003e--data-only\u003c/code\u003e or \u003ccode\u003e--statistics-only\u003c/code\u003e. It is similar to, but for historical reasons not identical to, specifying \u003ccode\u003e--section=pre-data --section=post-data\u003c/code\u003e.\u003c/p\u003e\n\u003cp\u003e(Do not confuse this with the \u003ccode\u003e--schema\u003c/code\u003e option, which uses the word \u003cspan\u003e“\u003cspan\u003eschema\u003c/span\u003e”\u003c/span\u003e in a different meaning.)\u003c/p\u003e\n\u003cp\u003eTo exclude table data for only a subset of tables in the database, see \u003ccode\u003e--exclude-table-data\u003c/code\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-S \u003cem\u003e\u003ccode\u003eusername\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--superuser=\u003cem\u003e\u003ccode\u003eusername\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecify the superuser user name to use when disabling triggers. This is relevant only if \u003ccode\u003e--disable-triggers\u003c/code\u003e is used. (Usually, it\u0026#39;s better to leave this out, and instead start the resulting script as superuser.)\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-t \u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--table=\u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDump only tables with names matching \u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e. Multiple tables can be selected by writing multiple \u003ccode\u003e-t\u003c/code\u003e switches. The \u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e parameter is interpreted as a pattern according to the same rules used by \u003cspan\u003epsql\u003c/span\u003e\u0026#39;s \u003ccode\u003e\\d\u003c/code\u003e commands (see \u003ca href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\" rel=\"nofollow\"\u003ePatterns\u003c/a\u003e), so multiple tables can also be selected by writing wildcard characters in the pattern. When using wildcards, be careful to quote the pattern if needed to prevent the shell from expanding the wildcards; see \u003ca href=\"/docs/18/app-pgdump.html#PG-DUMP-EXAMPLES\" title=\"Examples\" rel=\"nofollow\"\u003eExamples\u003c/a\u003e below.\u003c/p\u003e\n\u003cp\u003eAs well as tables, this option can be used to dump the definition of matching views, materialized views, foreign tables, and sequences. It will not dump the contents of views or materialized views, and the contents of foreign tables will only be dumped if the corresponding foreign server is specified with \u003ccode\u003e--include-foreign-data\u003c/code\u003e.\u003c/p\u003e\n\u003cp\u003eThe \u003ccode\u003e-n\u003c/code\u003e and \u003ccode\u003e-N\u003c/code\u003e switches have no effect when \u003ccode\u003e-t\u003c/code\u003e is used, because tables selected by \u003ccode\u003e-t\u003c/code\u003e will be dumped regardless of those switches, and non-table objects will not be dumped.\u003c/p\u003e\n\u003cdiv\u003e\n\u003ch3\u003eNote\u003c/h3\u003e\n\u003cp\u003eWhen \u003ccode\u003e-t\u003c/code\u003e is specified, \u003cspan\u003epg_dump\u003c/span\u003e makes no attempt to dump any other database objects that the selected table(s) might depend upon. Therefore, there is no guarantee that the results of a specific-table dump can be successfully restored by themselves into a clean database.\u003c/p\u003e\n\u003c/div\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-T \u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--exclude-table=\u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not dump any tables matching \u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e. The pattern is interpreted according to the same rules as for \u003ccode\u003e-t\u003c/code\u003e. \u003ccode\u003e-T\u003c/code\u003e can be given more than once to exclude tables matching any of several patterns.\u003c/p\u003e\n\u003cp\u003eWhen both \u003ccode\u003e-t\u003c/code\u003e and \u003ccode\u003e-T\u003c/code\u003e are given, the behavior is to dump just the tables that match at least one \u003ccode\u003e-t\u003c/code\u003e switch but no \u003ccode\u003e-T\u003c/code\u003e switches. If \u003ccode\u003e-T\u003c/code\u003e appears without \u003ccode\u003e-t\u003c/code\u003e, then tables matching \u003ccode\u003e-T\u003c/code\u003e are excluded from what is otherwise a normal dump.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-v\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--verbose\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies verbose mode. This will cause \u003cspan\u003epg_dump\u003c/span\u003e to output detailed object comments and start/stop times to the dump file, and progress messages to standard error. Repeating the option causes additional debug-level messages to appear on standard error.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-V\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--version\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003ePrint the \u003cspan\u003epg_dump\u003c/span\u003e version and exit.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-x\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--no-privileges\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--no-acl\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003ePrevent dumping of access privileges (grant/revoke commands).\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-Z \u003cem\u003e\u003ccode\u003elevel\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e-Z \u003cem\u003e\u003ccode\u003emethod\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e[:\u003cem\u003e\u003ccode\u003edetail\u003c/code\u003e\u003c/em\u003e]\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--compress=\u003cem\u003e\u003ccode\u003elevel\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--compress=\u003cem\u003e\u003ccode\u003emethod\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e[:\u003cem\u003e\u003ccode\u003edetail\u003c/code\u003e\u003c/em\u003e]\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecify the compression method and/or the compression level to use. The compression method can be set to \u003ccode\u003egzip\u003c/code\u003e, \u003ccode\u003elz4\u003c/code\u003e, \u003ccode\u003ezstd\u003c/code\u003e, or \u003ccode\u003enone\u003c/code\u003e for no compression. A compression detail string can optionally be specified. If the detail string is an integer, it specifies the compression level. Otherwise, it should be a comma-separated list of items, each of the form \u003ccode\u003ekeyword\u003c/code\u003e or \u003ccode\u003ekeyword=value\u003c/code\u003e. Currently, the supported keywords are \u003ccode\u003elevel\u003c/code\u003e and \u003ccode\u003elong\u003c/code\u003e.\u003c/p\u003e\n\u003cp\u003eIf no compression level is specified, the default compression level will be used. If only a level is specified without mentioning an algorithm, \u003ccode\u003egzip\u003c/code\u003e compression will be used if the level is greater than \u003ccode\u003e0\u003c/code\u003e, and no compression will be used if the level is \u003ccode\u003e0\u003c/code\u003e.\u003c/p\u003e\n\u003cp\u003eFor the custom and directory archive formats, this specifies compression of individual table-data segments, and the default is to compress using \u003ccode\u003egzip\u003c/code\u003e at a moderate level. For plain text output, setting a nonzero compression level causes the entire output file to be compressed, as though it had been fed through \u003cspan\u003egzip\u003c/span\u003e, \u003cspan\u003elz4\u003c/span\u003e, or \u003cspan\u003ezstd\u003c/span\u003e; but the default is not to compress. With zstd compression, \u003ccode\u003elong\u003c/code\u003e mode may improve the compression ratio, at the cost of increased memory use.\u003c/p\u003e\n\u003cp\u003eThe tar archive format currently does not support compression at all.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--binary-upgrade\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThis option is for use by in-place upgrade utilities. Its use for other purposes is not recommended or supported. The behavior of the option may change in future releases without notice.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--column-inserts\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--attribute-inserts\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDump data as \u003ccode\u003eINSERT\u003c/code\u003e commands with explicit column names (\u003ccode\u003eINSERT INTO \u003cem\u003e\u003ccode\u003etable\u003c/code\u003e\u003c/em\u003e (\u003cem\u003e\u003ccode\u003ecolumn\u003c/code\u003e\u003c/em\u003e, ...) VALUES ...\u003c/code\u003e). This will make restoration very slow; it is mainly useful for making dumps that can be loaded into non-\u003cspan\u003ePostgreSQL\u003c/span\u003e databases. Any error during restoring will cause only rows that are part of the problematic \u003ccode\u003eINSERT\u003c/code\u003e to be lost, rather than the entire table contents.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--disable-dollar-quoting\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThis option disables the use of dollar quoting for function bodies, and forces them to be quoted using SQL standard string syntax.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--disable-triggers\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThis option is relevant only when creating a dump that includes data but does not include schema. It instructs \u003cspan\u003epg_dump\u003c/span\u003e to include commands to temporarily disable triggers on the target tables while the data is restored. Use this if you have referential integrity checks or other triggers on the tables that you do not want to invoke during data restore.\u003c/p\u003e\n\u003cp\u003ePresently, the commands emitted for \u003ccode\u003e--disable-triggers\u003c/code\u003e must be done as superuser. So, you should also specify a superuser name with \u003ccode\u003e-S\u003c/code\u003e, or preferably be careful to start the resulting script as a superuser.\u003c/p\u003e\n\u003cp\u003eThis option is ignored when emitting an archive (non-text) output file. For the archive formats, you can specify the option when you call \u003ccode\u003epg_restore\u003c/code\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--enable-row-security\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThis option is relevant only when dumping the contents of a table which has row security. By default, \u003cspan\u003epg_dump\u003c/span\u003e will set \u003ca href=\"/docs/18/runtime-config-client.html#GUC-ROW-SECURITY\" rel=\"nofollow\"\u003erow_security\u003c/a\u003e to off, to ensure that all data is dumped from the table. If the user does not have sufficient privileges to bypass row security, then an error is thrown. This parameter instructs \u003cspan\u003epg_dump\u003c/span\u003e to set \u003ca href=\"/docs/18/runtime-config-client.html#GUC-ROW-SECURITY\" rel=\"nofollow\"\u003erow_security\u003c/a\u003e to on instead, allowing the user to dump the parts of the contents of the table that they have access to.\u003c/p\u003e\n\u003cp\u003eNote that if you use this option currently, you probably also want the dump be in \u003ccode\u003eINSERT\u003c/code\u003e format, as the \u003ccode\u003eCOPY FROM\u003c/code\u003e during restore does not support row security.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--exclude-extension=\u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not dump any extensions matching \u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e. The pattern is interpreted according to the same rules as for \u003ccode\u003e-e\u003c/code\u003e. \u003ccode\u003e--exclude-extension\u003c/code\u003e can be given more than once to exclude extensions matching any of several patterns.\u003c/p\u003e\n\u003cp\u003eWhen both \u003ccode\u003e-e\u003c/code\u003e and \u003ccode\u003e--exclude-extension\u003c/code\u003e are given, the behavior is to dump just the extensions that match at least one \u003ccode\u003e-e\u003c/code\u003e switch but no \u003ccode\u003e--exclude-extension\u003c/code\u003e switches. If \u003ccode\u003e--exclude-extension\u003c/code\u003e appears without \u003ccode\u003e-e\u003c/code\u003e, then extensions matching \u003ccode\u003e--exclude-extension\u003c/code\u003e are excluded from what is otherwise a normal dump.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--exclude-table-and-children=\u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThis is the same as the \u003ccode\u003e-T\u003c/code\u003e/\u003ccode\u003e--exclude-table\u003c/code\u003e option, except that it also excludes any partitions or inheritance child tables of the table(s) matching the \u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--exclude-table-data=\u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not dump data for any tables matching \u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e. The pattern is interpreted according to the same rules as for \u003ccode\u003e-t\u003c/code\u003e. \u003ccode\u003e--exclude-table-data\u003c/code\u003e can be given more than once to exclude tables matching any of several patterns. This option is useful when you need the definition of a particular table even though you do not need the data in it.\u003c/p\u003e\n\u003cp\u003eTo exclude data for all tables in the database, see \u003ccode\u003e--schema-only\u003c/code\u003e or \u003ccode\u003e--statistics-only\u003c/code\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--exclude-table-data-and-children=\u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThis is the same as the \u003ccode\u003e--exclude-table-data\u003c/code\u003e option, except that it also excludes data of any partitions or inheritance child tables of the table(s) matching the \u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--extra-float-digits=\u003cem\u003e\u003ccode\u003endigits\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eUse the specified value of \u003ccode\u003eextra_float_digits\u003c/code\u003e when dumping floating-point data, instead of the maximum available precision. Routine dumps made for backup purposes should not use this option.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--filter=\u003cem\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecify a filename from which to read patterns for objects to include or exclude from the dump. The patterns are interpreted according to the same rules as the corresponding options: \u003ccode\u003e-t\u003c/code\u003e/\u003ccode\u003e--table\u003c/code\u003e, \u003ccode\u003e--table-and-children\u003c/code\u003e, \u003ccode\u003e-T\u003c/code\u003e/\u003ccode\u003e--exclude-table\u003c/code\u003e, and \u003ccode\u003e--exclude-table-and-children\u003c/code\u003e for tables, \u003ccode\u003e-n\u003c/code\u003e/\u003ccode\u003e--schema\u003c/code\u003e and \u003ccode\u003e-N\u003c/code\u003e/\u003ccode\u003e--exclude-schema\u003c/code\u003e for schemas, \u003ccode\u003e--include-foreign-data\u003c/code\u003e for data on foreign servers, \u003ccode\u003e--exclude-table-data\u003c/code\u003e and \u003ccode\u003e--exclude-table-data-and-children\u003c/code\u003e for table data, and \u003ccode\u003e-e\u003c/code\u003e/\u003ccode\u003e--extension\u003c/code\u003e and \u003ccode\u003e--exclude-extension\u003c/code\u003e for extensions. To read from \u003ccode\u003eSTDIN\u003c/code\u003e, use \u003ccode\u003e-\u003c/code\u003e as the filename. The \u003ccode\u003e--filter\u003c/code\u003e option can be specified in conjunction with the above listed options for including or excluding objects, and can also be specified more than once for multiple filter files.\u003c/p\u003e\n\u003cp\u003eThe file lists one object pattern per row, with the following format:\u003c/p\u003e\n\u003cpre\u003e{ include | exclude } { extension | foreign_data | table | table_and_children | table_data | table_data_and_children | schema } \u003cem\u003e\u003ccode\u003ePATTERN\u003c/code\u003e\u003c/em\u003e\n\u003c/pre\u003e\n\u003cp\u003eThe first keyword specifies whether the objects matched by the pattern are to be included or excluded. The second keyword specifies the type of object to be filtered using the pattern:\u003c/p\u003e\n\u003cdiv\u003e\n\u003cul\u003e\n\u003cli\u003e\n\u003cp\u003e\u003ccode\u003eextension\u003c/code\u003e: extensions. This works like the \u003ccode\u003e-e\u003c/code\u003e/\u003ccode\u003e--extension\u003c/code\u003e or \u003ccode\u003e--exclude-extension\u003c/code\u003e option.\u003c/p\u003e\n\u003c/li\u003e\n\u003cli\u003e\n\u003cp\u003e\u003ccode\u003eforeign_data\u003c/code\u003e: data on foreign servers. This works like the \u003ccode\u003e--include-foreign-data\u003c/code\u003e option. This keyword can only be used with the \u003ccode\u003einclude\u003c/code\u003e keyword.\u003c/p\u003e\n\u003c/li\u003e\n\u003cli\u003e\n\u003cp\u003e\u003ccode\u003etable\u003c/code\u003e: tables. This works like the \u003ccode\u003e-t\u003c/code\u003e/\u003ccode\u003e--table\u003c/code\u003e or \u003ccode\u003e-T\u003c/code\u003e/\u003ccode\u003e--exclude-table\u003c/code\u003e option.\u003c/p\u003e\n\u003c/li\u003e\n\u003cli\u003e\n\u003cp\u003e\u003ccode\u003etable_and_children\u003c/code\u003e: tables including any partitions or inheritance child tables. This works like the \u003ccode\u003e--table-and-children\u003c/code\u003e or \u003ccode\u003e--exclude-table-and-children\u003c/code\u003e option.\u003c/p\u003e\n\u003c/li\u003e\n\u003cli\u003e\n\u003cp\u003e\u003ccode\u003etable_data\u003c/code\u003e: table data of any tables matching \u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e. This works like the \u003ccode\u003e--exclude-table-data\u003c/code\u003e option. This keyword can only be used with the \u003ccode\u003eexclude\u003c/code\u003e keyword.\u003c/p\u003e\n\u003c/li\u003e\n\u003cli\u003e\n\u003cp\u003e\u003ccode\u003etable_data_and_children\u003c/code\u003e: table data of any tables matching \u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e as well as any partitions or inheritance children of the table(s). This works like the \u003ccode\u003e--exclude-table-data-and-children\u003c/code\u003e option. This keyword can only be used with the \u003ccode\u003eexclude\u003c/code\u003e keyword.\u003c/p\u003e\n\u003c/li\u003e\n\u003cli\u003e\n\u003cp\u003e\u003ccode\u003eschema\u003c/code\u003e: schemas. This works like the \u003ccode\u003e-n\u003c/code\u003e/\u003ccode\u003e--schema\u003c/code\u003e or \u003ccode\u003e-N\u003c/code\u003e/\u003ccode\u003e--exclude-schema\u003c/code\u003e option.\u003c/p\u003e\n\u003c/li\u003e\n\u003c/ul\u003e\n\u003c/div\u003e\n\u003cp\u003eLines starting with \u003ccode\u003e#\u003c/code\u003e are considered comments and ignored. Comments can be placed after an object pattern row as well. Blank lines are also ignored. See \u003ca href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\" rel=\"nofollow\"\u003ePatterns\u003c/a\u003e for how to perform quoting in patterns.\u003c/p\u003e\n\u003cp\u003eExample files are listed below in the \u003ca href=\"/docs/18/app-pgdump.html#PG-DUMP-EXAMPLES\" title=\"Examples\" rel=\"nofollow\"\u003eExamples\u003c/a\u003e section.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--if-exists\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eUse \u003ccode\u003eDROP ... IF EXISTS\u003c/code\u003e commands to drop objects in \u003ccode\u003e--clean\u003c/code\u003e mode. This suppresses \u003cspan\u003e“\u003cspan\u003edoes not exist\u003c/span\u003e”\u003c/span\u003e errors that might otherwise be reported. This option is not valid unless \u003ccode\u003e--clean\u003c/code\u003e is also specified.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--include-foreign-data=\u003cem\u003e\u003ccode\u003eforeignserver\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDump the data for any foreign table with a foreign server matching \u003cem\u003e\u003ccode\u003eforeignserver\u003c/code\u003e\u003c/em\u003e pattern. Multiple foreign servers can be selected by writing multiple \u003ccode\u003e--include-foreign-data\u003c/code\u003e switches. Also, the \u003cem\u003e\u003ccode\u003eforeignserver\u003c/code\u003e\u003c/em\u003e parameter is interpreted as a pattern according to the same rules used by \u003cspan\u003epsql\u003c/span\u003e\u0026#39;s \u003ccode\u003e\\d\u003c/code\u003e commands (see \u003ca href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\" rel=\"nofollow\"\u003ePatterns\u003c/a\u003e), so multiple foreign servers can also be selected by writing wildcard characters in the pattern. When using wildcards, be careful to quote the pattern if needed to prevent the shell from expanding the wildcards; see \u003ca href=\"/docs/18/app-pgdump.html#PG-DUMP-EXAMPLES\" title=\"Examples\" rel=\"nofollow\"\u003eExamples\u003c/a\u003e below. The only exception is that an empty pattern is disallowed.\u003c/p\u003e\n\u003cdiv\u003e\n\u003ch3\u003eNote\u003c/h3\u003e\n\u003cp\u003eUsing wildcards in \u003ccode\u003e--include-foreign-data\u003c/code\u003e may result in access to unexpected foreign servers. Also, to use this option securely, make sure that the named server must have a trusted owner.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv\u003e\n\u003ch3\u003eNote\u003c/h3\u003e\n\u003cp\u003eWhen \u003ccode\u003e--include-foreign-data\u003c/code\u003e is specified, \u003cspan\u003epg_dump\u003c/span\u003e does not check that the foreign table is writable. Therefore, there is no guarantee that the results of a foreign table dump can be successfully restored.\u003c/p\u003e\n\u003c/div\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--inserts\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDump data as \u003ccode\u003eINSERT\u003c/code\u003e commands (rather than \u003ccode\u003eCOPY\u003c/code\u003e). This will make restoration very slow; it is mainly useful for making dumps that can be loaded into non-\u003cspan\u003ePostgreSQL\u003c/span\u003e databases. Any error during restoring will cause only rows that are part of the problematic \u003ccode\u003eINSERT\u003c/code\u003e to be lost, rather than the entire table contents. Note that the restore might fail altogether if you have rearranged column order. The \u003ccode\u003e--column-inserts\u003c/code\u003e option is safe against column order changes, though even slower.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--load-via-partition-root\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eWhen dumping data for a table partition, make the \u003ccode\u003eCOPY\u003c/code\u003e or \u003ccode\u003eINSERT\u003c/code\u003e statements target the root of the partitioning hierarchy that contains it, rather than the partition itself. This causes the appropriate partition to be re-determined for each row when the data is loaded. This may be useful when restoring data on a server where rows do not always fall into the same partitions as they did on the original server. That could happen, for example, if the partitioning column is of type text and the two systems have different definitions of the collation used to sort the partitioning column.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--lock-wait-timeout=\u003cem\u003e\u003ccode\u003etimeout\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not wait forever to acquire shared table locks at the beginning of the dump. Instead fail if unable to lock a table within the specified \u003cem\u003e\u003ccode\u003etimeout\u003c/code\u003e\u003c/em\u003e. The timeout may be specified in any of the formats accepted by \u003ccode\u003eSET statement_timeout\u003c/code\u003e. (Allowed formats vary depending on the server version you are dumping from, but an integer number of milliseconds is accepted by all versions.)\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--no-comments\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not dump \u003ccode\u003eCOMMENT\u003c/code\u003e commands.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--no-data\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not dump data.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--no-policies\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not dump row security policies.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--no-publications\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not dump publications.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--no-schema\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not dump schema (data definitions).\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--no-security-labels\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not dump security labels.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--no-statistics\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not dump statistics. This is the default.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--no-subscriptions\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not dump subscriptions.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--no-sync\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eBy default, \u003ccode\u003epg_dump\u003c/code\u003e will wait for all files to be written safely to disk. This option causes \u003ccode\u003epg_dump\u003c/code\u003e to return without waiting, which is faster, but means that a subsequent operating system crash can leave the dump corrupt. Generally, this option is useful for testing but should not be used when dumping data from production installation.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--no-table-access-method\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not output commands to select table access methods. With this option, all objects will be created with whichever table access method is the default during restore.\u003c/p\u003e\n\u003cp\u003eThis option is ignored when emitting an archive (non-text) output file. For the archive formats, you can specify the option when you call \u003ccode\u003epg_restore\u003c/code\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--no-tablespaces\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not output commands to select tablespaces. With this option, all objects will be created in whichever tablespace is the default during restore.\u003c/p\u003e\n\u003cp\u003eThis option is ignored when emitting an archive (non-text) output file. For the archive formats, you can specify the option when you call \u003ccode\u003epg_restore\u003c/code\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--no-toast-compression\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not output commands to set TOAST compression methods. With this option, all columns will be restored with the default compression setting.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--no-unlogged-table-data\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not dump the contents of unlogged tables and sequences. This option has no effect on whether or not the table and sequence definitions (schema) are dumped; it only suppresses dumping the table and sequence data. Data in unlogged tables and sequences is always excluded when dumping from a standby server.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--on-conflict-do-nothing\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eAdd \u003ccode\u003eON CONFLICT DO NOTHING\u003c/code\u003e to \u003ccode\u003eINSERT\u003c/code\u003e commands. This option is not valid unless \u003ccode\u003e--inserts\u003c/code\u003e, \u003ccode\u003e--column-inserts\u003c/code\u003e or \u003ccode\u003e--rows-per-insert\u003c/code\u003e is also specified.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--quote-all-identifiers\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eForce quoting of all identifiers. This option is recommended when dumping a database from a server whose \u003cspan\u003ePostgreSQL\u003c/span\u003e major version is different from \u003cspan\u003epg_dump\u003c/span\u003e\u0026#39;s, or when the output is intended to be loaded into a server of a different major version. By default, \u003cspan\u003epg_dump\u003c/span\u003e quotes only identifiers that are reserved words in its own major version. This sometimes results in compatibility issues when dealing with servers of other versions that may have slightly different sets of reserved words. Using \u003ccode\u003e--quote-all-identifiers\u003c/code\u003e prevents such issues, at the price of a harder-to-read dump script.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--restrict-key=\u003cem\u003e\u003ccode\u003erestrict_key\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eUse the provided string as the \u003cspan\u003epsql\u003c/span\u003e \u003ccode\u003e\\restrict\u003c/code\u003e key in the dump output. This can only be specified for plain-text dumps, i.e., when \u003ccode\u003e--format\u003c/code\u003e is set to \u003ccode\u003eplain\u003c/code\u003e or the \u003ccode\u003e--format\u003c/code\u003e option is omitted. If no restrict key is specified, \u003cspan\u003epg_dump\u003c/span\u003e will generate a random one as needed. Keys may contain only alphanumeric characters.\u003c/p\u003e\n\u003cp\u003eThis option is primarily intended for testing purposes and other scenarios that require repeatable output (e.g., comparing dump files). It is not recommended for general use, as a malicious server with advance knowledge of the key may be able to inject arbitrary code that will be executed on the machine that runs \u003cspan\u003epsql\u003c/span\u003e with the dump output.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--rows-per-insert=\u003cem\u003e\u003ccode\u003enrows\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDump data as \u003ccode\u003eINSERT\u003c/code\u003e commands (rather than \u003ccode\u003eCOPY\u003c/code\u003e). Controls the maximum number of rows per \u003ccode\u003eINSERT\u003c/code\u003e command. The value specified must be a number greater than zero. Any error during restoring will cause only rows that are part of the problematic \u003ccode\u003eINSERT\u003c/code\u003e to be lost, rather than the entire table contents.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--section=\u003cem\u003e\u003ccode\u003esectionname\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eOnly dump the named section. The section name can be \u003ccode\u003epre-data\u003c/code\u003e, \u003ccode\u003edata\u003c/code\u003e, or \u003ccode\u003epost-data\u003c/code\u003e. This option can be specified more than once to select multiple sections. The default is to dump all sections.\u003c/p\u003e\n\u003cp\u003eThe data section contains actual table data, large-object contents, sequence values, and statistics for tables, materialized views, and foreign tables. Post-data items include definitions of indexes, triggers, rules, statistics for indexes, and constraints other than validated check and not-null constraints. Pre-data items include all other data definition items.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--sequence-data\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eInclude sequence data in the dump. This is the default behavior except when \u003ccode\u003e--no-data\u003c/code\u003e, \u003ccode\u003e--schema-only\u003c/code\u003e, or \u003ccode\u003e--statistics-only\u003c/code\u003e is specified.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--serializable-deferrable\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eUse a \u003ccode\u003eserializable\u003c/code\u003e transaction for the dump, to ensure that the snapshot used is consistent with later database states; but do this by waiting for a point in the transaction stream at which no anomalies can be present, so that there isn\u0026#39;t a risk of the dump failing or causing other transactions to roll back with a \u003ccode\u003eserialization_failure\u003c/code\u003e. See \u003ca href=\"/docs/18/mvcc.html\" rel=\"nofollow\"\u003eChapter 13\u003c/a\u003e for more information about transaction isolation and concurrency control.\u003c/p\u003e\n\u003cp\u003eThis option is not beneficial for a dump which is intended only for disaster recovery. It could be useful for a dump used to load a copy of the database for reporting or other read-only load sharing while the original database continues to be updated. Without it the dump may reflect a state which is not consistent with any serial execution of the transactions eventually committed. For example, if batch processing techniques are used, a batch may show as closed in the dump without all of the items which are in the batch appearing.\u003c/p\u003e\n\u003cp\u003eThis option will make no difference if there are no read-write transactions active when pg_dump is started. If read-write transactions are active, the start of the dump may be delayed for an indeterminate length of time. Once running, performance with or without the switch is the same.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--snapshot=\u003cem\u003e\u003ccode\u003esnapshotname\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eUse the specified synchronized snapshot when making a dump of the database (see \u003ca href=\"/docs/18/functions-admin.html#FUNCTIONS-SNAPSHOT-SYNCHRONIZATION-TABLE\" rel=\"nofollow\"\u003eTable 9.100\u003c/a\u003e for more details).\u003c/p\u003e\n\u003cp\u003eThis option is useful when needing to synchronize the dump with a logical replication slot (see \u003ca href=\"/docs/18/logicaldecoding.html\" rel=\"nofollow\"\u003eChapter 47\u003c/a\u003e) or with a concurrent session.\u003c/p\u003e\n\u003cp\u003eIn the case of a parallel dump, the snapshot name defined by this option is used rather than taking a new snapshot.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--statistics\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDump optimizer statistics.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--statistics-only\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDump only the statistics, not the schema (data definitions) or data. Optimizer statistics for tables, materialized views, foreign tables, and indexes are dumped.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--strict-names\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eRequire that each extension (\u003ccode\u003e-e\u003c/code\u003e/\u003ccode\u003e--extension\u003c/code\u003e), schema (\u003ccode\u003e-n\u003c/code\u003e/\u003ccode\u003e--schema\u003c/code\u003e) and table (\u003ccode\u003e-t\u003c/code\u003e/\u003ccode\u003e--table\u003c/code\u003e) pattern match at least one extension/schema/table in the database to be dumped. This also applies to filters used with \u003ccode\u003e--filter\u003c/code\u003e. Note that if none of the extension/schema/table patterns find matches, \u003cspan\u003epg_dump\u003c/span\u003e will generate an error even without \u003ccode\u003e--strict-names\u003c/code\u003e.\u003c/p\u003e\n\u003cp\u003eThis option has no effect on \u003ccode\u003e--exclude-extension\u003c/code\u003e, \u003ccode\u003e-N\u003c/code\u003e/\u003ccode\u003e--exclude-schema\u003c/code\u003e, \u003ccode\u003e-T\u003c/code\u003e/\u003ccode\u003e--exclude-table\u003c/code\u003e, or \u003ccode\u003e--exclude-table-data\u003c/code\u003e. An exclude pattern failing to match any objects is not considered an error.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--sync-method=\u003cem\u003e\u003ccode\u003emethod\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eWhen set to \u003ccode\u003efsync\u003c/code\u003e, which is the default, \u003ccode\u003epg_dump --format=directory\u003c/code\u003e will recursively open and synchronize all files in the archive directory.\u003c/p\u003e\n\u003cp\u003eOn Linux, \u003ccode\u003esyncfs\u003c/code\u003e may be used instead to ask the operating system to synchronize the whole file system that contains the archive directory. See \u003ca href=\"/docs/18/runtime-config-error-handling.html#GUC-RECOVERY-INIT-SYNC-METHOD\" rel=\"nofollow\"\u003erecovery_init_sync_method\u003c/a\u003e for information about the caveats to be aware of when using \u003ccode\u003esyncfs\u003c/code\u003e.\u003c/p\u003e\n\u003cp\u003eThis option has no effect when \u003ccode\u003e--no-sync\u003c/code\u003e is used or \u003ccode\u003e--format\u003c/code\u003e is not set to \u003ccode\u003edirectory\u003c/code\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--table-and-children=\u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThis is the same as the \u003ccode\u003e-t\u003c/code\u003e/\u003ccode\u003e--table\u003c/code\u003e option, except that it also includes any partitions or inheritance child tables of the table(s) matching the \u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--use-set-session-authorization\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eOutput SQL-standard \u003ccode\u003eSET SESSION AUTHORIZATION\u003c/code\u003e commands instead of \u003ccode\u003eALTER OWNER\u003c/code\u003e commands to determine object ownership. This makes the dump more standards-compatible, but depending on the history of the objects in the dump, might not restore properly. Also, a dump using \u003ccode\u003eSET SESSION AUTHORIZATION\u003c/code\u003e will certainly require superuser privileges to restore correctly, whereas \u003ccode\u003eALTER OWNER\u003c/code\u003e requires lesser privileges.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-?\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--help\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eShow help about \u003cspan\u003epg_dump\u003c/span\u003e command line arguments, and exit.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003cp\u003eThe following command-line options control the database connection parameters.\u003c/p\u003e\n\u003cdiv\u003e\n\u003cdl\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-d \u003cem\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--dbname=\u003cem\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the name of the database to connect to. This is equivalent to specifying \u003cem\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e as the first non-option argument on the command line. The \u003cem\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e can be a \u003ca href=\"/docs/18/libpq-connect.html#LIBPQ-CONNSTRING\" rel=\"nofollow\"\u003econnection string\u003c/a\u003e. If so, connection string parameters will override any conflicting command line options.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-h \u003cem\u003e\u003ccode\u003ehost\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--host=\u003cem\u003e\u003ccode\u003ehost\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket. The default is taken from the \u003ccode\u003ePGHOST\u003c/code\u003e environment variable, if set, else a Unix domain socket connection is attempted.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-p \u003cem\u003e\u003ccode\u003eport\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--port=\u003cem\u003e\u003ccode\u003eport\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the \u003ccode\u003ePGPORT\u003c/code\u003e environment variable, if set, or a compiled-in default.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-U \u003cem\u003e\u003ccode\u003eusername\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--username=\u003cem\u003e\u003ccode\u003eusername\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eUser name to connect as.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-w\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--no-password\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eNever issue a password prompt. If the server requires password authentication and a password is not available by other means such as a \u003ccode\u003e.pgpass\u003c/code\u003e file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-W\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--password\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eForce \u003cspan\u003epg_dump\u003c/span\u003e to prompt for a password before connecting to a database.\u003c/p\u003e\n\u003cp\u003eThis option is never essential, since \u003cspan\u003epg_dump\u003c/span\u003e will automatically prompt for a password if the server demands password authentication. However, \u003cspan\u003epg_dump\u003c/span\u003e will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing \u003ccode\u003e-W\u003c/code\u003e to avoid the extra connection attempt.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--role=\u003cem\u003e\u003ccode\u003erolename\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies a role name to be used to create the dump. This option causes \u003cspan\u003epg_dump\u003c/span\u003e to issue a \u003ccode\u003eSET ROLE\u003c/code\u003e \u003cem\u003e\u003ccode\u003erolename\u003c/code\u003e\u003c/em\u003e command after connecting to the database. It is useful when the authenticated user (specified by \u003ccode\u003e-U\u003c/code\u003e) lacks privileges needed by \u003cspan\u003epg_dump\u003c/span\u003e, but can switch to a role with the required rights. Some installations have a policy against logging in directly as a superuser, and use of this option allows dumps to be made without violating the policy.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cdiv id=\"id-1.9.4.14.7\"\u003e\n\u003ch2\u003eEnvironment\u003c/h2\u003e\n\u003cdiv\u003e\n\u003cdl\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003ePGDATABASE\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003ePGHOST\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003ePGOPTIONS\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003ePGPORT\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003ePGUSER\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDefault connection parameters.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003ePG_COLOR\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies whether to use color in diagnostic messages. Possible values are \u003ccode\u003ealways\u003c/code\u003e, \u003ccode\u003eauto\u003c/code\u003e and \u003ccode\u003enever\u003c/code\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003cp\u003eThis utility, like most other \u003cspan\u003ePostgreSQL\u003c/span\u003e utilities, also uses the environment variables supported by \u003cspan\u003elibpq\u003c/span\u003e (see \u003ca href=\"/docs/18/libpq-envars.html\" rel=\"nofollow\"\u003eSection 32.15\u003c/a\u003e).\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv id=\"APP-PGDUMP-DIAGNOSTICS\"\u003e\n\u003ch2\u003eDiagnostics\u003c/h2\u003e\n\u003cp\u003e\u003cspan\u003epg_dump\u003c/span\u003e internally executes \u003ccode\u003eSELECT\u003c/code\u003e statements. If you have problems running \u003cspan\u003epg_dump\u003c/span\u003e, make sure you are able to select information from the database using, for example, \u003ca href=\"/docs/18/app-psql.html\" title=\"psql\" rel=\"nofollow\"\u003e\u003cspan\u003e\u003cspan\u003epsql\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e. Also, any default connection settings and environment variables used by the \u003cspan\u003elibpq\u003c/span\u003e front-end library will apply.\u003c/p\u003e\n\u003cp\u003eThe database activity of \u003cspan\u003epg_dump\u003c/span\u003e is normally collected by the cumulative statistics system. If this is undesirable, you can set parameter \u003ccode\u003etrack_counts\u003c/code\u003e to false via \u003ccode\u003ePGOPTIONS\u003c/code\u003e or the \u003ccode\u003eALTER USER\u003c/code\u003e command.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv id=\"PG-DUMP-NOTES\"\u003e\n\u003ch2\u003eNotes\u003c/h2\u003e\n\u003cp\u003eIf your database cluster has any local additions to the \u003ccode\u003etemplate1\u003c/code\u003e database, be careful to restore the output of \u003cspan\u003epg_dump\u003c/span\u003e into a truly empty database; otherwise you are likely to get errors due to duplicate definitions of the added objects. To make an empty database without any local additions, copy from \u003ccode\u003etemplate0\u003c/code\u003e not \u003ccode\u003etemplate1\u003c/code\u003e, for example:\u003c/p\u003e\n\u003cpre\u003eCREATE DATABASE foo WITH TEMPLATE template0;\n\u003c/pre\u003e\n\u003cp\u003eWhen a dump without schema is chosen and the option \u003ccode\u003e--disable-triggers\u003c/code\u003e is used, \u003cspan\u003epg_dump\u003c/span\u003e emits commands to disable triggers on user tables before inserting the data, and then commands to re-enable them after the data has been inserted. If the restore is stopped in the middle, the system catalogs might be left in the wrong state.\u003c/p\u003e\n\u003cp\u003eWhen \u003ccode\u003e--statistics\u003c/code\u003e is specified, \u003ccode\u003epg_dump\u003c/code\u003e will include most optimizer statistics in the resulting dump file. This does not include all statistics, such as those created explicitly with \u003ca href=\"/docs/18/sql-createstatistics.html\" title=\"CREATE STATISTICS\" rel=\"nofollow\"\u003e\u003cspan\u003eCREATE STATISTICS\u003c/span\u003e\u003c/a\u003e, custom statistics added by an extension, or statistics collected by the cumulative statistics system. Therefore, it may still be useful to run \u003ccode\u003eANALYZE\u003c/code\u003e after restoring from a dump file to ensure optimal performance; see \u003ca href=\"/docs/18/routine-vacuuming.html#VACUUM-FOR-STATISTICS\" rel=\"nofollow\"\u003eSection 24.1.3\u003c/a\u003e and \u003ca href=\"/docs/18/routine-vacuuming.html#AUTOVACUUM\" rel=\"nofollow\"\u003eSection 24.1.6\u003c/a\u003e for more information.\u003c/p\u003e\n\u003cp\u003eBecause \u003cspan\u003epg_dump\u003c/span\u003e is used to transfer data to newer versions of \u003cspan\u003ePostgreSQL\u003c/span\u003e, the output of \u003cspan\u003epg_dump\u003c/span\u003e can be expected to load into \u003cspan\u003ePostgreSQL\u003c/span\u003e server versions newer than \u003cspan\u003epg_dump\u003c/span\u003e\u0026#39;s version. \u003cspan\u003epg_dump\u003c/span\u003e can also dump from \u003cspan\u003ePostgreSQL\u003c/span\u003e servers older than its own version. (Currently, servers back to version 9.2 are supported.) However, \u003cspan\u003epg_dump\u003c/span\u003e cannot dump from \u003cspan\u003ePostgreSQL\u003c/span\u003e servers newer than its own major version; it will refuse to even try, rather than risk making an invalid dump. Also, it is not guaranteed that \u003cspan\u003epg_dump\u003c/span\u003e\u0026#39;s output can be loaded into a server of an older major version — not even if the dump was taken from a server of that version. Loading a dump file into an older server may require manual editing of the dump file to remove syntax not understood by the older server. Use of the \u003ccode\u003e--quote-all-identifiers\u003c/code\u003e option is recommended in cross-version cases, as it can prevent problems arising from varying reserved-word lists in different \u003cspan\u003ePostgreSQL\u003c/span\u003e versions.\u003c/p\u003e\n\u003cp\u003eWhen dumping logical replication subscriptions, \u003cspan\u003epg_dump\u003c/span\u003e will generate \u003ccode\u003eCREATE SUBSCRIPTION\u003c/code\u003e commands that use the \u003ccode\u003econnect = false\u003c/code\u003e option, so that restoring the subscription does not make remote connections for creating a replication slot or for initial table copy. That way, the dump can be restored without requiring network access to the remote servers. It is then up to the user to reactivate the subscriptions in a suitable way. If the involved hosts have changed, the connection information might have to be changed. It might also be appropriate to truncate the target tables before initiating a new full table copy. If users intend to copy initial data during refresh they must create the slot with \u003ccode\u003etwo_phase = false\u003c/code\u003e. After the initial sync, the \u003ca href=\"/docs/18/sql-createsubscription.html#SQL-CREATESUBSCRIPTION-PARAMS-WITH-TWO-PHASE\" rel=\"nofollow\"\u003e\u003ccode\u003etwo_phase\u003c/code\u003e\u003c/a\u003e option will be automatically enabled by the subscriber if the subscription had been originally created with \u003ccode\u003etwo_phase = true\u003c/code\u003e option.\u003c/p\u003e\n\u003cp\u003eIt is generally recommended to use the \u003ccode\u003e-X\u003c/code\u003e (\u003ccode\u003e--no-psqlrc\u003c/code\u003e) option when restoring a database from a plain-text \u003cspan\u003epg_dump\u003c/span\u003e script to ensure a clean restore process and prevent potential conflicts with non-default \u003cspan\u003epsql\u003c/span\u003e configurations.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv id=\"PG-DUMP-EXAMPLES\"\u003e\n\u003ch2\u003eExamples\u003c/h2\u003e\n\u003cp\u003eTo dump a database called \u003ccode\u003emydb\u003c/code\u003e into an SQL-script file:\u003c/p\u003e\n\u003cpre\u003e\u003ccode\u003e$\u003c/code\u003e \u003cstrong\u003e\u003ccode\u003epg_dump mydb \u0026gt; db.sql\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\n\u003cp\u003eTo reload such a script into a (freshly created) database named \u003ccode\u003enewdb\u003c/code\u003e:\u003c/p\u003e\n\u003cpre\u003e\u003ccode\u003e$\u003c/code\u003e \u003cstrong\u003e\u003ccode\u003epsql -X -d newdb -f db.sql\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\n\u003cp\u003eTo dump a database into a custom-format archive file:\u003c/p\u003e\n\u003cpre\u003e\u003ccode\u003e$\u003c/code\u003e \u003cstrong\u003e\u003ccode\u003epg_dump -Fc mydb \u0026gt; db.dump\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\n\u003cp\u003eTo dump a database into a directory-format archive:\u003c/p\u003e\n\u003cpre\u003e\u003ccode\u003e$\u003c/code\u003e \u003cstrong\u003e\u003ccode\u003epg_dump -Fd mydb -f dumpdir\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\n\u003cp\u003eTo dump a database into a directory-format archive in parallel with 5 worker jobs:\u003c/p\u003e\n\u003cpre\u003e\u003ccode\u003e$\u003c/code\u003e \u003cstrong\u003e\u003ccode\u003epg_dump -Fd mydb -j 5 -f dumpdir\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\n\u003cp\u003eTo reload an archive file into a (freshly created) database named \u003ccode\u003enewdb\u003c/code\u003e:\u003c/p\u003e\n\u003cpre\u003e\u003ccode\u003e$\u003c/code\u003e \u003cstrong\u003e\u003ccode\u003epg_restore -d newdb db.dump\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\n\u003cp\u003eTo reload an archive file into the same database it was dumped from, discarding the current contents of that database:\u003c/p\u003e\n\u003cpre\u003e\u003ccode\u003e$\u003c/code\u003e \u003cstrong\u003e\u003ccode\u003epg_restore -d postgres --clean --create db.dump\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\n\u003cp\u003eTo dump a single table named \u003ccode\u003emytab\u003c/code\u003e:\u003c/p\u003e\n\u003cpre\u003e\u003ccode\u003e$\u003c/code\u003e \u003cstrong\u003e\u003ccode\u003epg_dump -t mytab mydb \u0026gt; db.sql\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\n\u003cp\u003eTo dump all tables whose names start with \u003ccode\u003eemp\u003c/code\u003e in the \u003ccode\u003edetroit\u003c/code\u003e schema, except for the table named \u003ccode\u003eemployee_log\u003c/code\u003e:\u003c/p\u003e\n\u003cpre\u003e\u003ccode\u003e$\u003c/code\u003e \u003cstrong\u003e\u003ccode\u003epg_dump -t \u0026#39;detroit.emp*\u0026#39; -T detroit.employee_log mydb \u0026gt; db.sql\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\n\u003cp\u003eTo dump all schemas whose names start with \u003ccode\u003eeast\u003c/code\u003e or \u003ccode\u003ewest\u003c/code\u003e and end in \u003ccode\u003egsm\u003c/code\u003e, excluding any schemas whose names contain the word \u003ccode\u003etest\u003c/code\u003e:\u003c/p\u003e\n\u003cpre\u003e\u003ccode\u003e$\u003c/code\u003e \u003cstrong\u003e\u003ccode\u003epg_dump -n \u0026#39;east*gsm\u0026#39; -n \u0026#39;west*gsm\u0026#39; -N \u0026#39;*test*\u0026#39; mydb \u0026gt; db.sql\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\n\u003cp\u003eThe same, using regular expression notation to consolidate the switches:\u003c/p\u003e\n\u003cpre\u003e\u003ccode\u003e$\u003c/code\u003e \u003cstrong\u003e\u003ccode\u003epg_dump -n \u0026#39;(east|west)*gsm\u0026#39; -N \u0026#39;*test*\u0026#39; mydb \u0026gt; db.sql\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\n\u003cp\u003eTo dump all database objects except for tables whose names begin with \u003ccode\u003ets_\u003c/code\u003e:\u003c/p\u003e\n\u003cpre\u003e\u003ccode\u003e$\u003c/code\u003e \u003cstrong\u003e\u003ccode\u003epg_dump -T \u0026#39;ts_*\u0026#39; mydb \u0026gt; db.sql\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\n\u003cp\u003eTo specify an upper-case or mixed-case name in \u003ccode\u003e-t\u003c/code\u003e and related switches, you need to double-quote the name; else it will be folded to lower case (see \u003ca href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\" rel=\"nofollow\"\u003ePatterns\u003c/a\u003e). But double quotes are special to the shell, so in turn they must be quoted. Thus, to dump a single table with a mixed-case name, you need something like\u003c/p\u003e\n\u003cpre\u003e\u003ccode\u003e$\u003c/code\u003e \u003cstrong\u003e\u003ccode\u003epg_dump -t \u0026#34;\\\u0026#34;MixedCaseName\\\u0026#34;\u0026#34; mydb \u0026gt; mytab.sql\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\n\u003cp\u003eTo dump all tables whose names start with \u003ccode\u003emytable\u003c/code\u003e, except for table \u003ccode\u003emytable2\u003c/code\u003e, specify a filter file \u003ccode\u003efilter.txt\u003c/code\u003e like:\u003c/p\u003e\n\u003cpre\u003einclude table mytable*\nexclude table mytable2\n\u003c/pre\u003e\n\u003cpre\u003e\u003ccode\u003e$\u003c/code\u003e \u003cstrong\u003e\u003ccode\u003epg_dump --filter=filter.txt mydb \u0026gt; db.sql\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\n\u003c/div\u003e\n\u003cdiv id=\"id-1.9.4.14.11\"\u003e\n\u003ch2\u003eSee Also\u003c/h2\u003e\u003cspan\u003e\u003ca href=\"/docs/18/app-pg-dumpall.html\" title=\"pg_dumpall\" rel=\"nofollow\"\u003e\u003cspan\u003e\u003cspan\u003epg_dumpall\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e, \u003ca href=\"/docs/18/app-pgrestore.html\" title=\"pg_restore\" rel=\"nofollow\"\u003e\u003cspan\u003e\u003cspan\u003epg_restore\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e, \u003ca href=\"/docs/18/app-psql.html\" title=\"psql\" rel=\"nofollow\"\u003e\u003cspan\u003e\u003cspan\u003epsql\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003c/span\u003e\n\u003c/div\u003e\n\u003c/div\u003e\u003c/div\u003e","SourceRevision":"ee8d1a3612338fd9adf250730cb640fcc5233b5491337cc00a316a44e3a0b9f8","ContentHash":"d717aab04be0e14b0636e9e0009350a167186226dd0178646843833b1c42b704","Payload":{"description":["pg_dump — export a PostgreSQL database as an SQL script or to other formats"],"manual_html":"\u003cdiv\u003e\u003cdiv class=\"refentry\" id=\"APP-PGDUMP\"\u003e\n\u003cdiv class=\"titlepage\"\u003e\u003c/div\u003e\n\u003cdiv class=\"refnamediv\"\u003e\n\u003ch2\u003e\u003cspan class=\"refentrytitle\"\u003e\u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e\u003c/span\u003e\u003c/h2\u003e\n\u003cp\u003epg_dump — export a \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e database as an SQL script or to other formats\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsynopsisdiv\"\u003e\n\u003ch2\u003eSynopsis\u003c/h2\u003e\n\u003cdiv class=\"cmdsynopsis\"\u003e\n\u003cp id=\"id-1.9.4.14.4.1\"\u003e\u003ccode class=\"command\"\u003epg_dump\u003c/code\u003e [\u003cem class=\"replaceable\"\u003e\u003ccode\u003econnection-option\u003c/code\u003e\u003c/em\u003e...] [\u003cem class=\"replaceable\"\u003e\u003ccode\u003eoption\u003c/code\u003e\u003c/em\u003e...] [\u003cem class=\"replaceable\"\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e]\u003c/p\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"PG-DUMP-DESCRIPTION\"\u003e\n\u003ch2\u003eDescription\u003c/h2\u003e\n\u003cp\u003e\u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e is a utility for exporting a \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e database. It makes consistent exports even if the database is being used concurrently. \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e does not block other users accessing the database (readers or writers). Note, however, that except in simple cases, \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e is generally not the right choice for taking regular backups of production databases. See \u003ca class=\"xref\" href=\"/docs/18/backup.html\" title=\"Chapter 25. Backup and Restore\"\u003eChapter 25\u003c/a\u003e for further discussion.\u003c/p\u003e\n\u003cp\u003e\u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e only dumps a single database. To export an entire cluster, or to export global objects that are common to all databases in a cluster (such as roles and tablespaces), use \u003ca class=\"xref\" href=\"/docs/18/app-pg-dumpall.html\" title=\"pg_dumpall\"\u003e\u003cspan class=\"refentrytitle\"\u003e\u003cspan class=\"application\"\u003epg_dumpall\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e.\u003c/p\u003e\n\u003cp\u003eDumps can be output in script or archive file formats. Script dumps are plain-text files containing the SQL commands required to reconstruct the database to the state it was in at the time it was saved. To restore from such a script, feed it to \u003ca class=\"xref\" href=\"/docs/18/app-psql.html\" title=\"psql\"\u003e\u003cspan class=\"refentrytitle\"\u003e\u003cspan class=\"application\"\u003epsql\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e. Script files can be used to reconstruct the database even on other machines and other architectures; with some modifications, even on other SQL database products.\u003c/p\u003e\n\u003cp\u003eThe alternative archive file formats must be used with \u003ca class=\"xref\" href=\"/docs/18/app-pgrestore.html\" title=\"pg_restore\"\u003e\u003cspan class=\"refentrytitle\"\u003e\u003cspan class=\"application\"\u003epg_restore\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e to rebuild the database. They allow \u003cspan class=\"application\"\u003epg_restore\u003c/span\u003e to be selective about what is restored, or even to reorder the items prior to being restored. The archive file formats are designed to be portable across architectures.\u003c/p\u003e\n\u003cp\u003eWhen used with one of the archive file formats and combined with \u003cspan class=\"application\"\u003epg_restore\u003c/span\u003e, \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e provides a flexible archival and transfer mechanism. \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e can be used to export an entire database, then \u003cspan class=\"application\"\u003epg_restore\u003c/span\u003e can be used to examine the archive and/or select which parts of the database are to be restored. The most flexible output file formats are the \u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003ecustom\u003c/span\u003e”\u003c/span\u003e format (\u003ccode class=\"option\"\u003e-Fc\u003c/code\u003e) and the \u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003edirectory\u003c/span\u003e”\u003c/span\u003e format (\u003ccode class=\"option\"\u003e-Fd\u003c/code\u003e). They allow for selection and reordering of all archived items, support parallel restoration, and are compressed by default. The \u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003edirectory\u003c/span\u003e”\u003c/span\u003e format is the only format that supports parallel dumps.\u003c/p\u003e\n\u003cp\u003eWhile running \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e, one should examine the output for any warnings (printed on standard error), especially in light of the limitations listed below.\u003c/p\u003e\n\u003cdiv class=\"warning\"\u003e\n\u003ch3 class=\"title\"\u003eWarning\u003c/h3\u003e\n\u003cp\u003eRestoring a dump causes the destination to execute arbitrary code of the source superusers' choice. Partial dumps and partial restores do not limit that. If the source superusers are not trusted, the dumped SQL statements must be inspected before restoring. Non-plain-text dumps can be inspected by using \u003cspan class=\"application\"\u003epg_restore\u003c/span\u003e's \u003ccode class=\"option\"\u003e--file\u003c/code\u003e option. Note that the client running the dump and restore need not trust the source or destination superusers.\u003c/p\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"PG-DUMP-OPTIONS\"\u003e\n\u003ch2\u003eOptions\u003c/h2\u003e\n\u003cp\u003eThe following command-line options control the content and format of the output.\u003c/p\u003e\n\u003cdiv class=\"variablelist\"\u003e\n\u003cdl class=\"variablelist\"\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the name of the database to be dumped. If this is not specified, the environment variable \u003ccode class=\"envar\"\u003ePGDATABASE\u003c/code\u003e is used. If that is not set, the user name specified for the connection is used.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-a\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--data-only\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDump only the data, not the schema (data definitions) or statistics. Table data, large objects, and sequence values are dumped.\u003c/p\u003e\n\u003cp\u003eThis option is similar to, but for historical reasons not identical to, specifying \u003ccode class=\"option\"\u003e--section=data\u003c/code\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-b\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--large-objects\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--blobs\u003c/code\u003e (deprecated)\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eInclude large objects in the dump. This is the default behavior except when \u003ccode class=\"option\"\u003e--schema\u003c/code\u003e, \u003ccode class=\"option\"\u003e--table\u003c/code\u003e, \u003ccode class=\"option\"\u003e--schema-only\u003c/code\u003e, \u003ccode class=\"option\"\u003e--statistics-only\u003c/code\u003e, or \u003ccode class=\"option\"\u003e--no-data\u003c/code\u003e is specified. The \u003ccode class=\"option\"\u003e-b\u003c/code\u003e switch is therefore only useful to add large objects to dumps where a specific schema or table has been requested. Note that large objects are considered data and therefore will be included when \u003ccode class=\"option\"\u003e--data-only\u003c/code\u003e is used, but not when \u003ccode class=\"option\"\u003e--schema-only\u003c/code\u003e or \u003ccode class=\"option\"\u003e--statistics-only\u003c/code\u003e is.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-B\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-large-objects\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-blobs\u003c/code\u003e (deprecated)\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eExclude large objects in the dump.\u003c/p\u003e\n\u003cp\u003eWhen both \u003ccode class=\"option\"\u003e-b\u003c/code\u003e and \u003ccode class=\"option\"\u003e-B\u003c/code\u003e are given, the behavior is to output large objects, when data is being dumped, see the \u003ccode class=\"option\"\u003e-b\u003c/code\u003e documentation.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-c\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--clean\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eOutput commands to \u003ccode class=\"command\"\u003eDROP\u003c/code\u003e all the dumped database objects prior to outputting the commands for creating them. This option is useful when the restore is to overwrite an existing database. If any of the objects do not exist in the destination database, ignorable error messages will be reported during restore, unless \u003ccode class=\"option\"\u003e--if-exists\u003c/code\u003e is also specified.\u003c/p\u003e\n\u003cp\u003eThis option is ignored when emitting an archive (non-text) output file. For the archive formats, you can specify the option when you call \u003ccode class=\"command\"\u003epg_restore\u003c/code\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-C\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--create\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eBegin the output with a command to create the database itself and reconnect to the created database. (With a script of this form, it doesn't matter which database in the destination installation you connect to before running the script.) If \u003ccode class=\"option\"\u003e--clean\u003c/code\u003e is also specified, the script drops and recreates the target database before reconnecting to it.\u003c/p\u003e\n\u003cp\u003eWith \u003ccode class=\"option\"\u003e--create\u003c/code\u003e, the output also includes the database's comment if any, and any configuration variable settings that are specific to this database, that is, any \u003ccode class=\"command\"\u003eALTER DATABASE ... SET ...\u003c/code\u003e and \u003ccode class=\"command\"\u003eALTER ROLE ... IN DATABASE ... SET ...\u003c/code\u003e commands that mention this database. Access privileges for the database itself are also dumped, unless \u003ccode class=\"option\"\u003e--no-acl\u003c/code\u003e is specified.\u003c/p\u003e\n\u003cp\u003eThis option is ignored when emitting an archive (non-text) output file. For the archive formats, you can specify the option when you call \u003ccode class=\"command\"\u003epg_restore\u003c/code\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-e \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--extension=\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDump only extensions matching \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e. When this option is not specified, all non-system extensions in the target database will be dumped. Multiple extensions can be selected by writing multiple \u003ccode class=\"option\"\u003e-e\u003c/code\u003e switches. The \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e parameter is interpreted as a pattern according to the same rules used by \u003cspan class=\"application\"\u003epsql\u003c/span\u003e's \u003ccode class=\"literal\"\u003e\\d\u003c/code\u003e commands (see \u003ca class=\"xref\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003ePatterns\u003c/a\u003e), so multiple extensions can also be selected by writing wildcard characters in the pattern. When using wildcards, be careful to quote the pattern if needed to prevent the shell from expanding the wildcards.\u003c/p\u003e\n\u003cp\u003eAny configuration relation registered by \u003ccode class=\"function\"\u003epg_extension_config_dump\u003c/code\u003e is included in the dump if its extension is specified by \u003ccode class=\"option\"\u003e--extension\u003c/code\u003e.\u003c/p\u003e\n\u003cdiv class=\"note\"\u003e\n\u003ch3 class=\"title\"\u003eNote\u003c/h3\u003e\n\u003cp\u003eWhen \u003ccode class=\"option\"\u003e-e\u003c/code\u003e is specified, \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e makes no attempt to dump any other database objects that the selected extension(s) might depend upon. Therefore, there is no guarantee that the results of a specific-extension dump can be successfully restored by themselves into a clean database.\u003c/p\u003e\n\u003c/div\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-E \u003cem class=\"replaceable\"\u003e\u003ccode\u003eencoding\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--encoding=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eencoding\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eCreate the dump in the specified character set encoding. By default, the dump is created in the database encoding. (Another way to get the same result is to set the \u003ccode class=\"envar\"\u003ePGCLIENTENCODING\u003c/code\u003e environment variable to the desired dump encoding.) The supported encodings are described in \u003ca class=\"xref\" href=\"/docs/18/multibyte.html#MULTIBYTE-CHARSET-SUPPORTED\" title=\"23.3.1. Supported Character Sets\"\u003eSection 23.3.1\u003c/a\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-f \u003cem class=\"replaceable\"\u003e\u003ccode\u003efile\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--file=\u003cem class=\"replaceable\"\u003e\u003ccode\u003efile\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSend output to the specified file. This parameter can be omitted for file based output formats, in which case the standard output is used. It must be given for the directory output format however, where it specifies the target directory instead of a file. In this case the directory is created by \u003ccode class=\"command\"\u003epg_dump\u003c/code\u003e and must not exist before.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-F \u003cem class=\"replaceable\"\u003e\u003ccode\u003eformat\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--format=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eformat\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSelects the format of the output. \u003cem class=\"replaceable\"\u003e\u003ccode\u003eformat\u003c/code\u003e\u003c/em\u003e can be one of the following:\u003c/p\u003e\n\u003cdiv class=\"variablelist\"\u003e\n\u003cdl class=\"variablelist\"\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003ep\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003eplain\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eOutput a plain-text SQL script file (the default).\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003ec\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003ecustom\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eOutput a custom-format archive suitable for input into \u003cspan class=\"application\"\u003epg_restore\u003c/span\u003e. Together with the directory output format, this is the most flexible output format in that it allows manual selection and reordering of archived items during restore. This format is also compressed by default.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003ed\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003edirectory\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eOutput a directory-format archive suitable for input into \u003cspan class=\"application\"\u003epg_restore\u003c/span\u003e. This will create a directory with one file for each table and large object being dumped, plus a so-called Table of Contents file describing the dumped objects in a machine-readable format that \u003cspan class=\"application\"\u003epg_restore\u003c/span\u003e can read. A directory format archive can be manipulated with standard Unix tools; for example, files in an uncompressed archive can be compressed with the \u003cspan class=\"application\"\u003egzip\u003c/span\u003e, \u003cspan class=\"application\"\u003elz4\u003c/span\u003e, or \u003cspan class=\"application\"\u003ezstd\u003c/span\u003e tools. This format is compressed by default using \u003ccode class=\"literal\"\u003egzip\u003c/code\u003e and also supports parallel dumps.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003et\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003etar\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eOutput a \u003ccode class=\"command\"\u003etar\u003c/code\u003e-format archive suitable for input into \u003cspan class=\"application\"\u003epg_restore\u003c/span\u003e. The tar format is compatible with the directory format: extracting a tar-format archive produces a valid directory-format archive. However, the tar format does not support compression. Also, when using tar format the relative order of table data items cannot be changed during restore.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-j \u003cem class=\"replaceable\"\u003e\u003ccode\u003enjobs\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--jobs=\u003cem class=\"replaceable\"\u003e\u003ccode\u003enjobs\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eRun the dump in parallel by dumping \u003cem class=\"replaceable\"\u003e\u003ccode\u003enjobs\u003c/code\u003e\u003c/em\u003e tables simultaneously. This option may reduce the time needed to perform the dump but it also increases the load on the database server. You can only use this option with the directory output format because this is the only output format where multiple processes can write their data at the same time.\u003c/p\u003e\n\u003cp\u003e\u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e will open \u003cem class=\"replaceable\"\u003e\u003ccode\u003enjobs\u003c/code\u003e\u003c/em\u003e + 1 connections to the database, so make sure your \u003ca class=\"xref\" href=\"/docs/18/runtime-config-connection.html#GUC-MAX-CONNECTIONS\"\u003emax_connections\u003c/a\u003e setting is high enough to accommodate all connections.\u003c/p\u003e\n\u003cp\u003eRequesting exclusive locks on database objects while running a parallel dump could cause the dump to fail. The reason is that the \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e leader process requests shared locks (\u003ca class=\"link\" href=\"/docs/18/explicit-locking.html#LOCKING-TABLES\" title=\"13.3.1. Table-Level Locks\"\u003eACCESS SHARE\u003c/a\u003e) on the objects that the worker processes are going to dump later in order to make sure that nobody deletes them and makes them go away while the dump is running. If another client then requests an exclusive lock on a table, that lock will not be granted but will be queued waiting for the shared lock of the leader process to be released. Consequently any other access to the table will not be granted either and will queue after the exclusive lock request. This includes the worker process trying to dump the table. Without any precautions this would be a classic deadlock situation. To detect this conflict, the \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e worker process requests another shared lock using the \u003ccode class=\"literal\"\u003eNOWAIT\u003c/code\u003e option. If the worker process is not granted this shared lock, somebody else must have requested an exclusive lock in the meantime and there is no way to continue with the dump, so \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e has no choice but to abort the dump.\u003c/p\u003e\n\u003cp\u003eTo perform a parallel dump, the database server needs to support synchronized snapshots, a feature that was introduced in \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e 9.2 for primary servers and 10 for standbys. With this feature, database clients can ensure they see the same data set even though they use different connections. \u003ccode class=\"command\"\u003epg_dump -j\u003c/code\u003e uses multiple database connections; it connects to the database once with the leader process and once again for each worker job. Without the synchronized snapshot feature, the different worker jobs wouldn't be guaranteed to see the same data in each connection, which could lead to an inconsistent backup.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-n \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--schema=\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDump only schemas matching \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e; this selects both the schema itself, and all its contained objects. When this option is not specified, all non-system schemas in the target database will be dumped. Multiple schemas can be selected by writing multiple \u003ccode class=\"option\"\u003e-n\u003c/code\u003e switches. The \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e parameter is interpreted as a pattern according to the same rules used by \u003cspan class=\"application\"\u003epsql\u003c/span\u003e's \u003ccode class=\"literal\"\u003e\\d\u003c/code\u003e commands (see \u003ca class=\"xref\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003ePatterns\u003c/a\u003e), so multiple schemas can also be selected by writing wildcard characters in the pattern. When using wildcards, be careful to quote the pattern if needed to prevent the shell from expanding the wildcards; see \u003ca class=\"xref\" href=\"/docs/18/app-pgdump.html#PG-DUMP-EXAMPLES\" title=\"Examples\"\u003eExamples\u003c/a\u003e below.\u003c/p\u003e\n\u003cdiv class=\"note\"\u003e\n\u003ch3 class=\"title\"\u003eNote\u003c/h3\u003e\n\u003cp\u003eWhen \u003ccode class=\"option\"\u003e-n\u003c/code\u003e is specified, \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e makes no attempt to dump any other database objects that the selected schema(s) might depend upon. Therefore, there is no guarantee that the results of a specific-schema dump can be successfully restored by themselves into a clean database.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"note\"\u003e\n\u003ch3 class=\"title\"\u003eNote\u003c/h3\u003e\n\u003cp\u003eNon-schema objects such as large objects are not dumped when \u003ccode class=\"option\"\u003e-n\u003c/code\u003e is specified. You can add large objects back to the dump with the \u003ccode class=\"option\"\u003e--large-objects\u003c/code\u003e switch.\u003c/p\u003e\n\u003c/div\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-N \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--exclude-schema=\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not dump any schemas matching \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e. The pattern is interpreted according to the same rules as for \u003ccode class=\"option\"\u003e-n\u003c/code\u003e. \u003ccode class=\"option\"\u003e-N\u003c/code\u003e can be given more than once to exclude schemas matching any of several patterns.\u003c/p\u003e\n\u003cp\u003eWhen both \u003ccode class=\"option\"\u003e-n\u003c/code\u003e and \u003ccode class=\"option\"\u003e-N\u003c/code\u003e are given, the behavior is to dump just the schemas that match at least one \u003ccode class=\"option\"\u003e-n\u003c/code\u003e switch but no \u003ccode class=\"option\"\u003e-N\u003c/code\u003e switches. If \u003ccode class=\"option\"\u003e-N\u003c/code\u003e appears without \u003ccode class=\"option\"\u003e-n\u003c/code\u003e, then schemas matching \u003ccode class=\"option\"\u003e-N\u003c/code\u003e are excluded from what is otherwise a normal dump.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-O\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-owner\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not output commands to set ownership of objects to match the original database. By default, \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e issues \u003ccode class=\"command\"\u003eALTER OWNER\u003c/code\u003e or \u003ccode class=\"command\"\u003eSET SESSION AUTHORIZATION\u003c/code\u003e statements to set ownership of created database objects. These statements will fail when the script is run unless it is started by a superuser (or the same user that owns all of the objects in the script). To make a script that can be restored by any user, but will give that user ownership of all the objects, specify \u003ccode class=\"option\"\u003e-O\u003c/code\u003e.\u003c/p\u003e\n\u003cp\u003eThis option is ignored when emitting an archive (non-text) output file. For the archive formats, you can specify the option when you call \u003ccode class=\"command\"\u003epg_restore\u003c/code\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-R\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-reconnect\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThis option is obsolete but still accepted for backwards compatibility.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-s\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--schema-only\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDump only the object definitions (schema), not data or statistics.\u003c/p\u003e\n\u003cp\u003eThis option cannot be used with \u003ccode class=\"option\"\u003e--data-only\u003c/code\u003e or \u003ccode class=\"option\"\u003e--statistics-only\u003c/code\u003e. It is similar to, but for historical reasons not identical to, specifying \u003ccode class=\"option\"\u003e--section=pre-data --section=post-data\u003c/code\u003e.\u003c/p\u003e\n\u003cp\u003e(Do not confuse this with the \u003ccode class=\"option\"\u003e--schema\u003c/code\u003e option, which uses the word \u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003eschema\u003c/span\u003e”\u003c/span\u003e in a different meaning.)\u003c/p\u003e\n\u003cp\u003eTo exclude table data for only a subset of tables in the database, see \u003ccode class=\"option\"\u003e--exclude-table-data\u003c/code\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-S \u003cem class=\"replaceable\"\u003e\u003ccode\u003eusername\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--superuser=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eusername\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecify the superuser user name to use when disabling triggers. This is relevant only if \u003ccode class=\"option\"\u003e--disable-triggers\u003c/code\u003e is used. (Usually, it's better to leave this out, and instead start the resulting script as superuser.)\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-t \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--table=\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDump only tables with names matching \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e. Multiple tables can be selected by writing multiple \u003ccode class=\"option\"\u003e-t\u003c/code\u003e switches. The \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e parameter is interpreted as a pattern according to the same rules used by \u003cspan class=\"application\"\u003epsql\u003c/span\u003e's \u003ccode class=\"literal\"\u003e\\d\u003c/code\u003e commands (see \u003ca class=\"xref\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003ePatterns\u003c/a\u003e), so multiple tables can also be selected by writing wildcard characters in the pattern. When using wildcards, be careful to quote the pattern if needed to prevent the shell from expanding the wildcards; see \u003ca class=\"xref\" href=\"/docs/18/app-pgdump.html#PG-DUMP-EXAMPLES\" title=\"Examples\"\u003eExamples\u003c/a\u003e below.\u003c/p\u003e\n\u003cp\u003eAs well as tables, this option can be used to dump the definition of matching views, materialized views, foreign tables, and sequences. It will not dump the contents of views or materialized views, and the contents of foreign tables will only be dumped if the corresponding foreign server is specified with \u003ccode class=\"option\"\u003e--include-foreign-data\u003c/code\u003e.\u003c/p\u003e\n\u003cp\u003eThe \u003ccode class=\"option\"\u003e-n\u003c/code\u003e and \u003ccode class=\"option\"\u003e-N\u003c/code\u003e switches have no effect when \u003ccode class=\"option\"\u003e-t\u003c/code\u003e is used, because tables selected by \u003ccode class=\"option\"\u003e-t\u003c/code\u003e will be dumped regardless of those switches, and non-table objects will not be dumped.\u003c/p\u003e\n\u003cdiv class=\"note\"\u003e\n\u003ch3 class=\"title\"\u003eNote\u003c/h3\u003e\n\u003cp\u003eWhen \u003ccode class=\"option\"\u003e-t\u003c/code\u003e is specified, \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e makes no attempt to dump any other database objects that the selected table(s) might depend upon. Therefore, there is no guarantee that the results of a specific-table dump can be successfully restored by themselves into a clean database.\u003c/p\u003e\n\u003c/div\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-T \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--exclude-table=\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not dump any tables matching \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e. The pattern is interpreted according to the same rules as for \u003ccode class=\"option\"\u003e-t\u003c/code\u003e. \u003ccode class=\"option\"\u003e-T\u003c/code\u003e can be given more than once to exclude tables matching any of several patterns.\u003c/p\u003e\n\u003cp\u003eWhen both \u003ccode class=\"option\"\u003e-t\u003c/code\u003e and \u003ccode class=\"option\"\u003e-T\u003c/code\u003e are given, the behavior is to dump just the tables that match at least one \u003ccode class=\"option\"\u003e-t\u003c/code\u003e switch but no \u003ccode class=\"option\"\u003e-T\u003c/code\u003e switches. If \u003ccode class=\"option\"\u003e-T\u003c/code\u003e appears without \u003ccode class=\"option\"\u003e-t\u003c/code\u003e, then tables matching \u003ccode class=\"option\"\u003e-T\u003c/code\u003e are excluded from what is otherwise a normal dump.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-v\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--verbose\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies verbose mode. This will cause \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e to output detailed object comments and start/stop times to the dump file, and progress messages to standard error. Repeating the option causes additional debug-level messages to appear on standard error.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-V\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--version\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003ePrint the \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e version and exit.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-x\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-privileges\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-acl\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003ePrevent dumping of access privileges (grant/revoke commands).\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-Z \u003cem class=\"replaceable\"\u003e\u003ccode\u003elevel\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-Z \u003cem class=\"replaceable\"\u003e\u003ccode\u003emethod\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e[:\u003cem class=\"replaceable\"\u003e\u003ccode\u003edetail\u003c/code\u003e\u003c/em\u003e]\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--compress=\u003cem class=\"replaceable\"\u003e\u003ccode\u003elevel\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--compress=\u003cem class=\"replaceable\"\u003e\u003ccode\u003emethod\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e[:\u003cem class=\"replaceable\"\u003e\u003ccode\u003edetail\u003c/code\u003e\u003c/em\u003e]\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecify the compression method and/or the compression level to use. The compression method can be set to \u003ccode class=\"literal\"\u003egzip\u003c/code\u003e, \u003ccode class=\"literal\"\u003elz4\u003c/code\u003e, \u003ccode class=\"literal\"\u003ezstd\u003c/code\u003e, or \u003ccode class=\"literal\"\u003enone\u003c/code\u003e for no compression. A compression detail string can optionally be specified. If the detail string is an integer, it specifies the compression level. Otherwise, it should be a comma-separated list of items, each of the form \u003ccode class=\"literal\"\u003ekeyword\u003c/code\u003e or \u003ccode class=\"literal\"\u003ekeyword=value\u003c/code\u003e. Currently, the supported keywords are \u003ccode class=\"literal\"\u003elevel\u003c/code\u003e and \u003ccode class=\"literal\"\u003elong\u003c/code\u003e.\u003c/p\u003e\n\u003cp\u003eIf no compression level is specified, the default compression level will be used. If only a level is specified without mentioning an algorithm, \u003ccode class=\"literal\"\u003egzip\u003c/code\u003e compression will be used if the level is greater than \u003ccode class=\"literal\"\u003e0\u003c/code\u003e, and no compression will be used if the level is \u003ccode class=\"literal\"\u003e0\u003c/code\u003e.\u003c/p\u003e\n\u003cp\u003eFor the custom and directory archive formats, this specifies compression of individual table-data segments, and the default is to compress using \u003ccode class=\"literal\"\u003egzip\u003c/code\u003e at a moderate level. For plain text output, setting a nonzero compression level causes the entire output file to be compressed, as though it had been fed through \u003cspan class=\"application\"\u003egzip\u003c/span\u003e, \u003cspan class=\"application\"\u003elz4\u003c/span\u003e, or \u003cspan class=\"application\"\u003ezstd\u003c/span\u003e; but the default is not to compress. With zstd compression, \u003ccode class=\"literal\"\u003elong\u003c/code\u003e mode may improve the compression ratio, at the cost of increased memory use.\u003c/p\u003e\n\u003cp\u003eThe tar archive format currently does not support compression at all.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--binary-upgrade\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThis option is for use by in-place upgrade utilities. Its use for other purposes is not recommended or supported. The behavior of the option may change in future releases without notice.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--column-inserts\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--attribute-inserts\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDump data as \u003ccode class=\"command\"\u003eINSERT\u003c/code\u003e commands with explicit column names (\u003ccode class=\"literal\"\u003eINSERT INTO \u003cem class=\"replaceable\"\u003e\u003ccode\u003etable\u003c/code\u003e\u003c/em\u003e (\u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolumn\u003c/code\u003e\u003c/em\u003e, ...) VALUES ...\u003c/code\u003e). This will make restoration very slow; it is mainly useful for making dumps that can be loaded into non-\u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e databases. Any error during restoring will cause only rows that are part of the problematic \u003ccode class=\"command\"\u003eINSERT\u003c/code\u003e to be lost, rather than the entire table contents.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--disable-dollar-quoting\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThis option disables the use of dollar quoting for function bodies, and forces them to be quoted using SQL standard string syntax.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--disable-triggers\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThis option is relevant only when creating a dump that includes data but does not include schema. It instructs \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e to include commands to temporarily disable triggers on the target tables while the data is restored. Use this if you have referential integrity checks or other triggers on the tables that you do not want to invoke during data restore.\u003c/p\u003e\n\u003cp\u003ePresently, the commands emitted for \u003ccode class=\"option\"\u003e--disable-triggers\u003c/code\u003e must be done as superuser. So, you should also specify a superuser name with \u003ccode class=\"option\"\u003e-S\u003c/code\u003e, or preferably be careful to start the resulting script as a superuser.\u003c/p\u003e\n\u003cp\u003eThis option is ignored when emitting an archive (non-text) output file. For the archive formats, you can specify the option when you call \u003ccode class=\"command\"\u003epg_restore\u003c/code\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--enable-row-security\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThis option is relevant only when dumping the contents of a table which has row security. By default, \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e will set \u003ca class=\"xref\" href=\"/docs/18/runtime-config-client.html#GUC-ROW-SECURITY\"\u003erow_security\u003c/a\u003e to off, to ensure that all data is dumped from the table. If the user does not have sufficient privileges to bypass row security, then an error is thrown. This parameter instructs \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e to set \u003ca class=\"xref\" href=\"/docs/18/runtime-config-client.html#GUC-ROW-SECURITY\"\u003erow_security\u003c/a\u003e to on instead, allowing the user to dump the parts of the contents of the table that they have access to.\u003c/p\u003e\n\u003cp\u003eNote that if you use this option currently, you probably also want the dump be in \u003ccode class=\"command\"\u003eINSERT\u003c/code\u003e format, as the \u003ccode class=\"command\"\u003eCOPY FROM\u003c/code\u003e during restore does not support row security.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--exclude-extension=\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not dump any extensions matching \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e. The pattern is interpreted according to the same rules as for \u003ccode class=\"option\"\u003e-e\u003c/code\u003e. \u003ccode class=\"option\"\u003e--exclude-extension\u003c/code\u003e can be given more than once to exclude extensions matching any of several patterns.\u003c/p\u003e\n\u003cp\u003eWhen both \u003ccode class=\"option\"\u003e-e\u003c/code\u003e and \u003ccode class=\"option\"\u003e--exclude-extension\u003c/code\u003e are given, the behavior is to dump just the extensions that match at least one \u003ccode class=\"option\"\u003e-e\u003c/code\u003e switch but no \u003ccode class=\"option\"\u003e--exclude-extension\u003c/code\u003e switches. If \u003ccode class=\"option\"\u003e--exclude-extension\u003c/code\u003e appears without \u003ccode class=\"option\"\u003e-e\u003c/code\u003e, then extensions matching \u003ccode class=\"option\"\u003e--exclude-extension\u003c/code\u003e are excluded from what is otherwise a normal dump.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--exclude-table-and-children=\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThis is the same as the \u003ccode class=\"option\"\u003e-T\u003c/code\u003e/\u003ccode class=\"option\"\u003e--exclude-table\u003c/code\u003e option, except that it also excludes any partitions or inheritance child tables of the table(s) matching the \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--exclude-table-data=\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not dump data for any tables matching \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e. The pattern is interpreted according to the same rules as for \u003ccode class=\"option\"\u003e-t\u003c/code\u003e. \u003ccode class=\"option\"\u003e--exclude-table-data\u003c/code\u003e can be given more than once to exclude tables matching any of several patterns. This option is useful when you need the definition of a particular table even though you do not need the data in it.\u003c/p\u003e\n\u003cp\u003eTo exclude data for all tables in the database, see \u003ccode class=\"option\"\u003e--schema-only\u003c/code\u003e or \u003ccode class=\"option\"\u003e--statistics-only\u003c/code\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--exclude-table-data-and-children=\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThis is the same as the \u003ccode class=\"option\"\u003e--exclude-table-data\u003c/code\u003e option, except that it also excludes data of any partitions or inheritance child tables of the table(s) matching the \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--extra-float-digits=\u003cem class=\"replaceable\"\u003e\u003ccode\u003endigits\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eUse the specified value of \u003ccode class=\"option\"\u003eextra_float_digits\u003c/code\u003e when dumping floating-point data, instead of the maximum available precision. Routine dumps made for backup purposes should not use this option.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--filter=\u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecify a filename from which to read patterns for objects to include or exclude from the dump. The patterns are interpreted according to the same rules as the corresponding options: \u003ccode class=\"option\"\u003e-t\u003c/code\u003e/\u003ccode class=\"option\"\u003e--table\u003c/code\u003e, \u003ccode class=\"option\"\u003e--table-and-children\u003c/code\u003e, \u003ccode class=\"option\"\u003e-T\u003c/code\u003e/\u003ccode class=\"option\"\u003e--exclude-table\u003c/code\u003e, and \u003ccode class=\"option\"\u003e--exclude-table-and-children\u003c/code\u003e for tables, \u003ccode class=\"option\"\u003e-n\u003c/code\u003e/\u003ccode class=\"option\"\u003e--schema\u003c/code\u003e and \u003ccode class=\"option\"\u003e-N\u003c/code\u003e/\u003ccode class=\"option\"\u003e--exclude-schema\u003c/code\u003e for schemas, \u003ccode class=\"option\"\u003e--include-foreign-data\u003c/code\u003e for data on foreign servers, \u003ccode class=\"option\"\u003e--exclude-table-data\u003c/code\u003e and \u003ccode class=\"option\"\u003e--exclude-table-data-and-children\u003c/code\u003e for table data, and \u003ccode class=\"option\"\u003e-e\u003c/code\u003e/\u003ccode class=\"option\"\u003e--extension\u003c/code\u003e and \u003ccode class=\"option\"\u003e--exclude-extension\u003c/code\u003e for extensions. To read from \u003ccode class=\"literal\"\u003eSTDIN\u003c/code\u003e, use \u003ccode class=\"filename\"\u003e-\u003c/code\u003e as the filename. The \u003ccode class=\"option\"\u003e--filter\u003c/code\u003e option can be specified in conjunction with the above listed options for including or excluding objects, and can also be specified more than once for multiple filter files.\u003c/p\u003e\n\u003cp\u003eThe file lists one object pattern per row, with the following format:\u003c/p\u003e\n\u003cpre class=\"synopsis\"\u003e{ include | exclude } { extension | foreign_data | table | table_and_children | table_data | table_data_and_children | schema } \u003cem class=\"replaceable\"\u003e\u003ccode\u003ePATTERN\u003c/code\u003e\u003c/em\u003e\n\u003c/pre\u003e\n\u003cp\u003eThe first keyword specifies whether the objects matched by the pattern are to be included or excluded. The second keyword specifies the type of object to be filtered using the pattern:\u003c/p\u003e\n\u003cdiv class=\"itemizedlist\"\u003e\n\u003cul class=\"itemizedlist\"\u003e\n\u003cli class=\"listitem\"\u003e\n\u003cp\u003e\u003ccode class=\"literal\"\u003eextension\u003c/code\u003e: extensions. This works like the \u003ccode class=\"option\"\u003e-e\u003c/code\u003e/\u003ccode class=\"option\"\u003e--extension\u003c/code\u003e or \u003ccode class=\"option\"\u003e--exclude-extension\u003c/code\u003e option.\u003c/p\u003e\n\u003c/li\u003e\n\u003cli class=\"listitem\"\u003e\n\u003cp\u003e\u003ccode class=\"literal\"\u003eforeign_data\u003c/code\u003e: data on foreign servers. This works like the \u003ccode class=\"option\"\u003e--include-foreign-data\u003c/code\u003e option. This keyword can only be used with the \u003ccode class=\"literal\"\u003einclude\u003c/code\u003e keyword.\u003c/p\u003e\n\u003c/li\u003e\n\u003cli class=\"listitem\"\u003e\n\u003cp\u003e\u003ccode class=\"literal\"\u003etable\u003c/code\u003e: tables. This works like the \u003ccode class=\"option\"\u003e-t\u003c/code\u003e/\u003ccode class=\"option\"\u003e--table\u003c/code\u003e or \u003ccode class=\"option\"\u003e-T\u003c/code\u003e/\u003ccode class=\"option\"\u003e--exclude-table\u003c/code\u003e option.\u003c/p\u003e\n\u003c/li\u003e\n\u003cli class=\"listitem\"\u003e\n\u003cp\u003e\u003ccode class=\"literal\"\u003etable_and_children\u003c/code\u003e: tables including any partitions or inheritance child tables. This works like the \u003ccode class=\"option\"\u003e--table-and-children\u003c/code\u003e or \u003ccode class=\"option\"\u003e--exclude-table-and-children\u003c/code\u003e option.\u003c/p\u003e\n\u003c/li\u003e\n\u003cli class=\"listitem\"\u003e\n\u003cp\u003e\u003ccode class=\"literal\"\u003etable_data\u003c/code\u003e: table data of any tables matching \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e. This works like the \u003ccode class=\"option\"\u003e--exclude-table-data\u003c/code\u003e option. This keyword can only be used with the \u003ccode class=\"literal\"\u003eexclude\u003c/code\u003e keyword.\u003c/p\u003e\n\u003c/li\u003e\n\u003cli class=\"listitem\"\u003e\n\u003cp\u003e\u003ccode class=\"literal\"\u003etable_data_and_children\u003c/code\u003e: table data of any tables matching \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e as well as any partitions or inheritance children of the table(s). This works like the \u003ccode class=\"option\"\u003e--exclude-table-data-and-children\u003c/code\u003e option. This keyword can only be used with the \u003ccode class=\"literal\"\u003eexclude\u003c/code\u003e keyword.\u003c/p\u003e\n\u003c/li\u003e\n\u003cli class=\"listitem\"\u003e\n\u003cp\u003e\u003ccode class=\"literal\"\u003eschema\u003c/code\u003e: schemas. This works like the \u003ccode class=\"option\"\u003e-n\u003c/code\u003e/\u003ccode class=\"option\"\u003e--schema\u003c/code\u003e or \u003ccode class=\"option\"\u003e-N\u003c/code\u003e/\u003ccode class=\"option\"\u003e--exclude-schema\u003c/code\u003e option.\u003c/p\u003e\n\u003c/li\u003e\n\u003c/ul\u003e\n\u003c/div\u003e\n\u003cp\u003eLines starting with \u003ccode class=\"literal\"\u003e#\u003c/code\u003e are considered comments and ignored. Comments can be placed after an object pattern row as well. Blank lines are also ignored. See \u003ca class=\"xref\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003ePatterns\u003c/a\u003e for how to perform quoting in patterns.\u003c/p\u003e\n\u003cp\u003eExample files are listed below in the \u003ca class=\"xref\" href=\"/docs/18/app-pgdump.html#PG-DUMP-EXAMPLES\" title=\"Examples\"\u003eExamples\u003c/a\u003e section.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--if-exists\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eUse \u003ccode class=\"literal\"\u003eDROP ... IF EXISTS\u003c/code\u003e commands to drop objects in \u003ccode class=\"option\"\u003e--clean\u003c/code\u003e mode. This suppresses \u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003edoes not exist\u003c/span\u003e”\u003c/span\u003e errors that might otherwise be reported. This option is not valid unless \u003ccode class=\"option\"\u003e--clean\u003c/code\u003e is also specified.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--include-foreign-data=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eforeignserver\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDump the data for any foreign table with a foreign server matching \u003cem class=\"replaceable\"\u003e\u003ccode\u003eforeignserver\u003c/code\u003e\u003c/em\u003e pattern. Multiple foreign servers can be selected by writing multiple \u003ccode class=\"option\"\u003e--include-foreign-data\u003c/code\u003e switches. Also, the \u003cem class=\"replaceable\"\u003e\u003ccode\u003eforeignserver\u003c/code\u003e\u003c/em\u003e parameter is interpreted as a pattern according to the same rules used by \u003cspan class=\"application\"\u003epsql\u003c/span\u003e's \u003ccode class=\"literal\"\u003e\\d\u003c/code\u003e commands (see \u003ca class=\"xref\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003ePatterns\u003c/a\u003e), so multiple foreign servers can also be selected by writing wildcard characters in the pattern. When using wildcards, be careful to quote the pattern if needed to prevent the shell from expanding the wildcards; see \u003ca class=\"xref\" href=\"/docs/18/app-pgdump.html#PG-DUMP-EXAMPLES\" title=\"Examples\"\u003eExamples\u003c/a\u003e below. The only exception is that an empty pattern is disallowed.\u003c/p\u003e\n\u003cdiv class=\"note\"\u003e\n\u003ch3 class=\"title\"\u003eNote\u003c/h3\u003e\n\u003cp\u003eUsing wildcards in \u003ccode class=\"option\"\u003e--include-foreign-data\u003c/code\u003e may result in access to unexpected foreign servers. Also, to use this option securely, make sure that the named server must have a trusted owner.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"note\"\u003e\n\u003ch3 class=\"title\"\u003eNote\u003c/h3\u003e\n\u003cp\u003eWhen \u003ccode class=\"option\"\u003e--include-foreign-data\u003c/code\u003e is specified, \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e does not check that the foreign table is writable. Therefore, there is no guarantee that the results of a foreign table dump can be successfully restored.\u003c/p\u003e\n\u003c/div\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--inserts\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDump data as \u003ccode class=\"command\"\u003eINSERT\u003c/code\u003e commands (rather than \u003ccode class=\"command\"\u003eCOPY\u003c/code\u003e). This will make restoration very slow; it is mainly useful for making dumps that can be loaded into non-\u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e databases. Any error during restoring will cause only rows that are part of the problematic \u003ccode class=\"command\"\u003eINSERT\u003c/code\u003e to be lost, rather than the entire table contents. Note that the restore might fail altogether if you have rearranged column order. The \u003ccode class=\"option\"\u003e--column-inserts\u003c/code\u003e option is safe against column order changes, though even slower.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--load-via-partition-root\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eWhen dumping data for a table partition, make the \u003ccode class=\"command\"\u003eCOPY\u003c/code\u003e or \u003ccode class=\"command\"\u003eINSERT\u003c/code\u003e statements target the root of the partitioning hierarchy that contains it, rather than the partition itself. This causes the appropriate partition to be re-determined for each row when the data is loaded. This may be useful when restoring data on a server where rows do not always fall into the same partitions as they did on the original server. That could happen, for example, if the partitioning column is of type text and the two systems have different definitions of the collation used to sort the partitioning column.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--lock-wait-timeout=\u003cem class=\"replaceable\"\u003e\u003ccode\u003etimeout\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not wait forever to acquire shared table locks at the beginning of the dump. Instead fail if unable to lock a table within the specified \u003cem class=\"replaceable\"\u003e\u003ccode\u003etimeout\u003c/code\u003e\u003c/em\u003e. The timeout may be specified in any of the formats accepted by \u003ccode class=\"command\"\u003eSET statement_timeout\u003c/code\u003e. (Allowed formats vary depending on the server version you are dumping from, but an integer number of milliseconds is accepted by all versions.)\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-comments\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not dump \u003ccode class=\"command\"\u003eCOMMENT\u003c/code\u003e commands.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-data\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not dump data.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-policies\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not dump row security policies.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-publications\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not dump publications.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-schema\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not dump schema (data definitions).\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-security-labels\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not dump security labels.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-statistics\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not dump statistics. This is the default.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-subscriptions\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not dump subscriptions.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-sync\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eBy default, \u003ccode class=\"command\"\u003epg_dump\u003c/code\u003e will wait for all files to be written safely to disk. This option causes \u003ccode class=\"command\"\u003epg_dump\u003c/code\u003e to return without waiting, which is faster, but means that a subsequent operating system crash can leave the dump corrupt. Generally, this option is useful for testing but should not be used when dumping data from production installation.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-table-access-method\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not output commands to select table access methods. With this option, all objects will be created with whichever table access method is the default during restore.\u003c/p\u003e\n\u003cp\u003eThis option is ignored when emitting an archive (non-text) output file. For the archive formats, you can specify the option when you call \u003ccode class=\"command\"\u003epg_restore\u003c/code\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-tablespaces\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not output commands to select tablespaces. With this option, all objects will be created in whichever tablespace is the default during restore.\u003c/p\u003e\n\u003cp\u003eThis option is ignored when emitting an archive (non-text) output file. For the archive formats, you can specify the option when you call \u003ccode class=\"command\"\u003epg_restore\u003c/code\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-toast-compression\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not output commands to set TOAST compression methods. With this option, all columns will be restored with the default compression setting.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-unlogged-table-data\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not dump the contents of unlogged tables and sequences. This option has no effect on whether or not the table and sequence definitions (schema) are dumped; it only suppresses dumping the table and sequence data. Data in unlogged tables and sequences is always excluded when dumping from a standby server.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--on-conflict-do-nothing\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eAdd \u003ccode class=\"literal\"\u003eON CONFLICT DO NOTHING\u003c/code\u003e to \u003ccode class=\"command\"\u003eINSERT\u003c/code\u003e commands. This option is not valid unless \u003ccode class=\"option\"\u003e--inserts\u003c/code\u003e, \u003ccode class=\"option\"\u003e--column-inserts\u003c/code\u003e or \u003ccode class=\"option\"\u003e--rows-per-insert\u003c/code\u003e is also specified.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--quote-all-identifiers\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eForce quoting of all identifiers. This option is recommended when dumping a database from a server whose \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e major version is different from \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e's, or when the output is intended to be loaded into a server of a different major version. By default, \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e quotes only identifiers that are reserved words in its own major version. This sometimes results in compatibility issues when dealing with servers of other versions that may have slightly different sets of reserved words. Using \u003ccode class=\"option\"\u003e--quote-all-identifiers\u003c/code\u003e prevents such issues, at the price of a harder-to-read dump script.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--restrict-key=\u003cem class=\"replaceable\"\u003e\u003ccode\u003erestrict_key\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eUse the provided string as the \u003cspan class=\"application\"\u003epsql\u003c/span\u003e \u003ccode class=\"command\"\u003e\\restrict\u003c/code\u003e key in the dump output. This can only be specified for plain-text dumps, i.e., when \u003ccode class=\"option\"\u003e--format\u003c/code\u003e is set to \u003ccode class=\"literal\"\u003eplain\u003c/code\u003e or the \u003ccode class=\"option\"\u003e--format\u003c/code\u003e option is omitted. If no restrict key is specified, \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e will generate a random one as needed. Keys may contain only alphanumeric characters.\u003c/p\u003e\n\u003cp\u003eThis option is primarily intended for testing purposes and other scenarios that require repeatable output (e.g., comparing dump files). It is not recommended for general use, as a malicious server with advance knowledge of the key may be able to inject arbitrary code that will be executed on the machine that runs \u003cspan class=\"application\"\u003epsql\u003c/span\u003e with the dump output.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--rows-per-insert=\u003cem class=\"replaceable\"\u003e\u003ccode\u003enrows\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDump data as \u003ccode class=\"command\"\u003eINSERT\u003c/code\u003e commands (rather than \u003ccode class=\"command\"\u003eCOPY\u003c/code\u003e). Controls the maximum number of rows per \u003ccode class=\"command\"\u003eINSERT\u003c/code\u003e command. The value specified must be a number greater than zero. Any error during restoring will cause only rows that are part of the problematic \u003ccode class=\"command\"\u003eINSERT\u003c/code\u003e to be lost, rather than the entire table contents.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--section=\u003cem class=\"replaceable\"\u003e\u003ccode\u003esectionname\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eOnly dump the named section. The section name can be \u003ccode class=\"option\"\u003epre-data\u003c/code\u003e, \u003ccode class=\"option\"\u003edata\u003c/code\u003e, or \u003ccode class=\"option\"\u003epost-data\u003c/code\u003e. This option can be specified more than once to select multiple sections. The default is to dump all sections.\u003c/p\u003e\n\u003cp\u003eThe data section contains actual table data, large-object contents, sequence values, and statistics for tables, materialized views, and foreign tables. Post-data items include definitions of indexes, triggers, rules, statistics for indexes, and constraints other than validated check and not-null constraints. Pre-data items include all other data definition items.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--sequence-data\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eInclude sequence data in the dump. This is the default behavior except when \u003ccode class=\"option\"\u003e--no-data\u003c/code\u003e, \u003ccode class=\"option\"\u003e--schema-only\u003c/code\u003e, or \u003ccode class=\"option\"\u003e--statistics-only\u003c/code\u003e is specified.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--serializable-deferrable\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eUse a \u003ccode class=\"literal\"\u003eserializable\u003c/code\u003e transaction for the dump, to ensure that the snapshot used is consistent with later database states; but do this by waiting for a point in the transaction stream at which no anomalies can be present, so that there isn't a risk of the dump failing or causing other transactions to roll back with a \u003ccode class=\"literal\"\u003eserialization_failure\u003c/code\u003e. See \u003ca class=\"xref\" href=\"/docs/18/mvcc.html\" title=\"Chapter 13. Concurrency Control\"\u003eChapter 13\u003c/a\u003e for more information about transaction isolation and concurrency control.\u003c/p\u003e\n\u003cp\u003eThis option is not beneficial for a dump which is intended only for disaster recovery. It could be useful for a dump used to load a copy of the database for reporting or other read-only load sharing while the original database continues to be updated. Without it the dump may reflect a state which is not consistent with any serial execution of the transactions eventually committed. For example, if batch processing techniques are used, a batch may show as closed in the dump without all of the items which are in the batch appearing.\u003c/p\u003e\n\u003cp\u003eThis option will make no difference if there are no read-write transactions active when pg_dump is started. If read-write transactions are active, the start of the dump may be delayed for an indeterminate length of time. Once running, performance with or without the switch is the same.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--snapshot=\u003cem class=\"replaceable\"\u003e\u003ccode\u003esnapshotname\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eUse the specified synchronized snapshot when making a dump of the database (see \u003ca class=\"xref\" href=\"/docs/18/functions-admin.html#FUNCTIONS-SNAPSHOT-SYNCHRONIZATION-TABLE\" title=\"Table 9.100. Snapshot Synchronization Functions\"\u003eTable 9.100\u003c/a\u003e for more details).\u003c/p\u003e\n\u003cp\u003eThis option is useful when needing to synchronize the dump with a logical replication slot (see \u003ca class=\"xref\" href=\"/docs/18/logicaldecoding.html\" title=\"Chapter 47. Logical Decoding\"\u003eChapter 47\u003c/a\u003e) or with a concurrent session.\u003c/p\u003e\n\u003cp\u003eIn the case of a parallel dump, the snapshot name defined by this option is used rather than taking a new snapshot.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--statistics\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDump optimizer statistics.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--statistics-only\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDump only the statistics, not the schema (data definitions) or data. Optimizer statistics for tables, materialized views, foreign tables, and indexes are dumped.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--strict-names\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eRequire that each extension (\u003ccode class=\"option\"\u003e-e\u003c/code\u003e/\u003ccode class=\"option\"\u003e--extension\u003c/code\u003e), schema (\u003ccode class=\"option\"\u003e-n\u003c/code\u003e/\u003ccode class=\"option\"\u003e--schema\u003c/code\u003e) and table (\u003ccode class=\"option\"\u003e-t\u003c/code\u003e/\u003ccode class=\"option\"\u003e--table\u003c/code\u003e) pattern match at least one extension/schema/table in the database to be dumped. This also applies to filters used with \u003ccode class=\"option\"\u003e--filter\u003c/code\u003e. Note that if none of the extension/schema/table patterns find matches, \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e will generate an error even without \u003ccode class=\"option\"\u003e--strict-names\u003c/code\u003e.\u003c/p\u003e\n\u003cp\u003eThis option has no effect on \u003ccode class=\"option\"\u003e--exclude-extension\u003c/code\u003e, \u003ccode class=\"option\"\u003e-N\u003c/code\u003e/\u003ccode class=\"option\"\u003e--exclude-schema\u003c/code\u003e, \u003ccode class=\"option\"\u003e-T\u003c/code\u003e/\u003ccode class=\"option\"\u003e--exclude-table\u003c/code\u003e, or \u003ccode class=\"option\"\u003e--exclude-table-data\u003c/code\u003e. An exclude pattern failing to match any objects is not considered an error.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--sync-method=\u003cem class=\"replaceable\"\u003e\u003ccode\u003emethod\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eWhen set to \u003ccode class=\"literal\"\u003efsync\u003c/code\u003e, which is the default, \u003ccode class=\"command\"\u003epg_dump --format=directory\u003c/code\u003e will recursively open and synchronize all files in the archive directory.\u003c/p\u003e\n\u003cp\u003eOn Linux, \u003ccode class=\"literal\"\u003esyncfs\u003c/code\u003e may be used instead to ask the operating system to synchronize the whole file system that contains the archive directory. See \u003ca class=\"xref\" href=\"/docs/18/runtime-config-error-handling.html#GUC-RECOVERY-INIT-SYNC-METHOD\"\u003erecovery_init_sync_method\u003c/a\u003e for information about the caveats to be aware of when using \u003ccode class=\"literal\"\u003esyncfs\u003c/code\u003e.\u003c/p\u003e\n\u003cp\u003eThis option has no effect when \u003ccode class=\"option\"\u003e--no-sync\u003c/code\u003e is used or \u003ccode class=\"option\"\u003e--format\u003c/code\u003e is not set to \u003ccode class=\"literal\"\u003edirectory\u003c/code\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--table-and-children=\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThis is the same as the \u003ccode class=\"option\"\u003e-t\u003c/code\u003e/\u003ccode class=\"option\"\u003e--table\u003c/code\u003e option, except that it also includes any partitions or inheritance child tables of the table(s) matching the \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--use-set-session-authorization\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eOutput SQL-standard \u003ccode class=\"command\"\u003eSET SESSION AUTHORIZATION\u003c/code\u003e commands instead of \u003ccode class=\"command\"\u003eALTER OWNER\u003c/code\u003e commands to determine object ownership. This makes the dump more standards-compatible, but depending on the history of the objects in the dump, might not restore properly. Also, a dump using \u003ccode class=\"command\"\u003eSET SESSION AUTHORIZATION\u003c/code\u003e will certainly require superuser privileges to restore correctly, whereas \u003ccode class=\"command\"\u003eALTER OWNER\u003c/code\u003e requires lesser privileges.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-?\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--help\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eShow help about \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e command line arguments, and exit.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003cp\u003eThe following command-line options control the database connection parameters.\u003c/p\u003e\n\u003cdiv class=\"variablelist\"\u003e\n\u003cdl class=\"variablelist\"\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-d \u003cem class=\"replaceable\"\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--dbname=\u003cem class=\"replaceable\"\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the name of the database to connect to. This is equivalent to specifying \u003cem class=\"replaceable\"\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e as the first non-option argument on the command line. The \u003cem class=\"replaceable\"\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e can be a \u003ca class=\"link\" href=\"/docs/18/libpq-connect.html#LIBPQ-CONNSTRING\" title=\"32.1.1. Connection Strings\"\u003econnection string\u003c/a\u003e. If so, connection string parameters will override any conflicting command line options.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-h \u003cem class=\"replaceable\"\u003e\u003ccode\u003ehost\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--host=\u003cem class=\"replaceable\"\u003e\u003ccode\u003ehost\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket. The default is taken from the \u003ccode class=\"envar\"\u003ePGHOST\u003c/code\u003e environment variable, if set, else a Unix domain socket connection is attempted.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-p \u003cem class=\"replaceable\"\u003e\u003ccode\u003eport\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--port=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eport\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the \u003ccode class=\"envar\"\u003ePGPORT\u003c/code\u003e environment variable, if set, or a compiled-in default.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-U \u003cem class=\"replaceable\"\u003e\u003ccode\u003eusername\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--username=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eusername\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eUser name to connect as.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-w\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-password\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eNever issue a password prompt. If the server requires password authentication and a password is not available by other means such as a \u003ccode class=\"filename\"\u003e.pgpass\u003c/code\u003e file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-W\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--password\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eForce \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e to prompt for a password before connecting to a database.\u003c/p\u003e\n\u003cp\u003eThis option is never essential, since \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e will automatically prompt for a password if the server demands password authentication. However, \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing \u003ccode class=\"option\"\u003e-W\u003c/code\u003e to avoid the extra connection attempt.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--role=\u003cem class=\"replaceable\"\u003e\u003ccode\u003erolename\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies a role name to be used to create the dump. This option causes \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e to issue a \u003ccode class=\"command\"\u003eSET ROLE\u003c/code\u003e \u003cem class=\"replaceable\"\u003e\u003ccode\u003erolename\u003c/code\u003e\u003c/em\u003e command after connecting to the database. It is useful when the authenticated user (specified by \u003ccode class=\"option\"\u003e-U\u003c/code\u003e) lacks privileges needed by \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e, but can switch to a role with the required rights. Some installations have a policy against logging in directly as a superuser, and use of this option allows dumps to be made without violating the policy.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"id-1.9.4.14.7\"\u003e\n\u003ch2\u003eEnvironment\u003c/h2\u003e\n\u003cdiv class=\"variablelist\"\u003e\n\u003cdl class=\"variablelist\"\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003ePGDATABASE\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003ePGHOST\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003ePGOPTIONS\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003ePGPORT\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003ePGUSER\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDefault connection parameters.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003ePG_COLOR\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies whether to use color in diagnostic messages. Possible values are \u003ccode class=\"literal\"\u003ealways\u003c/code\u003e, \u003ccode class=\"literal\"\u003eauto\u003c/code\u003e and \u003ccode class=\"literal\"\u003enever\u003c/code\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003cp\u003eThis utility, like most other \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e utilities, also uses the environment variables supported by \u003cspan class=\"application\"\u003elibpq\u003c/span\u003e (see \u003ca class=\"xref\" href=\"/docs/18/libpq-envars.html\" title=\"32.15. Environment Variables\"\u003eSection 32.15\u003c/a\u003e).\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"APP-PGDUMP-DIAGNOSTICS\"\u003e\n\u003ch2\u003eDiagnostics\u003c/h2\u003e\n\u003cp\u003e\u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e internally executes \u003ccode class=\"command\"\u003eSELECT\u003c/code\u003e statements. If you have problems running \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e, make sure you are able to select information from the database using, for example, \u003ca class=\"xref\" href=\"/docs/18/app-psql.html\" title=\"psql\"\u003e\u003cspan class=\"refentrytitle\"\u003e\u003cspan class=\"application\"\u003epsql\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e. Also, any default connection settings and environment variables used by the \u003cspan class=\"application\"\u003elibpq\u003c/span\u003e front-end library will apply.\u003c/p\u003e\n\u003cp\u003eThe database activity of \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e is normally collected by the cumulative statistics system. If this is undesirable, you can set parameter \u003ccode class=\"varname\"\u003etrack_counts\u003c/code\u003e to false via \u003ccode class=\"envar\"\u003ePGOPTIONS\u003c/code\u003e or the \u003ccode class=\"literal\"\u003eALTER USER\u003c/code\u003e command.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"PG-DUMP-NOTES\"\u003e\n\u003ch2\u003eNotes\u003c/h2\u003e\n\u003cp\u003eIf your database cluster has any local additions to the \u003ccode class=\"literal\"\u003etemplate1\u003c/code\u003e database, be careful to restore the output of \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e into a truly empty database; otherwise you are likely to get errors due to duplicate definitions of the added objects. To make an empty database without any local additions, copy from \u003ccode class=\"literal\"\u003etemplate0\u003c/code\u003e not \u003ccode class=\"literal\"\u003etemplate1\u003c/code\u003e, for example:\u003c/p\u003e\n\u003cpre class=\"programlisting\"\u003eCREATE DATABASE foo WITH TEMPLATE template0;\n\u003c/pre\u003e\n\u003cp\u003eWhen a dump without schema is chosen and the option \u003ccode class=\"option\"\u003e--disable-triggers\u003c/code\u003e is used, \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e emits commands to disable triggers on user tables before inserting the data, and then commands to re-enable them after the data has been inserted. If the restore is stopped in the middle, the system catalogs might be left in the wrong state.\u003c/p\u003e\n\u003cp\u003eWhen \u003ccode class=\"option\"\u003e--statistics\u003c/code\u003e is specified, \u003ccode class=\"command\"\u003epg_dump\u003c/code\u003e will include most optimizer statistics in the resulting dump file. This does not include all statistics, such as those created explicitly with \u003ca class=\"xref\" href=\"/docs/18/sql-createstatistics.html\" title=\"CREATE STATISTICS\"\u003e\u003cspan class=\"refentrytitle\"\u003eCREATE STATISTICS\u003c/span\u003e\u003c/a\u003e, custom statistics added by an extension, or statistics collected by the cumulative statistics system. Therefore, it may still be useful to run \u003ccode class=\"command\"\u003eANALYZE\u003c/code\u003e after restoring from a dump file to ensure optimal performance; see \u003ca class=\"xref\" href=\"/docs/18/routine-vacuuming.html#VACUUM-FOR-STATISTICS\" title=\"24.1.3. Updating Planner Statistics\"\u003eSection 24.1.3\u003c/a\u003e and \u003ca class=\"xref\" href=\"/docs/18/routine-vacuuming.html#AUTOVACUUM\" title=\"24.1.6. The Autovacuum Daemon\"\u003eSection 24.1.6\u003c/a\u003e for more information.\u003c/p\u003e\n\u003cp\u003eBecause \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e is used to transfer data to newer versions of \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e, the output of \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e can be expected to load into \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e server versions newer than \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e's version. \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e can also dump from \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e servers older than its own version. (Currently, servers back to version 9.2 are supported.) However, \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e cannot dump from \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e servers newer than its own major version; it will refuse to even try, rather than risk making an invalid dump. Also, it is not guaranteed that \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e's output can be loaded into a server of an older major version — not even if the dump was taken from a server of that version. Loading a dump file into an older server may require manual editing of the dump file to remove syntax not understood by the older server. Use of the \u003ccode class=\"option\"\u003e--quote-all-identifiers\u003c/code\u003e option is recommended in cross-version cases, as it can prevent problems arising from varying reserved-word lists in different \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e versions.\u003c/p\u003e\n\u003cp\u003eWhen dumping logical replication subscriptions, \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e will generate \u003ccode class=\"command\"\u003eCREATE SUBSCRIPTION\u003c/code\u003e commands that use the \u003ccode class=\"literal\"\u003econnect = false\u003c/code\u003e option, so that restoring the subscription does not make remote connections for creating a replication slot or for initial table copy. That way, the dump can be restored without requiring network access to the remote servers. It is then up to the user to reactivate the subscriptions in a suitable way. If the involved hosts have changed, the connection information might have to be changed. It might also be appropriate to truncate the target tables before initiating a new full table copy. If users intend to copy initial data during refresh they must create the slot with \u003ccode class=\"literal\"\u003etwo_phase = false\u003c/code\u003e. After the initial sync, the \u003ca class=\"link\" href=\"/docs/18/sql-createsubscription.html#SQL-CREATESUBSCRIPTION-PARAMS-WITH-TWO-PHASE\"\u003e\u003ccode class=\"literal\"\u003etwo_phase\u003c/code\u003e\u003c/a\u003e option will be automatically enabled by the subscriber if the subscription had been originally created with \u003ccode class=\"literal\"\u003etwo_phase = true\u003c/code\u003e option.\u003c/p\u003e\n\u003cp\u003eIt is generally recommended to use the \u003ccode class=\"option\"\u003e-X\u003c/code\u003e (\u003ccode class=\"option\"\u003e--no-psqlrc\u003c/code\u003e) option when restoring a database from a plain-text \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e script to ensure a clean restore process and prevent potential conflicts with non-default \u003cspan class=\"application\"\u003epsql\u003c/span\u003e configurations.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"PG-DUMP-EXAMPLES\"\u003e\n\u003ch2\u003eExamples\u003c/h2\u003e\n\u003cp\u003eTo dump a database called \u003ccode class=\"literal\"\u003emydb\u003c/code\u003e into an SQL-script file:\u003c/p\u003e\n\u003cpre class=\"screen\"\u003e\u003ccode class=\"prompt\"\u003e$\u003c/code\u003e \u003cstrong class=\"userinput\"\u003e\u003ccode\u003epg_dump mydb \u0026gt; db.sql\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\n\u003cp\u003eTo reload such a script into a (freshly created) database named \u003ccode class=\"literal\"\u003enewdb\u003c/code\u003e:\u003c/p\u003e\n\u003cpre class=\"screen\"\u003e\u003ccode class=\"prompt\"\u003e$\u003c/code\u003e \u003cstrong class=\"userinput\"\u003e\u003ccode\u003epsql -X -d newdb -f db.sql\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\n\u003cp\u003eTo dump a database into a custom-format archive file:\u003c/p\u003e\n\u003cpre class=\"screen\"\u003e\u003ccode class=\"prompt\"\u003e$\u003c/code\u003e \u003cstrong class=\"userinput\"\u003e\u003ccode\u003epg_dump -Fc mydb \u0026gt; db.dump\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\n\u003cp\u003eTo dump a database into a directory-format archive:\u003c/p\u003e\n\u003cpre class=\"screen\"\u003e\u003ccode class=\"prompt\"\u003e$\u003c/code\u003e \u003cstrong class=\"userinput\"\u003e\u003ccode\u003epg_dump -Fd mydb -f dumpdir\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\n\u003cp\u003eTo dump a database into a directory-format archive in parallel with 5 worker jobs:\u003c/p\u003e\n\u003cpre class=\"screen\"\u003e\u003ccode class=\"prompt\"\u003e$\u003c/code\u003e \u003cstrong class=\"userinput\"\u003e\u003ccode\u003epg_dump -Fd mydb -j 5 -f dumpdir\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\n\u003cp\u003eTo reload an archive file into a (freshly created) database named \u003ccode class=\"literal\"\u003enewdb\u003c/code\u003e:\u003c/p\u003e\n\u003cpre class=\"screen\"\u003e\u003ccode class=\"prompt\"\u003e$\u003c/code\u003e \u003cstrong class=\"userinput\"\u003e\u003ccode\u003epg_restore -d newdb db.dump\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\n\u003cp\u003eTo reload an archive file into the same database it was dumped from, discarding the current contents of that database:\u003c/p\u003e\n\u003cpre class=\"screen\"\u003e\u003ccode class=\"prompt\"\u003e$\u003c/code\u003e \u003cstrong class=\"userinput\"\u003e\u003ccode\u003epg_restore -d postgres --clean --create db.dump\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\n\u003cp\u003eTo dump a single table named \u003ccode class=\"literal\"\u003emytab\u003c/code\u003e:\u003c/p\u003e\n\u003cpre class=\"screen\"\u003e\u003ccode class=\"prompt\"\u003e$\u003c/code\u003e \u003cstrong class=\"userinput\"\u003e\u003ccode\u003epg_dump -t mytab mydb \u0026gt; db.sql\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\n\u003cp\u003eTo dump all tables whose names start with \u003ccode class=\"literal\"\u003eemp\u003c/code\u003e in the \u003ccode class=\"literal\"\u003edetroit\u003c/code\u003e schema, except for the table named \u003ccode class=\"literal\"\u003eemployee_log\u003c/code\u003e:\u003c/p\u003e\n\u003cpre class=\"screen\"\u003e\u003ccode class=\"prompt\"\u003e$\u003c/code\u003e \u003cstrong class=\"userinput\"\u003e\u003ccode\u003epg_dump -t 'detroit.emp*' -T detroit.employee_log mydb \u0026gt; db.sql\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\n\u003cp\u003eTo dump all schemas whose names start with \u003ccode class=\"literal\"\u003eeast\u003c/code\u003e or \u003ccode class=\"literal\"\u003ewest\u003c/code\u003e and end in \u003ccode class=\"literal\"\u003egsm\u003c/code\u003e, excluding any schemas whose names contain the word \u003ccode class=\"literal\"\u003etest\u003c/code\u003e:\u003c/p\u003e\n\u003cpre class=\"screen\"\u003e\u003ccode class=\"prompt\"\u003e$\u003c/code\u003e \u003cstrong class=\"userinput\"\u003e\u003ccode\u003epg_dump -n 'east*gsm' -n 'west*gsm' -N '*test*' mydb \u0026gt; db.sql\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\n\u003cp\u003eThe same, using regular expression notation to consolidate the switches:\u003c/p\u003e\n\u003cpre class=\"screen\"\u003e\u003ccode class=\"prompt\"\u003e$\u003c/code\u003e \u003cstrong class=\"userinput\"\u003e\u003ccode\u003epg_dump -n '(east|west)*gsm' -N '*test*' mydb \u0026gt; db.sql\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\n\u003cp\u003eTo dump all database objects except for tables whose names begin with \u003ccode class=\"literal\"\u003ets_\u003c/code\u003e:\u003c/p\u003e\n\u003cpre class=\"screen\"\u003e\u003ccode class=\"prompt\"\u003e$\u003c/code\u003e \u003cstrong class=\"userinput\"\u003e\u003ccode\u003epg_dump -T 'ts_*' mydb \u0026gt; db.sql\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\n\u003cp\u003eTo specify an upper-case or mixed-case name in \u003ccode class=\"option\"\u003e-t\u003c/code\u003e and related switches, you need to double-quote the name; else it will be folded to lower case (see \u003ca class=\"xref\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003ePatterns\u003c/a\u003e). But double quotes are special to the shell, so in turn they must be quoted. Thus, to dump a single table with a mixed-case name, you need something like\u003c/p\u003e\n\u003cpre class=\"screen\"\u003e\u003ccode class=\"prompt\"\u003e$\u003c/code\u003e \u003cstrong class=\"userinput\"\u003e\u003ccode\u003epg_dump -t \"\\\"MixedCaseName\\\"\" mydb \u0026gt; mytab.sql\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\n\u003cp\u003eTo dump all tables whose names start with \u003ccode class=\"literal\"\u003emytable\u003c/code\u003e, except for table \u003ccode class=\"literal\"\u003emytable2\u003c/code\u003e, specify a filter file \u003ccode class=\"filename\"\u003efilter.txt\u003c/code\u003e like:\u003c/p\u003e\n\u003cpre class=\"programlisting\"\u003einclude table mytable*\nexclude table mytable2\n\u003c/pre\u003e\n\u003cpre class=\"screen\"\u003e\u003ccode class=\"prompt\"\u003e$\u003c/code\u003e \u003cstrong class=\"userinput\"\u003e\u003ccode\u003epg_dump --filter=filter.txt mydb \u0026gt; db.sql\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"id-1.9.4.14.11\"\u003e\n\u003ch2\u003eSee Also\u003c/h2\u003e\u003cspan class=\"simplelist\"\u003e\u003ca class=\"xref\" href=\"/docs/18/app-pg-dumpall.html\" title=\"pg_dumpall\"\u003e\u003cspan class=\"refentrytitle\"\u003e\u003cspan class=\"application\"\u003epg_dumpall\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e, \u003ca class=\"xref\" href=\"/docs/18/app-pgrestore.html\" title=\"pg_restore\"\u003e\u003cspan class=\"refentrytitle\"\u003e\u003cspan class=\"application\"\u003epg_restore\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e, \u003ca class=\"xref\" href=\"/docs/18/app-psql.html\" title=\"psql\"\u003e\u003cspan class=\"refentrytitle\"\u003e\u003cspan class=\"application\"\u003epsql\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003c/span\u003e\n\u003c/div\u003e\n\u003c/div\u003e\u003c/div\u003e","related":[{"label":"libpq connection parameters","url":"/wiki/conn/?v=18"}],"sections":[],"tables":[{"columns":[{"key":"signature","label":"Option and arguments"},{"key":"summary","label":"Description"}],"key":"options","rows":[{"signature":{"text":"-a --data-only","url":"/docs/18/app-pgdump.html"},"summary":"Dump only the data, not the schema (data definitions) or statistics. Table data, large objects, and sequence values are dumped."},{"signature":{"text":"-b --large-objects --blobs (deprecated)","url":"/docs/18/app-pgdump.html"},"summary":"Include large objects in the dump. This is the default behavior except when --schema , --table , --schema-only , --statistics-only , or --no-data is specified. The -b switch is therefore only useful to add large objects to dumps where a specific schema or table has been requested. Note that large objects are considered data and therefore will be included when --data-only is used, but not when --schema-only or --statistics-only is."},{"signature":{"text":"-B --no-large-objects --no-blobs (deprecated)","url":"/docs/18/app-pgdump.html"},"summary":"Exclude large objects in the dump."},{"signature":{"text":"-c --clean","url":"/docs/18/app-pgdump.html"},"summary":"Output commands to DROP all the dumped database objects prior to outputting the commands for creating them. This option is useful when the restore is to overwrite an existing database. If any of the objects do not exist in the destination database, ignorable error messages will be reported during restore, unless --if-exists is also specified."},{"signature":{"text":"-C --create","url":"/docs/18/app-pgdump.html"},"summary":"Begin the output with a command to create the database itself and reconnect to the created database. (With a script of this form, it doesn't matter which database in the destination installation you connect to before running the script.) If --clean is also specified, the script drops and recreates the target database before reconnecting to it."},{"signature":{"text":"-e pattern --extension= pattern","url":"/docs/18/app-pgdump.html"},"summary":"Dump only extensions matching pattern . When this option is not specified, all non-system extensions in the target database will be dumped. Multiple extensions can be selected by writing multiple -e switches. The pattern parameter is interpreted as a pattern according to the same rules used by psql 's \\d commands (see Patterns ), so multiple extensions can also be selected by writing wildcard characters in the pattern. When using wildcards, be careful to quote the pattern if needed to prevent the shell from expanding the wildcards."},{"signature":{"text":"-E encoding --encoding= encoding","url":"/docs/18/app-pgdump.html"},"summary":"Create the dump in the specified character set encoding. By default, the dump is created in the database encoding. (Another way to get the same result is to set the PGCLIENTENCODING environment variable to the desired dump encoding.) The supported encodings are described in Section 23.3.1 ."},{"signature":{"text":"-f file --file= file","url":"/docs/18/app-pgdump.html"},"summary":"Send output to the specified file. This parameter can be omitted for file based output formats, in which case the standard output is used. It must be given for the directory output format however, where it specifies the target directory instead of a file. In this case the directory is created by pg_dump and must not exist before."},{"signature":{"text":"-F format --format= format","url":"/docs/18/app-pgdump.html"},"summary":"Selects the format of the output. format can be one of the following:"},{"signature":{"text":"-j njobs --jobs= njobs","url":"/docs/18/app-pgdump.html"},"summary":"Run the dump in parallel by dumping njobs tables simultaneously. This option may reduce the time needed to perform the dump but it also increases the load on the database server. You can only use this option with the directory output format because this is the only output format where multiple processes can write their data at the same time."},{"signature":{"text":"-n pattern --schema= pattern","url":"/docs/18/app-pgdump.html"},"summary":"Dump only schemas matching pattern ; this selects both the schema itself, and all its contained objects. When this option is not specified, all non-system schemas in the target database will be dumped. Multiple schemas can be selected by writing multiple -n switches. The pattern parameter is interpreted as a pattern according to the same rules used by psql 's \\d commands (see Patterns ), so multiple schemas can also be selected by writing wildcard characters in the pattern. When using wildcards, be careful to quote the pattern if needed to prevent the shell from expanding the wildcards; see Examples below."},{"signature":{"text":"-N pattern --exclude-schema= pattern","url":"/docs/18/app-pgdump.html"},"summary":"Do not dump any schemas matching pattern . The pattern is interpreted according to the same rules as for -n . -N can be given more than once to exclude schemas matching any of several patterns."},{"signature":{"text":"-O --no-owner","url":"/docs/18/app-pgdump.html"},"summary":"Do not output commands to set ownership of objects to match the original database. By default, pg_dump issues ALTER OWNER or SET SESSION AUTHORIZATION statements to set ownership of created database objects. These statements will fail when the script is run unless it is started by a superuser (or the same user that owns all of the objects in the script). To make a script that can be restored by any user, but will give that user ownership of all the objects, specify -O ."},{"signature":{"text":"-R --no-reconnect","url":"/docs/18/app-pgdump.html"},"summary":"This option is obsolete but still accepted for backwards compatibility."},{"signature":{"text":"-s --schema-only","url":"/docs/18/app-pgdump.html"},"summary":"Dump only the object definitions (schema), not data or statistics."},{"signature":{"text":"-S username --superuser= username","url":"/docs/18/app-pgdump.html"},"summary":"Specify the superuser user name to use when disabling triggers. This is relevant only if --disable-triggers is used. (Usually, it's better to leave this out, and instead start the resulting script as superuser.)"},{"signature":{"text":"-t pattern --table= pattern","url":"/docs/18/app-pgdump.html"},"summary":"Dump only tables with names matching pattern . Multiple tables can be selected by writing multiple -t switches. The pattern parameter is interpreted as a pattern according to the same rules used by psql 's \\d commands (see Patterns ), so multiple tables can also be selected by writing wildcard characters in the pattern. When using wildcards, be careful to quote the pattern if needed to prevent the shell from expanding the wildcards; see Examples below."},{"signature":{"text":"-T pattern --exclude-table= pattern","url":"/docs/18/app-pgdump.html"},"summary":"Do not dump any tables matching pattern . The pattern is interpreted according to the same rules as for -t . -T can be given more than once to exclude tables matching any of several patterns."},{"signature":{"text":"-v --verbose","url":"/docs/18/app-pgdump.html"},"summary":"Specifies verbose mode. This will cause pg_dump to output detailed object comments and start/stop times to the dump file, and progress messages to standard error. Repeating the option causes additional debug-level messages to appear on standard error."},{"signature":{"text":"-V --version","url":"/docs/18/app-pgdump.html"},"summary":"Print the pg_dump version and exit."},{"signature":{"text":"-x --no-privileges --no-acl","url":"/docs/18/app-pgdump.html"},"summary":"Prevent dumping of access privileges (grant/revoke commands)."},{"signature":{"text":"-Z level -Z method [: detail ] --compress= level --compress= method [: detail ]","url":"/docs/18/app-pgdump.html"},"summary":"Specify the compression method and/or the compression level to use. The compression method can be set to gzip , lz4 , zstd , or none for no compression. A compression detail string can optionally be specified. If the detail string is an integer, it specifies the compression level. Otherwise, it should be a comma-separated list of items, each of the form keyword or keyword=value . Currently, the supported keywords are level and long ."},{"signature":{"text":"--binary-upgrade","url":"/docs/18/app-pgdump.html"},"summary":"This option is for use by in-place upgrade utilities. Its use for other purposes is not recommended or supported. The behavior of the option may change in future releases without notice."},{"signature":{"text":"--column-inserts --attribute-inserts","url":"/docs/18/app-pgdump.html"},"summary":"Dump data as INSERT commands with explicit column names ( INSERT INTO table ( column , ...) VALUES ... ). This will make restoration very slow; it is mainly useful for making dumps that can be loaded into non- PostgreSQL databases. Any error during restoring will cause only rows that are part of the problematic INSERT to be lost, rather than the entire table contents."},{"signature":{"text":"--disable-dollar-quoting","url":"/docs/18/app-pgdump.html"},"summary":"This option disables the use of dollar quoting for function bodies, and forces them to be quoted using SQL standard string syntax."},{"signature":{"text":"--disable-triggers","url":"/docs/18/app-pgdump.html"},"summary":"This option is relevant only when creating a dump that includes data but does not include schema. It instructs pg_dump to include commands to temporarily disable triggers on the target tables while the data is restored. Use this if you have referential integrity checks or other triggers on the tables that you do not want to invoke during data restore."},{"signature":{"text":"--enable-row-security","url":"/docs/18/app-pgdump.html"},"summary":"This option is relevant only when dumping the contents of a table which has row security. By default, pg_dump will set row_security to off, to ensure that all data is dumped from the table. If the user does not have sufficient privileges to bypass row security, then an error is thrown. This parameter instructs pg_dump to set row_security to on instead, allowing the user to dump the parts of the contents of the table that they have access to."},{"signature":{"text":"--exclude-extension= pattern","url":"/docs/18/app-pgdump.html"},"summary":"Do not dump any extensions matching pattern . The pattern is interpreted according to the same rules as for -e . --exclude-extension can be given more than once to exclude extensions matching any of several patterns."},{"signature":{"text":"--exclude-table-and-children= pattern","url":"/docs/18/app-pgdump.html"},"summary":"This is the same as the -T / --exclude-table option, except that it also excludes any partitions or inheritance child tables of the table(s) matching the pattern ."},{"signature":{"text":"--exclude-table-data= pattern","url":"/docs/18/app-pgdump.html"},"summary":"Do not dump data for any tables matching pattern . The pattern is interpreted according to the same rules as for -t . --exclude-table-data can be given more than once to exclude tables matching any of several patterns. This option is useful when you need the definition of a particular table even though you do not need the data in it."},{"signature":{"text":"--exclude-table-data-and-children= pattern","url":"/docs/18/app-pgdump.html"},"summary":"This is the same as the --exclude-table-data option, except that it also excludes data of any partitions or inheritance child tables of the table(s) matching the pattern ."},{"signature":{"text":"--extra-float-digits= ndigits","url":"/docs/18/app-pgdump.html"},"summary":"Use the specified value of extra_float_digits when dumping floating-point data, instead of the maximum available precision. Routine dumps made for backup purposes should not use this option."},{"signature":{"text":"--filter= filename","url":"/docs/18/app-pgdump.html"},"summary":"Specify a filename from which to read patterns for objects to include or exclude from the dump. The patterns are interpreted according to the same rules as the corresponding options: -t / --table , --table-and-children , -T / --exclude-table , and --exclude-table-and-children for tables, -n / --schema and -N / --exclude-schema for schemas, --include-foreign-data for data on foreign servers, --exclude-table-data and --exclude-table-data-and-children for table data, and -e / --extension and --exclude-extension for extensions. To read from STDIN , use - as the filename. The --filter option can be specified in conjunction with the above listed options for including or excluding objects, and can also be specified more than once for multiple filter files."},{"signature":{"text":"--if-exists","url":"/docs/18/app-pgdump.html"},"summary":"Use DROP ... IF EXISTS commands to drop objects in --clean mode. This suppresses “ does not exist ” errors that might otherwise be reported. This option is not valid unless --clean is also specified."},{"signature":{"text":"--include-foreign-data= foreignserver","url":"/docs/18/app-pgdump.html"},"summary":"Dump the data for any foreign table with a foreign server matching foreignserver pattern. Multiple foreign servers can be selected by writing multiple --include-foreign-data switches. Also, the foreignserver parameter is interpreted as a pattern according to the same rules used by psql 's \\d commands (see Patterns ), so multiple foreign servers can also be selected by writing wildcard characters in the pattern. When using wildcards, be careful to quote the pattern if needed to prevent the shell from expanding the wildcards; see Examples below. The only exception is that an empty pattern is disallowed."},{"signature":{"text":"--inserts","url":"/docs/18/app-pgdump.html"},"summary":"Dump data as INSERT commands (rather than COPY ). This will make restoration very slow; it is mainly useful for making dumps that can be loaded into non- PostgreSQL databases. Any error during restoring will cause only rows that are part of the problematic INSERT to be lost, rather than the entire table contents. Note that the restore might fail altogether if you have rearranged column order. The --column-inserts option is safe against column order changes, though even slower."},{"signature":{"text":"--load-via-partition-root","url":"/docs/18/app-pgdump.html"},"summary":"When dumping data for a table partition, make the COPY or INSERT statements target the root of the partitioning hierarchy that contains it, rather than the partition itself. This causes the appropriate partition to be re-determined for each row when the data is loaded. This may be useful when restoring data on a server where rows do not always fall into the same partitions as they did on the original server. That could happen, for example, if the partitioning column is of type text and the two systems have different definitions of the collation used to sort the partitioning column."},{"signature":{"text":"--lock-wait-timeout= timeout","url":"/docs/18/app-pgdump.html"},"summary":"Do not wait forever to acquire shared table locks at the beginning of the dump. Instead fail if unable to lock a table within the specified timeout . The timeout may be specified in any of the formats accepted by SET statement_timeout . (Allowed formats vary depending on the server version you are dumping from, but an integer number of milliseconds is accepted by all versions.)"},{"signature":{"text":"--no-comments","url":"/docs/18/app-pgdump.html"},"summary":"Do not dump COMMENT commands."},{"signature":{"text":"--no-data","url":"/docs/18/app-pgdump.html"},"summary":"Do not dump data."},{"signature":{"text":"--no-policies","url":"/docs/18/app-pgdump.html"},"summary":"Do not dump row security policies."},{"signature":{"text":"--no-publications","url":"/docs/18/app-pgdump.html"},"summary":"Do not dump publications."},{"signature":{"text":"--no-schema","url":"/docs/18/app-pgdump.html"},"summary":"Do not dump schema (data definitions)."},{"signature":{"text":"--no-security-labels","url":"/docs/18/app-pgdump.html"},"summary":"Do not dump security labels."},{"signature":{"text":"--no-statistics","url":"/docs/18/app-pgdump.html"},"summary":"Do not dump statistics. This is the default."},{"signature":{"text":"--no-subscriptions","url":"/docs/18/app-pgdump.html"},"summary":"Do not dump subscriptions."},{"signature":{"text":"--no-sync","url":"/docs/18/app-pgdump.html"},"summary":"By default, pg_dump will wait for all files to be written safely to disk. This option causes pg_dump to return without waiting, which is faster, but means that a subsequent operating system crash can leave the dump corrupt. Generally, this option is useful for testing but should not be used when dumping data from production installation."},{"signature":{"text":"--no-table-access-method","url":"/docs/18/app-pgdump.html"},"summary":"Do not output commands to select table access methods. With this option, all objects will be created with whichever table access method is the default during restore."},{"signature":{"text":"--no-tablespaces","url":"/docs/18/app-pgdump.html"},"summary":"Do not output commands to select tablespaces. With this option, all objects will be created in whichever tablespace is the default during restore."},{"signature":{"text":"--no-toast-compression","url":"/docs/18/app-pgdump.html"},"summary":"Do not output commands to set TOAST compression methods. With this option, all columns will be restored with the default compression setting."},{"signature":{"text":"--no-unlogged-table-data","url":"/docs/18/app-pgdump.html"},"summary":"Do not dump the contents of unlogged tables and sequences. This option has no effect on whether or not the table and sequence definitions (schema) are dumped; it only suppresses dumping the table and sequence data. Data in unlogged tables and sequences is always excluded when dumping from a standby server."},{"signature":{"text":"--on-conflict-do-nothing","url":"/docs/18/app-pgdump.html"},"summary":"Add ON CONFLICT DO NOTHING to INSERT commands. This option is not valid unless --inserts , --column-inserts or --rows-per-insert is also specified."},{"signature":{"text":"--quote-all-identifiers","url":"/docs/18/app-pgdump.html"},"summary":"Force quoting of all identifiers. This option is recommended when dumping a database from a server whose PostgreSQL major version is different from pg_dump 's, or when the output is intended to be loaded into a server of a different major version. By default, pg_dump quotes only identifiers that are reserved words in its own major version. This sometimes results in compatibility issues when dealing with servers of other versions that may have slightly different sets of reserved words. Using --quote-all-identifiers prevents such issues, at the price of a harder-to-read dump script."},{"signature":{"text":"--restrict-key= restrict_key","url":"/docs/18/app-pgdump.html"},"summary":"Use the provided string as the psql \\restrict key in the dump output. This can only be specified for plain-text dumps, i.e., when --format is set to plain or the --format option is omitted. If no restrict key is specified, pg_dump will generate a random one as needed. Keys may contain only alphanumeric characters."},{"signature":{"text":"--rows-per-insert= nrows","url":"/docs/18/app-pgdump.html"},"summary":"Dump data as INSERT commands (rather than COPY ). Controls the maximum number of rows per INSERT command. The value specified must be a number greater than zero. Any error during restoring will cause only rows that are part of the problematic INSERT to be lost, rather than the entire table contents."},{"signature":{"text":"--section= sectionname","url":"/docs/18/app-pgdump.html"},"summary":"Only dump the named section. The section name can be pre-data , data , or post-data . This option can be specified more than once to select multiple sections. The default is to dump all sections."},{"signature":{"text":"--sequence-data","url":"/docs/18/app-pgdump.html"},"summary":"Include sequence data in the dump. This is the default behavior except when --no-data , --schema-only , or --statistics-only is specified."},{"signature":{"text":"--serializable-deferrable","url":"/docs/18/app-pgdump.html"},"summary":"Use a serializable transaction for the dump, to ensure that the snapshot used is consistent with later database states; but do this by waiting for a point in the transaction stream at which no anomalies can be present, so that there isn't a risk of the dump failing or causing other transactions to roll back with a serialization_failure . See Chapter 13 for more information about transaction isolation and concurrency control."},{"signature":{"text":"--snapshot= snapshotname","url":"/docs/18/app-pgdump.html"},"summary":"Use the specified synchronized snapshot when making a dump of the database (see Table 9.100 for more details)."},{"signature":{"text":"--statistics","url":"/docs/18/app-pgdump.html"},"summary":"Dump optimizer statistics."},{"signature":{"text":"--statistics-only","url":"/docs/18/app-pgdump.html"},"summary":"Dump only the statistics, not the schema (data definitions) or data. Optimizer statistics for tables, materialized views, foreign tables, and indexes are dumped."},{"signature":{"text":"--strict-names","url":"/docs/18/app-pgdump.html"},"summary":"Require that each extension ( -e / --extension ), schema ( -n / --schema ) and table ( -t / --table ) pattern match at least one extension/schema/table in the database to be dumped. This also applies to filters used with --filter . Note that if none of the extension/schema/table patterns find matches, pg_dump will generate an error even without --strict-names ."},{"signature":{"text":"--sync-method= method","url":"/docs/18/app-pgdump.html"},"summary":"When set to fsync , which is the default, pg_dump --format=directory will recursively open and synchronize all files in the archive directory."},{"signature":{"text":"--table-and-children= pattern","url":"/docs/18/app-pgdump.html"},"summary":"This is the same as the -t / --table option, except that it also includes any partitions or inheritance child tables of the table(s) matching the pattern ."},{"signature":{"text":"--use-set-session-authorization","url":"/docs/18/app-pgdump.html"},"summary":"Output SQL-standard SET SESSION AUTHORIZATION commands instead of ALTER OWNER commands to determine object ownership. This makes the dump more standards-compatible, but depending on the history of the objects in the dump, might not restore properly. Also, a dump using SET SESSION AUTHORIZATION will certainly require superuser privileges to restore correctly, whereas ALTER OWNER requires lesser privileges."},{"signature":{"text":"-? --help","url":"/docs/18/app-pgdump.html"},"summary":"Show help about pg_dump command line arguments, and exit."},{"signature":{"text":"-d dbname --dbname= dbname","url":"/docs/18/app-pgdump.html"},"summary":"Specifies the name of the database to connect to. This is equivalent to specifying dbname as the first non-option argument on the command line. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options."},{"signature":{"text":"-h host --host= host","url":"/docs/18/app-pgdump.html"},"summary":"Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket. The default is taken from the PGHOST environment variable, if set, else a Unix domain socket connection is attempted."},{"signature":{"text":"-p port --port= port","url":"/docs/18/app-pgdump.html"},"summary":"Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default."},{"signature":{"text":"-U username --username= username","url":"/docs/18/app-pgdump.html"},"summary":"User name to connect as."},{"signature":{"text":"-w --no-password","url":"/docs/18/app-pgdump.html"},"summary":"Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password."},{"signature":{"text":"-W --password","url":"/docs/18/app-pgdump.html"},"summary":"Force pg_dump to prompt for a password before connecting to a database."},{"signature":{"text":"--role= rolename","url":"/docs/18/app-pgdump.html"},"summary":"Specifies a role name to be used to create the dump. This option causes pg_dump to issue a SET ROLE rolename command after connecting to the database. It is useful when the authenticated user (specified by -U ) lacks privileges needed by pg_dump , but can switch to a role with the required rights. Some installations have a policy against logging in directly as a superuser, and use of this option allows dumps to be made without violating the policy."}],"title":"Documented options"},{"columns":[{"key":"name","label":"Variable"},{"key":"description","label":"Meaning"}],"key":"environment","rows":[{"description":"Default connection parameters.","name":"PGDATABASE PGHOST PGOPTIONS PGPORT PGUSER"},{"description":"Specifies whether to use color in diagnostic messages. Possible values are always , auto and never .","name":"PG_COLOR"}],"title":"Environment variables"}]}},"RequestedLocale":"zh-Hans","Fallback":true,"Versions":["10","11","12","13","14","15","16","17","18","19","20"],"Locales":["en"],"Signatures":null,"Spellings":null,"SQLState":null,"Evidence":null}
