{"Entry":{"collection":"tool","key":"pg-dump","name":"pg_dump","aliases":["pg_dump"],"metadata":{"aliases":["pg_dump"],"category":"Client applications","content_hash":"c2dd35a94adb46b5c132ee33391b6b068e814d594cc6847dce93b76cf632698b","derived_content_hash":"385e442c2b22abebd54d05c9554d7b8b5160919202b5e6cd0306a49b7205cb73","documentation_refresh":{"batch":"20261113","original_source_rev":"","versions":{"14":"14.25","15":"15.20","16":"16.16","17":"17.12","18":"18.7","19":"19rc2"}},"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":"1b2d62b4845aa46374f2cb680f95d3392322cc8128646992ae4e18d0e7084915","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. 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"],"description_zh":"pg_dump — 将 PostgreSQL 数据库导出为 SQL 脚本或其他格式","description_zh_html":"\u003cdiv class=\"refentry\" id=\"APP-PGDUMP\"\u003e\u003cdiv class=\"titlepage\"\u003e\u003c/div\u003e\u003cdiv class=\"refnamediv\"\u003e\u003ch2\u003e\u003cspan class=\"refentrytitle\"\u003e\u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e\u003c/span\u003e\u003c/h2\u003e\u003cp\u003epg_dump — \n   将 \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e 数据库导出为 SQL 脚本或其他格式\n  \u003c/p\u003e\u003c/div\u003e\u003cdiv class=\"refsynopsisdiv\"\u003e\u003ch2\u003e大纲\u003c/h2\u003e\u003cdiv class=\"cmdsynopsis\"\u003e\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\u003c/div\u003e\u003c/div\u003e\u003cdiv class=\"refsect1\" id=\"PG-DUMP-DESCRIPTION\"\u003e\u003ch2\u003e描述\u003c/h2\u003e\u003cp\u003e\n\u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e 是一个用于导出\n   \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e 数据库的工具。即使数据库正在被并发使用，它也能生成一致的导出结果。\u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e 不会阻塞其他用户访问数据库（无论读还是写）。不过请注意，除了简单场景之外，\u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e 通常并不是对生产数据库进行常规备份的正确选择。进一步讨论见\u003ca class=\"xref\" href=\"/zh/docs/18/backup.html\" title=\"第 25 章 备份和恢复\"\u003e第 25 章\u003c/a\u003e。\n  \u003c/p\u003e\u003cp\u003e\n\u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e 只转储单个数据库。要导出整个集簇，或者导出一个集簇中所有数据库共有的全局对象（如角色和表空间），请使用 \u003ca class=\"xref\" href=\"/zh/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。\n  \u003c/p\u003e\u003cp\u003e\n   转储可以输出为脚本格式或归档文件格式。脚本转储是纯文本文件，包含把数据库重建到保存时状态所需的 SQL 命令。要从这样的脚本恢复，只需将其交给 \u003ca class=\"xref\" href=\"/zh/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。脚本文件甚至可以在其他机器和其他体系结构上用于重建数据库；经过一些修改后，甚至也可以用于其他 SQL 数据库产品。\n  \u003c/p\u003e\u003cp\u003e\n   另一类归档文件格式必须结合 \u003ca class=\"xref\" href=\"/zh/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 来重建数据库。它们允许 \u003cspan class=\"application\"\u003epg_restore\u003c/span\u003e 有选择地恢复某些内容，甚至在恢复之前重新排列条目。归档文件格式被设计为可跨体系结构移植。\n  \u003c/p\u003e\u003cp\u003e\n   使用归档文件格式并配合 \u003cspan class=\"application\"\u003epg_restore\u003c/span\u003e 时，\u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e 提供了一种灵活的归档和传输机制。\u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e 可用于导出整个数据库，而\n   \u003cspan class=\"application\"\u003epg_restore\u003c/span\u003e 可用于检查归档和/或选择要恢复的数据库部分。最灵活的输出文件格式是\u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003ecustom\u003c/span\u003e”\u003c/span\u003e格式（\u003ccode class=\"option\"\u003e-Fc\u003c/code\u003e）和\u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003edirectory\u003c/span\u003e”\u003c/span\u003e格式（\u003ccode class=\"option\"\u003e-Fd\u003c/code\u003e）。它们允许选择和重新排序所有归档条目，支持并行恢复，并且默认会压缩。只有\u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003edirectory\u003c/span\u003e”\u003c/span\u003e格式支持并行转储。\n  \u003c/p\u003e\u003cp\u003e\n   运行 \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e 时，应检查输出中是否有任何警告（打印到标准错误），尤其要结合下面列出的限制来查看。\n  \u003c/p\u003e\u003cdiv class=\"warning\"\u003e\u003ch3 class=\"title\"\u003e警告\u003c/h3\u003e\u003cp\u003e\n    恢复转储会导致目标端执行由源超级用户选择的任意代码。部分转储和部分恢复并不会限制这一点。如果源超级用户不可信，则必须在恢复前检查转储得到的\n    SQL 语句。非纯文本转储可以使用 \u003cspan class=\"application\"\u003epg_restore\u003c/span\u003e 的\n    \u003ccode class=\"option\"\u003e--file\u003c/code\u003e 选项进行检查。注意，运行转储和恢复的客户端无需信任源或目标超级用户。\n   \u003c/p\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv class=\"refsect1\" id=\"PG-DUMP-OPTIONS\"\u003e\u003ch2\u003e选项\u003c/h2\u003e\u003cp\u003e\n    以下命令行选项控制输出的内容和格式。\n\n    \u003c/p\u003e\u003cdiv class=\"variablelist\"\u003e\u003cdl class=\"variablelist\"\u003e\u003cdt id=\"ZH18-AUTO-PG_DUMP-VARLISTENTRY-1\"\u003e\u003cspan class=\"term\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        指定要转储的数据库名称。如果未指定，则使用环境变量 \u003ccode class=\"envar\"\u003ePGDATABASE\u003c/code\u003e。如果未设置该变量，则使用连接指定的用户名。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-PG_DUMP-VARLISTENTRY-2\"\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\u003cdd\u003e\u003cp\u003e\n        只转储数据，不转储模式（数据定义）或统计信息。会转储表数据、大对象和序列值。\n       \u003c/p\u003e\u003cp\u003e\n        此选项类似于指定 \u003ccode class=\"option\"\u003e--section=data\u003c/code\u003e，但出于历史原因，两者并不完全相同。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-PG_DUMP-VARLISTENTRY-3\"\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（已弃用）\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        在转储中包含大对象。除非指定了 \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 或 \u003ccode class=\"option\"\u003e--no-data\u003c/code\u003e，否则这是默认行为。因此，\u003ccode class=\"option\"\u003e-b\u003c/code\u003e 开关只在已经请求了特定模式或表的转储中，需要把大对象再加回来时才有用。注意，大对象被视为数据，因此在使用 \u003ccode class=\"option\"\u003e--data-only\u003c/code\u003e 时会包含，在使用\n        \u003ccode class=\"option\"\u003e--schema-only\u003c/code\u003e 或 \u003ccode class=\"option\"\u003e--statistics-only\u003c/code\u003e\n        时则不会包含。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-PG_DUMP-VARLISTENTRY-4\"\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（已弃用）\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        在转储中排除大对象。\n       \u003c/p\u003e\u003cp\u003e\n        当同时给出 \u003ccode class=\"option\"\u003e-b\u003c/code\u003e 和 \u003ccode class=\"option\"\u003e-B\u003c/code\u003e 时，行为是在转储数据时输出大对象，请参阅 \u003ccode class=\"option\"\u003e-b\u003c/code\u003e 文档。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-PG_DUMP-VARLISTENTRY-5\"\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\u003cdd\u003e\u003cp\u003e\n        在输出创建这些对象的命令之前，先输出用于 \u003ccode class=\"command\"\u003eDROP\u003c/code\u003e\n        所有被转储数据库对象的命令。当恢复要覆盖现有数据库时，此选项很有用。如果目标数据库中某些对象不存在，则在恢复期间会报告可忽略的错误信息，除非还指定了 \u003ccode class=\"option\"\u003e--if-exists\u003c/code\u003e。\n       \u003c/p\u003e\u003cp\u003e\n        当生成一个归档（非文本）输出文件时，此选项将被忽略。对于归档格式，可以在调用 \u003ccode class=\"command\"\u003epg_restore\u003c/code\u003e 时指定该选项。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-PG_DUMP-VARLISTENTRY-6\"\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\u003cdd\u003e\u003cp\u003e\n        让输出以创建数据库本身并重新连接到新建数据库的命令开始。（使用这种形式的脚本时，在目标安装中先连接到哪个数据库再运行脚本都无关紧要。）如果还指定了 \u003ccode class=\"option\"\u003e--clean\u003c/code\u003e，则脚本会在重新连接到目标数据库之前先删除并重新创建它。\n       \u003c/p\u003e\u003cp\u003e\n        使用 \u003ccode class=\"option\"\u003e--create\u003c/code\u003e 时，输出还会包含该数据库的注释（如果有），以及该数据库特有的任何配置变量设置，也就是提及该数据库的任何\n        \u003ccode class=\"command\"\u003eALTER DATABASE ... SET ...\u003c/code\u003e 和\n        \u003ccode class=\"command\"\u003eALTER ROLE ... IN DATABASE ... SET ...\u003c/code\u003e 命令。除非指定了 \u003ccode class=\"option\"\u003e--no-acl\u003c/code\u003e，否则数据库本身的访问权限也会被转储。\n       \u003c/p\u003e\u003cp\u003e\n        当生成一个归档（非文本）输出文件时，此选项将被忽略。对于归档格式，可以在调用 \u003ccode class=\"command\"\u003epg_restore\u003c/code\u003e 时指定该选项。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-PG_DUMP-VARLISTENTRY-7\"\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\u003cdd\u003e\u003cp\u003e\n        仅转储与 \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e 匹配的扩展。当未指定此选项时，将转储目标数据库中的所有非系统扩展。可以通过写多个 \u003ccode class=\"option\"\u003e-e\u003c/code\u003e 开关来选择多个扩展。\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e 参数按照\n        \u003cspan class=\"application\"\u003epsql\u003c/span\u003e 的 \u003ccode class=\"literal\"\u003e\\d\u003c/code\u003e 命令所使用的同样规则进行解释（请参阅\u003ca class=\"xref\" href=\"/zh/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"模式\"\u003e模式\u003c/a\u003e），因此也可以通过在模式中使用通配符来选择多个扩展。使用通配符时，如有需要请小心为模式加引号，以防止 shell 展开通配符。\n       \u003c/p\u003e\u003cp\u003e\n        由 \u003ccode class=\"function\"\u003epg_extension_config_dump\u003c/code\u003e 注册的任何配置关系，如果其所属扩展由 \u003ccode class=\"option\"\u003e--extension\u003c/code\u003e 指定，也会包含在转储中。\n       \u003c/p\u003e\u003cdiv class=\"note\"\u003e\u003ch3 class=\"title\"\u003e注意\u003c/h3\u003e\u003cp\u003e\n         当指定 \u003ccode class=\"option\"\u003e-e\u003c/code\u003e 选项时，\u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e 不会尝试转储所选扩展可能依赖的任何其他数据库对象。因此，不能保证特定扩展的转储结果可以成功地单独恢复到一个干净的数据库中。\n        \u003c/p\u003e\u003c/div\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-PG_DUMP-VARLISTENTRY-8\"\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\u003cdd\u003e\u003cp\u003e\n        在指定的字符集编码中创建转储。默认情况下，转储将以数据库编码创建。（获得相同结果的另一种方法是将 \u003ccode class=\"envar\"\u003ePGCLIENTENCODING\u003c/code\u003e 环境变量设置为所需的转储编码。）支持的编码在\u003ca class=\"xref\" href=\"/zh/docs/18/multibyte.html#MULTIBYTE-CHARSET-SUPPORTED\" title=\"23.3.1. 支持的字符集\"\u003e第 23.3.1 节\u003c/a\u003e中描述。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-PG_DUMP-VARLISTENTRY-9\"\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\u003cdd\u003e\u003cp\u003e\n        将输出发送到指定文件。对于基于文件的输出格式，可以省略此参数，这时使用标准输出。不过，对于目录输出格式，必须给出此参数，因为它指定的是目标目录而不是文件。在这种情况下，该目录由\n        \u003ccode class=\"command\"\u003epg_dump\u003c/code\u003e 创建，并且在此之前必须不存在。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-PG_DUMP-VARLISTENTRY-10\"\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\u003cdd\u003e\u003cp\u003e\n        选择输出的格式。\u003cem class=\"replaceable\"\u003e\u003ccode\u003eformat\u003c/code\u003e\u003c/em\u003e 可以是以下之一：\n\n       \u003c/p\u003e\u003cdiv class=\"variablelist\"\u003e\u003cdl class=\"variablelist\"\u003e\u003cdt id=\"ZH18-AUTO-PG_DUMP-VARLISTENTRY-11\"\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\u003cdd\u003e\u003cp\u003e\n           输出纯文本 \u003cacronym class=\"acronym\"\u003eSQL\u003c/acronym\u003e 脚本文件（默认）。\n          \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-PG_DUMP-VARLISTENTRY-12\"\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\u003cdd\u003e\u003cp\u003e\n           输出适合供 \u003cspan class=\"application\"\u003epg_restore\u003c/span\u003e 使用的 custom 格式归档。与目录输出格式一起，这是最灵活的输出格式，因为它允许在恢复时手工选择并重新排序归档条目。这种格式默认也会压缩。\n          \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-PG_DUMP-VARLISTENTRY-13\"\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\u003cdd\u003e\u003cp\u003e\n           输出适合供 \u003cspan class=\"application\"\u003epg_restore\u003c/span\u003e 使用的 directory 格式归档。这会创建一个目录，其中每个被转储的表和大对象各有一个文件，外加一个所谓的目录表（Table of Contents）文件，以机器可读格式描述被转储对象，\u003cspan class=\"application\"\u003epg_restore\u003c/span\u003e 可以读取它。directory 格式归档可以用标准 Unix 工具来操作；例如，未压缩归档中的文件可以使用\n           \u003cspan class=\"application\"\u003egzip\u003c/span\u003e、\u003cspan class=\"application\"\u003elz4\u003c/span\u003e 或\n           \u003cspan class=\"application\"\u003ezstd\u003c/span\u003e 工具进行压缩。该格式默认使用\n           \u003ccode class=\"literal\"\u003egzip\u003c/code\u003e 压缩，并且支持并行转储。\n          \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-PG_DUMP-VARLISTENTRY-14\"\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\u003cdd\u003e\u003cp\u003e\n           输出 \u003ccode class=\"command\"\u003etar\u003c/code\u003e 格式归档，适合供 \u003cspan class=\"application\"\u003epg_restore\u003c/span\u003e 使用。tar 格式与 directory 格式兼容：解开一个 tar 格式归档就会得到一个有效的 directory 格式归档。不过，tar 格式不支持压缩。另外，使用\n           tar 格式时，在恢复过程中不能改变表数据项的相对顺序。\n          \u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-PG_DUMP-VARLISTENTRY-15\"\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\u003cdd\u003e\u003cp\u003e\n        以并行方式运行转储，同时转储 \u003cem class=\"replaceable\"\u003e\u003ccode\u003enjobs\u003c/code\u003e\u003c/em\u003e\n        个表。此选项可能减少执行转储所需的时间，但也会增加数据库服务器的负载。只能在目录输出格式下使用此选项，因为只有这种输出格式允许多个进程同时写入数据。\n       \u003c/p\u003e\u003cp\u003e\u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e 将打开\n        \u003cem class=\"replaceable\"\u003e\u003ccode\u003enjobs\u003c/code\u003e\u003c/em\u003e + 1 个数据库连接，因此请确保 \u003ca class=\"xref\" href=\"/zh/docs/18/runtime-config-connection.html#GUC-MAX-CONNECTIONS\"\u003emax_connections\u003c/a\u003e 设置足够高，能够容纳所有连接。\n       \u003c/p\u003e\u003cp\u003e\n        在并行转储运行期间请求数据库对象上的排他锁，可能导致转储失败。原因是\n        \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e 的领导者进程会对稍后由工作进程转储的对象请求共享锁（\u003ca class=\"link\" href=\"/zh/docs/18/explicit-locking.html#LOCKING-TABLES\" title=\"13.3.1. 表级锁\"\u003eACCESS SHARE\u003c/a\u003e），以确保在转储运行期间没有人删除这些对象。如果另一个客户端随后请求某个表上的排他锁，该锁不会被授予，而是会排队等待领导者进程释放共享锁。于是，对该表的任何其他访问也都不会被授予，并会排在该排他锁请求之后，其中包括试图转储该表的工作进程。如果没有任何预防措施，这就会形成一个经典的死锁场景。为检测这种冲突，\u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e 工作进程会使用\n        \u003ccode class=\"literal\"\u003eNOWAIT\u003c/code\u003e 选项再请求一个共享锁。如果工作进程拿不到这个共享锁，就说明这期间已经有人请求了排他锁，而此时已经无法继续转储，因此\n        \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e 只能中止转储。\n       \u003c/p\u003e\u003cp\u003e\n        要执行并行转储，数据库服务器需要支持同步快照。这一特性是在\n        \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e 9.2 中为主库引入的，在 10 中为备库引入。有了这个特性，数据库客户端即使使用不同连接，也能保证看到相同的数据集。\u003ccode class=\"command\"\u003epg_dump -j\u003c/code\u003e 会使用多个数据库连接：它会先由领导者进程连接数据库一次，然后每个工作任务再各连一次。若没有同步快照特性，就无法保证各个工作任务在各自连接中看到相同的数据，这可能导致备份不一致。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-PG_DUMP-VARLISTENTRY-16\"\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\u003cdd\u003e\u003cp\u003e\n        只转储匹配 \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e 的模式；这既会选择模式本身，也会选择其中包含的所有对象。未指定此选项时，将转储目标数据库中的所有非系统模式。可以通过写多个 \u003ccode class=\"option\"\u003e-n\u003c/code\u003e\n        开关来选择多个模式。\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\n        参数按照 \u003cspan class=\"application\"\u003epsql\u003c/span\u003e 的 \u003ccode class=\"literal\"\u003e\\d\u003c/code\u003e 命令所使用的同样规则进行解释（见\u003ca class=\"xref\" href=\"/zh/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"模式\"\u003e模式\u003c/a\u003e），因此也可以通过在模式中使用通配符来选择多个模式。使用通配符时，如有需要请小心为模式加引号，以防止 shell 展开通配符；见下文的\u003ca class=\"xref\" href=\"/zh/docs/18/app-pgdump.html#PG-DUMP-EXAMPLES\" title=\"示例\"\u003e示例\u003c/a\u003e。\n       \u003c/p\u003e\u003cdiv class=\"note\"\u003e\u003ch3 class=\"title\"\u003e注意\u003c/h3\u003e\u003cp\u003e\n         当指定 \u003ccode class=\"option\"\u003e-n\u003c/code\u003e 时，\u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e\n         不会尝试转储所选模式可能依赖的任何其他数据库对象。因此，不能保证特定模式转储的结果能够单独成功恢复到一个干净的数据库中。\n        \u003c/p\u003e\u003c/div\u003e\u003cdiv class=\"note\"\u003e\u003ch3 class=\"title\"\u003e注意\u003c/h3\u003e\u003cp\u003e\n         指定 \u003ccode class=\"option\"\u003e-n\u003c/code\u003e 时，不会转储大对象等非模式对象。可以使用\n         \u003ccode class=\"option\"\u003e--large-objects\u003c/code\u003e 开关把大对象加回转储中。\n        \u003c/p\u003e\u003c/div\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-PG_DUMP-VARLISTENTRY-17\"\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\u003cdd\u003e\u003cp\u003e\n        不转储任何匹配 \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e 的模式。该模式按照与 \u003ccode class=\"option\"\u003e-n\u003c/code\u003e 相同的规则解释。\u003ccode class=\"option\"\u003e-N\u003c/code\u003e\n        可以给出多次，以排除匹配所给模式中任意一个的模式。\n       \u003c/p\u003e\u003cp\u003e\n        当同时给出 \u003ccode class=\"option\"\u003e-n\u003c/code\u003e 和 \u003ccode class=\"option\"\u003e-N\u003c/code\u003e 时，其行为是只转储至少匹配一个 \u003ccode class=\"option\"\u003e-n\u003c/code\u003e 开关但不匹配任何\n        \u003ccode class=\"option\"\u003e-N\u003c/code\u003e 开关的模式。如果出现 \u003ccode class=\"option\"\u003e-N\u003c/code\u003e 而没有\n        \u003ccode class=\"option\"\u003e-n\u003c/code\u003e，那么匹配 \u003ccode class=\"option\"\u003e-N\u003c/code\u003e 的模式会从原本的正常转储中排除。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-PG_DUMP-VARLISTENTRY-18\"\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\u003cdd\u003e\u003cp\u003e\n        不输出用于把对象所有权设置成与原始数据库一致的命令。默认情况下，\u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e 会发出 \u003ccode class=\"command\"\u003eALTER OWNER\u003c/code\u003e\n        或 \u003ccode class=\"command\"\u003eSET SESSION AUTHORIZATION\u003c/code\u003e 语句来设置新建数据库对象的所有权。除非脚本由超级用户（或拥有脚本中所有对象的同一用户）启动，否则这些语句会在运行脚本时报错。若要创建一个可由任意用户恢复、并让该用户拥有所有对象的脚本，请指定 \u003ccode class=\"option\"\u003e-O\u003c/code\u003e。\n       \u003c/p\u003e\u003cp\u003e\n        当生成一个归档（非文本）输出文件时，此选项将被忽略。对于归档格式，可以在调用 \u003ccode class=\"command\"\u003epg_restore\u003c/code\u003e 时指定该选项。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-PG_DUMP-VARLISTENTRY-19\"\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\u003cdd\u003e\u003cp\u003e\n        这个选项已经过时，但仍然被接受以保持向后兼容性。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-PG_DUMP-VARLISTENTRY-20\"\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\u003cdd\u003e\u003cp\u003e\n        只转储对象定义（模式），不转储数据或统计信息。\n       \u003c/p\u003e\u003cp\u003e\n        此选项不能与 \u003ccode class=\"option\"\u003e--data-only\u003c/code\u003e 或\n        \u003ccode class=\"option\"\u003e--statistics-only\u003c/code\u003e 一起使用。它类似于指定\n        \u003ccode class=\"option\"\u003e--section=pre-data --section=post-data\u003c/code\u003e，但出于历史原因，两者并不完全相同。\n       \u003c/p\u003e\u003cp\u003e\n        （不要把它与 \u003ccode class=\"option\"\u003e--schema\u003c/code\u003e 选项混淆，后者中的\u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003eschema\u003c/span\u003e”\u003c/span\u003e一词含义不同。）\n       \u003c/p\u003e\u003cp\u003e\n        要只排除数据库中某些表的表数据，请参见\n        \u003ccode class=\"option\"\u003e--exclude-table-data\u003c/code\u003e。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-PG_DUMP-VARLISTENTRY-21\"\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\u003cdd\u003e\u003cp\u003e\n        指定在禁用触发器时要使用的超级用户名。这只在使用\n        \u003ccode class=\"option\"\u003e--disable-triggers\u003c/code\u003e 时相关。（通常最好省略它，而是以超级用户身份运行生成的脚本。）\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-PG_DUMP-VARLISTENTRY-22\"\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\u003cdd\u003e\u003cp\u003e\n        只转储名称匹配 \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e 的表。可以通过写多个 \u003ccode class=\"option\"\u003e-t\u003c/code\u003e 开关来选择多个表。\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e 参数按照\n        \u003cspan class=\"application\"\u003epsql\u003c/span\u003e 的 \u003ccode class=\"literal\"\u003e\\d\u003c/code\u003e 命令所使用的同样规则进行解释（见\u003ca class=\"xref\" href=\"/zh/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"模式\"\u003e模式\u003c/a\u003e），因此也可以通过在模式中使用通配符来选择多个表。使用通配符时，如有需要请小心为模式加引号，以防止 shell 展开通配符；见下文的\u003ca class=\"xref\" href=\"/zh/docs/18/app-pgdump.html#PG-DUMP-EXAMPLES\" title=\"示例\"\u003e示例\u003c/a\u003e。\n       \u003c/p\u003e\u003cp\u003e\n        除了表之外，此选项还可用于转储匹配的视图、物化视图、外部表和序列的定义。它不会转储视图或物化视图的内容，而外部表的内容只有在使用\n        \u003ccode class=\"option\"\u003e--include-foreign-data\u003c/code\u003e 指定了相应外部服务器时才会被转储。\n       \u003c/p\u003e\u003cp\u003e\n        使用 \u003ccode class=\"option\"\u003e-t\u003c/code\u003e 时，\u003ccode class=\"option\"\u003e-n\u003c/code\u003e 和 \u003ccode class=\"option\"\u003e-N\u003c/code\u003e\n        开关没有作用，因为由 \u003ccode class=\"option\"\u003e-t\u003c/code\u003e 选中的表无论这些开关如何设置都会被转储，而非表对象则不会被转储。\n       \u003c/p\u003e\u003cdiv class=\"note\"\u003e\u003ch3 class=\"title\"\u003e注意\u003c/h3\u003e\u003cp\u003e\n         当指定 \u003ccode class=\"option\"\u003e-t\u003c/code\u003e 时，\u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e\n         不会尝试转储所选表可能依赖的任何其他数据库对象。因此，不能保证特定表转储的结果能够单独成功恢复到一个干净的数据库中。\n        \u003c/p\u003e\u003c/div\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-PG_DUMP-VARLISTENTRY-23\"\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\u003cdd\u003e\u003cp\u003e\n        不转储任何匹配 \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e 的表。该模式按照与 \u003ccode class=\"option\"\u003e-t\u003c/code\u003e 相同的规则解释。\u003ccode class=\"option\"\u003e-T\u003c/code\u003e\n        可以给出多次，以排除匹配所给模式中任意一个的表。\n       \u003c/p\u003e\u003cp\u003e\n        当同时给出 \u003ccode class=\"option\"\u003e-t\u003c/code\u003e 和 \u003ccode class=\"option\"\u003e-T\u003c/code\u003e 时，其行为是只转储至少匹配一个 \u003ccode class=\"option\"\u003e-t\u003c/code\u003e 开关但不匹配任何\n        \u003ccode class=\"option\"\u003e-T\u003c/code\u003e 开关的表。如果出现 \u003ccode class=\"option\"\u003e-T\u003c/code\u003e 而没有\n        \u003ccode class=\"option\"\u003e-t\u003c/code\u003e，那么匹配 \u003ccode class=\"option\"\u003e-T\u003c/code\u003e 的表会从原本的正常转储中排除。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-PG_DUMP-VARLISTENTRY-24\"\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\u003cdd\u003e\u003cp\u003e\n        指定详细模式。这会使 \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e 将详细的对象注释、开始/停止时间写入转储文件，并把进度消息写到标准错误。重复该选项会让更多调试级别消息出现在标准错误中。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-PG_DUMP-VARLISTENTRY-25\"\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\u003cdd\u003e\u003cp\u003e\n       打印 \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e 的版本并退出。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-PG_DUMP-VARLISTENTRY-26\"\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\u003cdd\u003e\u003cp\u003e\n        不转储访问权限（grant/revoke 命令）。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-PG_DUMP-VARLISTENTRY-27\"\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\u003cdd\u003e\u003cp\u003e\n        指定要使用的压缩方法和/或压缩级别。压缩方法可以设置为\n        \u003ccode class=\"literal\"\u003egzip\u003c/code\u003e、\u003ccode class=\"literal\"\u003elz4\u003c/code\u003e、\u003ccode class=\"literal\"\u003ezstd\u003c/code\u003e\n        或 \u003ccode class=\"literal\"\u003enone\u003c/code\u003e（表示不压缩）。也可以选择指定压缩细节字符串。如果细节字符串是一个整数，则表示压缩级别；否则，它应是一个用逗号分隔的项列表，每项形如 \u003ccode class=\"literal\"\u003ekeyword\u003c/code\u003e 或\n        \u003ccode class=\"literal\"\u003ekeyword=value\u003c/code\u003e。目前支持的关键字是\n        \u003ccode class=\"literal\"\u003elevel\u003c/code\u003e 和 \u003ccode class=\"literal\"\u003elong\u003c/code\u003e。\n       \u003c/p\u003e\u003cp\u003e\n        如果未指定压缩级别，将使用默认压缩级别。如果只指定级别而未说明算法，当级别大于 \u003ccode class=\"literal\"\u003e0\u003c/code\u003e 时将使用 \u003ccode class=\"literal\"\u003egzip\u003c/code\u003e 压缩，当级别为 \u003ccode class=\"literal\"\u003e0\u003c/code\u003e 时则不使用压缩。\n       \u003c/p\u003e\u003cp\u003e\n        对于 custom 和 directory 归档格式，此选项指定对各个表数据段的压缩，默认是使用中等级别的 \u003ccode class=\"literal\"\u003egzip\u003c/code\u003e 进行压缩。对于纯文本输出，设置非零压缩级别会导致整个输出文件被压缩，就像它经过了\n        \u003cspan class=\"application\"\u003egzip\u003c/span\u003e、\u003cspan class=\"application\"\u003elz4\u003c/span\u003e 或\n        \u003cspan class=\"application\"\u003ezstd\u003c/span\u003e 一样；但默认是不压缩。使用 zstd 压缩时，\u003ccode class=\"literal\"\u003elong\u003c/code\u003e 模式可能提高压缩比，但代价是内存使用增加。\n       \u003c/p\u003e\u003cp\u003e\n        tar 归档格式目前完全不支持压缩。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-PG_DUMP-VARLISTENTRY-28\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--binary-upgrade\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        此选项供就地升级实用程序使用。不建议也不支持将其用于其他目的。该选项的行为可能在未来的版本中更改而不另行通知。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-PG_DUMP-VARLISTENTRY-29\"\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\u003cdd\u003e\u003cp\u003e\n        将数据转储为带有显式列名的 \u003ccode class=\"command\"\u003eINSERT\u003c/code\u003e 命令（\u003ccode class=\"literal\"\u003eINSERT INTO\n        \u003cem class=\"replaceable\"\u003e\u003ccode\u003etable\u003c/code\u003e\u003c/em\u003e\n        (\u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolumn\u003c/code\u003e\u003c/em\u003e, ...) VALUES\n        ...\u003c/code\u003e）。这会使恢复变得非常缓慢；它主要用于生成可装入非 \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e 数据库的转储文件。恢复期间发生的任何错误都只会导致有问题的 \u003ccode class=\"command\"\u003eINSERT\u003c/code\u003e 所包含的行丢失，而不会导致整个表内容丢失。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-PG_DUMP-VARLISTENTRY-30\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--disable-dollar-quoting\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        此选项禁用对函数体的美元引用，并强制用 SQL 标准字符串语法对它们加引号。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-PG_DUMP-VARLISTENTRY-31\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--disable-triggers\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        此选项只在创建包含数据但不包含模式的转储时才相关。它指示\n        \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e 在输出中包含一些命令，以便在恢复数据时临时禁用目标表上的触发器。如果这些表上存在不希望在数据恢复期间触发的引用完整性检查或其他触发器，请使用此选项。\n       \u003c/p\u003e\u003cp\u003e\n        目前，为 \u003ccode class=\"option\"\u003e--disable-triggers\u003c/code\u003e 输出的这些命令必须由超级用户执行。因此，还应通过 \u003ccode class=\"option\"\u003e-S\u003c/code\u003e 指定一个超级用户名，或者更好的做法是谨慎地以超级用户身份运行生成的脚本。\n       \u003c/p\u003e\u003cp\u003e\n        当生成一个归档（非文本）输出文件时，此选项将被忽略。对于归档格式，可以在调用 \u003ccode class=\"command\"\u003epg_restore\u003c/code\u003e 时指定该选项。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-PG_DUMP-VARLISTENTRY-32\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--enable-row-security\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        此选项只在转储启用了行安全的表内容时才相关。默认情况下，\u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e 会将 \u003ca class=\"xref\" href=\"/zh/docs/18/runtime-config-client.html#GUC-ROW-SECURITY\"\u003erow_security\u003c/a\u003e 设置为 off，以确保把表中的所有数据都转储出来。如果用户没有足够的权限绕过行安全，则会抛出错误。该参数会指示 \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e\n        改为将 \u003ca class=\"xref\" href=\"/zh/docs/18/runtime-config-client.html#GUC-ROW-SECURITY\"\u003erow_security\u003c/a\u003e 设置为 on，从而允许用户只转储其有权访问的那部分表内容。\n       \u003c/p\u003e\u003cp\u003e\n        请注意，如果当前使用此选项，通常还会希望让转储采用\n        \u003ccode class=\"command\"\u003eINSERT\u003c/code\u003e 格式，因为恢复期间的\n        \u003ccode class=\"command\"\u003eCOPY FROM\u003c/code\u003e 不支持行安全。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-PG_DUMP-VARLISTENTRY-33\"\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\u003cdd\u003e\u003cp\u003e\n        不转储任何匹配 \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e 的扩展。该模式按照与 \u003ccode class=\"option\"\u003e-e\u003c/code\u003e 相同的规则解释。\u003ccode class=\"option\"\u003e--exclude-extension\u003c/code\u003e 可以给出多次，以排除匹配所给模式中任意一个的扩展。\n       \u003c/p\u003e\u003cp\u003e\n        当同时给出 \u003ccode class=\"option\"\u003e-e\u003c/code\u003e 和 \u003ccode class=\"option\"\u003e--exclude-extension\u003c/code\u003e 时，其行为是只转储至少匹配一个 \u003ccode class=\"option\"\u003e-e\u003c/code\u003e 开关、但不匹配任何\n        \u003ccode class=\"option\"\u003e--exclude-extension\u003c/code\u003e 开关的扩展。如果\n        \u003ccode class=\"option\"\u003e--exclude-extension\u003c/code\u003e 在没有 \u003ccode class=\"option\"\u003e-e\u003c/code\u003e 的情况下出现，那么匹配 \u003ccode class=\"option\"\u003e--exclude-extension\u003c/code\u003e 的扩展会从原本的正常转储中排除。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-PG_DUMP-VARLISTENTRY-34\"\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\u003cdd\u003e\u003cp\u003e\n        这与 \u003ccode class=\"option\"\u003e-T\u003c/code\u003e/\u003ccode class=\"option\"\u003e--exclude-table\u003c/code\u003e 选项相同，只是它还会排除匹配 \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\n        的表的任何分区或继承子表。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-PG_DUMP-VARLISTENTRY-35\"\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\u003cdd\u003e\u003cp\u003e\n        不转储任何匹配 \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e 的表的数据。该模式按照与 \u003ccode class=\"option\"\u003e-t\u003c/code\u003e 相同的规则解释。\u003ccode class=\"option\"\u003e--exclude-table-data\u003c/code\u003e 可以给出多次，以排除匹配所给模式中任意一个的表。当需要某个特定表的定义、但不需要其中数据时，此选项很有用。\n       \u003c/p\u003e\u003cp\u003e\n        若要排除数据库中所有表的数据，请参见 \u003ccode class=\"option\"\u003e--schema-only\u003c/code\u003e 或\n        \u003ccode class=\"option\"\u003e--statistics-only\u003c/code\u003e。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-PG_DUMP-VARLISTENTRY-36\"\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\u003cdd\u003e\u003cp\u003e\n        这与 \u003ccode class=\"option\"\u003e--exclude-table-data\u003c/code\u003e 选项相同，只是它还会排除匹配 \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e 的表的任何分区或继承子表的数据。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-PG_DUMP-VARLISTENTRY-37\"\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\u003cdd\u003e\u003cp\u003e\n        在转储浮点数据时，使用指定的 \u003ccode class=\"option\"\u003eextra_float_digits\u003c/code\u003e 值，而不是最大可用精度。出于备份目的的常规转储不应使用此选项。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-PG_DUMP-VARLISTENTRY-38\"\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\u003cdd\u003e\u003cp\u003e\n        指定一个文件名，从中读取要在转储中包含或排除的对象匹配模式。模式按照对应选项的同样规则解释：对于表，使用\n        \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 和\n        \u003ccode class=\"option\"\u003e--exclude-table-and-children\u003c/code\u003e 的规则；对于模式，使用\n        \u003ccode class=\"option\"\u003e-n\u003c/code\u003e/\u003ccode class=\"option\"\u003e--schema\u003c/code\u003e 和\n        \u003ccode class=\"option\"\u003e-N\u003c/code\u003e/\u003ccode class=\"option\"\u003e--exclude-schema\u003c/code\u003e 的规则；对于外部服务器上的数据，使用 \u003ccode class=\"option\"\u003e--include-foreign-data\u003c/code\u003e 的规则；对于表数据，使用 \u003ccode class=\"option\"\u003e--exclude-table-data\u003c/code\u003e 和\n        \u003ccode class=\"option\"\u003e--exclude-table-data-and-children\u003c/code\u003e 的规则；对于扩展，使用 \u003ccode class=\"option\"\u003e-e\u003c/code\u003e/\u003ccode class=\"option\"\u003e--extension\u003c/code\u003e 和\n        \u003ccode class=\"option\"\u003e--exclude-extension\u003c/code\u003e 的规则。若要从 \u003ccode class=\"literal\"\u003eSTDIN\u003c/code\u003e\n        读取，请使用 \u003ccode class=\"filename\"\u003e-\u003c/code\u003e 作为文件名。\u003ccode class=\"option\"\u003e--filter\u003c/code\u003e 选项可以与上述包含或排除对象的选项一起使用，也可以为多个过滤文件指定多次。\n       \u003c/p\u003e\u003cp\u003e\n        文件每行列出一个对象匹配模式，格式如下：\n\u003c/p\u003e\u003cpre class=\"synopsis\"\u003e\n{ 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\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n        第一个关键字指定是包含还是排除与模式匹配的对象。第二个关键字指定要用该模式过滤的对象类型：\n        \u003c/p\u003e\u003cdiv class=\"itemizedlist\"\u003e\u003cul class=\"itemizedlist\" style=\"list-style-type: disc; \"\u003e\u003cli class=\"listitem\"\u003e\u003cp\u003e\n\u003ccode class=\"literal\"\u003eextension\u003c/code\u003e：扩展。作用类似\n           \u003ccode class=\"option\"\u003e-e\u003c/code\u003e/\u003ccode class=\"option\"\u003e--extension\u003c/code\u003e 或\n           \u003ccode class=\"option\"\u003e--exclude-extension\u003c/code\u003e 选项。\n          \u003c/p\u003e\u003c/li\u003e\u003cli class=\"listitem\"\u003e\u003cp\u003e\n\u003ccode class=\"literal\"\u003eforeign_data\u003c/code\u003e：外部服务器上的数据。作用类似\n           \u003ccode class=\"option\"\u003e--include-foreign-data\u003c/code\u003e 选项。这个关键字只能与\n           \u003ccode class=\"literal\"\u003einclude\u003c/code\u003e 关键字一起使用。\n          \u003c/p\u003e\u003c/li\u003e\u003cli class=\"listitem\"\u003e\u003cp\u003e\n\u003ccode class=\"literal\"\u003etable\u003c/code\u003e：表。作用类似\n           \u003ccode class=\"option\"\u003e-t\u003c/code\u003e/\u003ccode class=\"option\"\u003e--table\u003c/code\u003e 或\n           \u003ccode class=\"option\"\u003e-T\u003c/code\u003e/\u003ccode class=\"option\"\u003e--exclude-table\u003c/code\u003e 选项。\n          \u003c/p\u003e\u003c/li\u003e\u003cli class=\"listitem\"\u003e\u003cp\u003e\n\u003ccode class=\"literal\"\u003etable_and_children\u003c/code\u003e：表，以及其任何分区或继承子表。作用类似 \u003ccode class=\"option\"\u003e--table-and-children\u003c/code\u003e 或\n           \u003ccode class=\"option\"\u003e--exclude-table-and-children\u003c/code\u003e 选项。\n          \u003c/p\u003e\u003c/li\u003e\u003cli class=\"listitem\"\u003e\u003cp\u003e\n\u003ccode class=\"literal\"\u003etable_data\u003c/code\u003e：任何匹配 \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\n           的表的数据。作用类似 \u003ccode class=\"option\"\u003e--exclude-table-data\u003c/code\u003e 选项。这个关键字只能与 \u003ccode class=\"literal\"\u003eexclude\u003c/code\u003e 关键字一起使用。\n          \u003c/p\u003e\u003c/li\u003e\u003cli class=\"listitem\"\u003e\u003cp\u003e\n\u003ccode class=\"literal\"\u003etable_data_and_children\u003c/code\u003e：任何匹配\n           \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e 的表的数据，以及这些表的任何分区或继承子表的数据。作用类似\n           \u003ccode class=\"option\"\u003e--exclude-table-data-and-children\u003c/code\u003e 选项。这个关键字只能与\n           \u003ccode class=\"literal\"\u003eexclude\u003c/code\u003e 关键字一起使用。\n          \u003c/p\u003e\u003c/li\u003e\u003cli class=\"listitem\"\u003e\u003cp\u003e\n\u003ccode class=\"literal\"\u003eschema\u003c/code\u003e：模式。作用类似\n           \u003ccode class=\"option\"\u003e-n\u003c/code\u003e/\u003ccode class=\"option\"\u003e--schema\u003c/code\u003e 或\n           \u003ccode class=\"option\"\u003e-N\u003c/code\u003e/\u003ccode class=\"option\"\u003e--exclude-schema\u003c/code\u003e 选项。\n          \u003c/p\u003e\u003c/li\u003e\u003c/ul\u003e\u003c/div\u003e\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n        以 \u003ccode class=\"literal\"\u003e#\u003c/code\u003e 开头的行被视为注释并忽略。注释也可以放在对象匹配模式行之后。空白行同样会被忽略。有关如何在匹配模式中加引号，请参见\u003ca class=\"xref\" href=\"/zh/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"模式\"\u003e模式\u003c/a\u003e。\n       \u003c/p\u003e\u003cp\u003e\n        示例文件见下文的\u003ca class=\"xref\" href=\"/zh/docs/18/app-pgdump.html#PG-DUMP-EXAMPLES\" title=\"示例\"\u003e示例\u003c/a\u003e一节。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-PG_DUMP-VARLISTENTRY-39\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--if-exists\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        使用 \u003ccode class=\"literal\"\u003eDROP ... IF EXISTS\u003c/code\u003e 命令在\n        \u003ccode class=\"option\"\u003e--clean\u003c/code\u003e 模式下删除对象。这会抑制原本可能报告的\u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003edoes not exist\u003c/span\u003e”\u003c/span\u003e错误信息。除非同时指定了 \u003ccode class=\"option\"\u003e--clean\u003c/code\u003e，否则此选项无效。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-PG_DUMP-VARLISTENTRY-40\"\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\u003cdd\u003e\u003cp\u003e\n        转储任何外部表的数据，只要其外部服务器匹配\n        \u003cem class=\"replaceable\"\u003e\u003ccode\u003eforeignserver\u003c/code\u003e\u003c/em\u003e 模式。可以通过写多个 \u003ccode class=\"option\"\u003e--include-foreign-data\u003c/code\u003e 开关来选择多个外部服务器。此外，\u003cem class=\"replaceable\"\u003e\u003ccode\u003eforeignserver\u003c/code\u003e\u003c/em\u003e\n        参数按照 \u003cspan class=\"application\"\u003epsql\u003c/span\u003e 的 \u003ccode class=\"literal\"\u003e\\d\u003c/code\u003e 命令所使用的同样规则进行解释（见\u003ca class=\"xref\" href=\"/zh/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"模式\"\u003e模式\u003c/a\u003e），因此也可以通过在模式中使用通配符来选择多个外部服务器。使用通配符时，如有需要请小心为模式加引号，以防止 shell 展开通配符；见下文的\u003ca class=\"xref\" href=\"/zh/docs/18/app-pgdump.html#PG-DUMP-EXAMPLES\" title=\"示例\"\u003e示例\u003c/a\u003e。唯一的例外是不允许空模式。\n       \u003c/p\u003e\u003cdiv class=\"note\"\u003e\u003ch3 class=\"title\"\u003e注意\u003c/h3\u003e\u003cp\u003e\n         在 \u003ccode class=\"option\"\u003e--include-foreign-data\u003c/code\u003e 中使用通配符，可能导致访问到意料之外的外部服务器。另外，为了安全地使用此选项，请确保所命名服务器的所有者是可信的。\n        \u003c/p\u003e\u003c/div\u003e\u003cdiv class=\"note\"\u003e\u003ch3 class=\"title\"\u003e注意\u003c/h3\u003e\u003cp\u003e\n         指定 \u003ccode class=\"option\"\u003e--include-foreign-data\u003c/code\u003e 时，\u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e 不会检查外部表是否可写。因此，不能保证外部表转储的结果一定能够成功恢复。\n        \u003c/p\u003e\u003c/div\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-PG_DUMP-VARLISTENTRY-41\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--inserts\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        把数据转储为 \u003ccode class=\"command\"\u003eINSERT\u003c/code\u003e 命令（而不是\n        \u003ccode class=\"command\"\u003eCOPY\u003c/code\u003e）。这会使恢复非常缓慢；它主要用于生成可装入非 \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e 数据库的转储。恢复期间发生的任何错误都只会导致有问题的 \u003ccode class=\"command\"\u003eINSERT\u003c/code\u003e 所包含的行丢失，而不会导致整个表内容丢失。注意，如果重新安排了列顺序，恢复可能会彻底失败。\u003ccode class=\"option\"\u003e--column-inserts\u003c/code\u003e 选项可以避免列顺序变化带来的问题，但速度更慢。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-PG_DUMP-VARLISTENTRY-42\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--load-via-partition-root\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        当为表分区转储数据时，让 \u003ccode class=\"command\"\u003eCOPY\u003c/code\u003e 或\n        \u003ccode class=\"command\"\u003eINSERT\u003c/code\u003e 语句以包含该分区的分区层次结构根为目标，而不是以该分区本身为目标。这会导致在加载数据时为每一行重新确定适当的分区。当在另一台服务器上恢复数据，而行并不总是落在与原始服务器相同的分区中时，这可能很有用。例如，如果分区列是 text 类型，而两个系统对用于排序该分区列的排序规则定义不同，就可能发生这种情况。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-PG_DUMP-VARLISTENTRY-43\"\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\u003cdd\u003e\u003cp\u003e\n        在转储开始时，不要无限等待获取共享表锁。如果无法在指定的\n        \u003cem class=\"replaceable\"\u003e\u003ccode\u003etimeout\u003c/code\u003e\u003c/em\u003e 内锁定某个表，就让转储失败。超时可以用 \u003ccode class=\"command\"\u003eSET statement_timeout\u003c/code\u003e 接受的任意格式指定。（允许的格式因被转储源服务器的版本而异，但所有版本都接受以毫秒为单位的整数。）\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-PG_DUMP-VARLISTENTRY-44\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-comments\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        不要转储 \u003ccode class=\"command\"\u003eCOMMENT\u003c/code\u003e 命令。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-PG_DUMP-VARLISTENTRY-45\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-data\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        不要转储数据。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-PG_DUMP-VARLISTENTRY-46\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-policies\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        不要转储行安全性策略。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-PG_DUMP-VARLISTENTRY-47\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-publications\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        不要转储发布。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-PG_DUMP-VARLISTENTRY-48\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-schema\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        不要转储模式（数据定义）。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-PG_DUMP-VARLISTENTRY-49\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-security-labels\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        不要转储安全标签。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-PG_DUMP-VARLISTENTRY-50\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-statistics\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        不要转储统计信息。这是默认行为。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-PG_DUMP-VARLISTENTRY-51\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-subscriptions\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        不要转储订阅。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-PG_DUMP-VARLISTENTRY-52\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-sync\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        默认情况下，\u003ccode class=\"command\"\u003epg_dump\u003c/code\u003e 会等待所有文件都被安全写入磁盘。该选项会使 \u003ccode class=\"command\"\u003epg_dump\u003c/code\u003e 立即返回而不等待，这样更快，但意味着随后如果操作系统崩溃，转储可能会损坏。通常，此选项适用于测试，但不应在从生产安装转储数据时使用。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-PG_DUMP-VARLISTENTRY-53\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-table-access-method\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        不输出用于选择表访问方法的命令。使用此选项时，所有对象在恢复时都会使用当时默认的表访问方法创建。\n       \u003c/p\u003e\u003cp\u003e\n        当生成一个归档（非文本）输出文件时，此选项将被忽略。对于归档格式，可以在调用 \u003ccode class=\"command\"\u003epg_restore\u003c/code\u003e 时指定该选项。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-PG_DUMP-VARLISTENTRY-54\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-tablespaces\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        不输出用于选择表空间的命令。使用此选项时，所有对象在恢复时都会创建在当时默认的表空间中。\n       \u003c/p\u003e\u003cp\u003e\n        当生成一个归档（非文本）输出文件时，此选项将被忽略。对于归档格式，可以在调用 \u003ccode class=\"command\"\u003epg_restore\u003c/code\u003e 时指定该选项。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-PG_DUMP-VARLISTENTRY-55\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-toast-compression\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        不输出用于设置 \u003cacronym class=\"acronym\"\u003eTOAST\u003c/acronym\u003e 压缩方法的命令。使用此选项时，所有列都会以默认压缩设置恢复。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-PG_DUMP-VARLISTENTRY-56\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-unlogged-table-data\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        不要转储不记录 WAL 的表和序列的内容。此选项不会影响是否转储表和序列的定义（模式）；它只会抑制表和序列数据的转储。从备库转储时，不记录 WAL 的表和序列中的数据始终会被排除。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-PG_DUMP-VARLISTENTRY-57\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--on-conflict-do-nothing\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        添加 \u003ccode class=\"literal\"\u003eON CONFLICT DO NOTHING\u003c/code\u003e 到\n        \u003ccode class=\"command\"\u003eINSERT\u003c/code\u003e 命令中。除非同时指定了\n        \u003ccode class=\"option\"\u003e--inserts\u003c/code\u003e、\u003ccode class=\"option\"\u003e--column-inserts\u003c/code\u003e 或\n        \u003ccode class=\"option\"\u003e--rows-per-insert\u003c/code\u003e，否则此选项无效。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-PG_DUMP-VARLISTENTRY-58\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--quote-all-identifiers\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        强制为所有标识符加引号。当从某个服务器转储数据库，而该服务器的\n        \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e 主版本与\n        \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e 不同，或者输出打算装入另一主版本的服务器时，推荐使用此选项。默认情况下，\u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e 只会为在其自身主版本中属于保留字的标识符加引号。这有时会在处理其他版本服务器时导致兼容性问题，因为这些版本的保留字集合可能略有不同。使用 \u003ccode class=\"option\"\u003e--quote-all-identifiers\u003c/code\u003e\n        可以防止此类问题，但代价是转储脚本更难阅读。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-PG_DUMP-VARLISTENTRY-59\"\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\u003cdd\u003e\u003cp\u003e\n        在转储输出中，把给定字符串用作 \u003cspan class=\"application\"\u003epsql\u003c/span\u003e 的\n        \u003ccode class=\"command\"\u003e\\restrict\u003c/code\u003e 键。若未指定该键，\u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e 会按需要随机生成一个。键只能包含字母数字字符。\n       \u003c/p\u003e\u003cp\u003e\n        此选项主要用于测试以及其他需要可重复输出的场景（例如比较转储文件）。一般不建议使用它，因为若恶意服务器事先知道该键，可能能够注入任意代码，并在运行 \u003cspan class=\"application\"\u003epsql\u003c/span\u003e 处理转储输出的机器上执行。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-PG_DUMP-VARLISTENTRY-60\"\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\u003cdd\u003e\u003cp\u003e\n        将数据转储为 \u003ccode class=\"command\"\u003eINSERT\u003c/code\u003e 命令（而不是\n        \u003ccode class=\"command\"\u003eCOPY\u003c/code\u003e）。它控制每个 \u003ccode class=\"command\"\u003eINSERT\u003c/code\u003e 命令的最大行数。指定的值必须是大于零的数字。恢复过程中的任何错误将导致只有属于有问题的 \u003ccode class=\"command\"\u003eINSERT\u003c/code\u003e 的行丢失，而不是整个表的内容。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-PG_DUMP-VARLISTENTRY-61\"\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\u003cdd\u003e\u003cp\u003e\n          仅转储指定的部分。部分名称可以是\n          \u003ccode class=\"option\"\u003epre-data\u003c/code\u003e、\u003ccode class=\"option\"\u003edata\u003c/code\u003e 或 \u003ccode class=\"option\"\u003epost-data\u003c/code\u003e。可以多次指定此选项以选择多个部分。默认情况下是转储所有部分。\n         \u003c/p\u003e\u003cp\u003e\n          数据部分包含实际的表数据、大对象内容、序列值，以及表、物化视图和外部表的统计信息。post-data 部分包括索引、触发器、规则、索引统计信息，以及除已验证的检查约束和非空约束之外的其他约束定义。pre-data 部分包括所有其他数据定义项。\n         \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-PG_DUMP-VARLISTENTRY-62\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--sequence-data\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        在转储中包含序列数据。除非指定了 \u003ccode class=\"option\"\u003e--no-data\u003c/code\u003e、\u003ccode class=\"option\"\u003e--schema-only\u003c/code\u003e 或 \u003ccode class=\"option\"\u003e--statistics-only\u003c/code\u003e，否则这是默认行为。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-PG_DUMP-VARLISTENTRY-63\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--serializable-deferrable\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        使用 \u003ccode class=\"literal\"\u003eserializable\u003c/code\u003e 事务来执行转储，以确保所用快照与后续数据库状态一致；但这是通过等待事务流到达一个不会出现异常的时点来实现的，从而避免转储失败或导致其他事务因\n        \u003ccode class=\"literal\"\u003eserialization_failure\u003c/code\u003e 而回滚。有关事务隔离和并发控制的更多信息，请参见\u003ca class=\"xref\" href=\"/zh/docs/18/mvcc.html\" title=\"第 13 章 并发控制\"\u003e第 13 章\u003c/a\u003e。\n       \u003c/p\u003e\u003cp\u003e\n        这个选项对于仅用于灾难恢复的转储没有好处。但对于用来加载数据库副本，以供报表或其他只读负载共享，而原始数据库继续更新的转储，它可能有用。如果不使用它，转储可能反映出一种与最终提交事务的任何串行执行都不一致的状态。例如，如果使用批处理技术，转储中可能显示某个批次已经关闭，但批次中的全部条目却并未出现。\n       \u003c/p\u003e\u003cp\u003e\n        如果在启动 pg_dump 时没有活动的读写事务，此选项不会带来任何差别。如果存在活动的读写事务，转储开始时间可能会被延迟一个不确定的时长。一旦开始运行，使用或不使用该开关的性能都是相同的。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-PG_DUMP-VARLISTENTRY-64\"\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\u003cdd\u003e\u003cp\u003e\n          在制作数据库转储时，使用指定的同步快照（详见\u003ca class=\"xref\" href=\"/zh/docs/18/functions-admin.html#FUNCTIONS-SNAPSHOT-SYNCHRONIZATION-TABLE\" title=\"表 9.100. 快照同步函数\"\u003e表 9.100\u003c/a\u003e）。\n         \u003c/p\u003e\u003cp\u003e\n          当需要将转储与逻辑复制槽（参见\u003ca class=\"xref\" href=\"/zh/docs/18/logicaldecoding.html\" title=\"第 47 章 逻辑解码\"\u003e第 47 章\u003c/a\u003e）或与并发会话同步时，此选项很有用。\n         \u003c/p\u003e\u003cp\u003e\n          在并行转储的情况下，将使用此选项定义的快照名称，而不是重新获取一个新快照。\n         \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-PG_DUMP-VARLISTENTRY-65\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--statistics\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        转储优化器统计信息。\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-PG_DUMP-VARLISTENTRY-66\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--statistics-only\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        只转储统计信息，不转储模式（数据定义）或数据。会转储表、物化视图、外部表和索引的优化器统计信息。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-PG_DUMP-VARLISTENTRY-67\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--strict-names\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        要求每个扩展（\u003ccode class=\"option\"\u003e-e\u003c/code\u003e/\u003ccode class=\"option\"\u003e--extension\u003c/code\u003e）、模式（\u003ccode class=\"option\"\u003e-n\u003c/code\u003e/\u003ccode class=\"option\"\u003e--schema\u003c/code\u003e）和表（\u003ccode class=\"option\"\u003e-t\u003c/code\u003e/\u003ccode class=\"option\"\u003e--table\u003c/code\u003e）模式在要转储的数据库中至少匹配一个扩展/模式/表。这也适用于配合 \u003ccode class=\"option\"\u003e--filter\u003c/code\u003e 使用的过滤器。请注意，如果所有扩展/模式/表模式都找不到匹配项，那么\n        \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e 即使在不使用\n        \u003ccode class=\"option\"\u003e--strict-names\u003c/code\u003e 的情况下也会报错。\n       \u003c/p\u003e\u003cp\u003e\n        此选项对 \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 或\n        \u003ccode class=\"option\"\u003e--exclude-table-data\u003c/code\u003e 没有效果。未匹配任何对象的排除模式不会被视为错误。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-PG_DUMP-VARLISTENTRY-68\"\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\u003cdd\u003e\u003cp\u003e\n        当设为 \u003ccode class=\"literal\"\u003efsync\u003c/code\u003e 时（这是默认值），\u003ccode class=\"command\"\u003epg_dump --format=directory\u003c/code\u003e 会递归打开并同步归档目录中的所有文件。\n       \u003c/p\u003e\u003cp\u003e\n        在 Linux 上，也可以改用 \u003ccode class=\"literal\"\u003esyncfs\u003c/code\u003e，让操作系统同步包含归档目录的整个文件系统。关于需要注意的问题，请参见 \u003ca class=\"xref\" href=\"/zh/docs/18/runtime-config-error-handling.html#GUC-RECOVERY-INIT-SYNC-METHOD\"\u003erecovery_init_sync_method\u003c/a\u003e 中有关使用\n        \u003ccode class=\"literal\"\u003esyncfs\u003c/code\u003e 的信息。\n       \u003c/p\u003e\u003cp\u003e\n        当使用 \u003ccode class=\"option\"\u003e--no-sync\u003c/code\u003e，或 \u003ccode class=\"option\"\u003e--format\u003c/code\u003e 未设为\n        \u003ccode class=\"literal\"\u003edirectory\u003c/code\u003e 时，此选项没有效果。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-PG_DUMP-VARLISTENTRY-69\"\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\u003cdd\u003e\u003cp\u003e\n        这与 \u003ccode class=\"option\"\u003e-t\u003c/code\u003e/\u003ccode class=\"option\"\u003e--table\u003c/code\u003e 选项相同，只是它还会包含匹配 \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e 的表的任何分区或继承子表。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-PG_DUMP-VARLISTENTRY-70\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--use-set-session-authorization\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        输出符合 SQL 标准的 \u003ccode class=\"command\"\u003eSET SESSION AUTHORIZATION\u003c/code\u003e 命令，而不是 \u003ccode class=\"command\"\u003eALTER OWNER\u003c/code\u003e 命令来确定对象所有权。这会让转储更符合标准，但根据转储中对象的历史，可能无法正确恢复。另外，使用\n        \u003ccode class=\"command\"\u003eSET SESSION AUTHORIZATION\u003c/code\u003e 的转储肯定需要超级用户权限才能正确恢复，而 \u003ccode class=\"command\"\u003eALTER OWNER\u003c/code\u003e 只需较低权限。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-PG_DUMP-VARLISTENTRY-71\"\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\u003cdd\u003e\u003cp\u003e\n       显示关于 \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e 命令行参数的帮助信息，并退出。\n       \u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n    以下命令行选项控制数据库连接参数。\n\n    \u003c/p\u003e\u003cdiv class=\"variablelist\"\u003e\u003cdl class=\"variablelist\"\u003e\u003cdt id=\"ZH18-AUTO-PG_DUMP-VARLISTENTRY-72\"\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\u003cdd\u003e\u003cp\u003e\n       指定要连接的数据库名称。这等价于在命令行上把\n       \u003cem class=\"replaceable\"\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e 作为第一个非选项参数指定。\u003cem class=\"replaceable\"\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e 可以是\u003ca class=\"link\" href=\"/zh/docs/18/libpq-connect.html#LIBPQ-CONNSTRING\" title=\"32.1.1. 连接字符串\"\u003e连接字符串\u003c/a\u003e。如果是这样，连接字符串中的参数将覆盖任何冲突的命令行选项。\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-PG_DUMP-VARLISTENTRY-73\"\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\u003cdd\u003e\u003cp\u003e\n        指定服务器所在机器的主机名。如果值以斜杠开头，则被用作 Unix 域套接字的目录。默认值取自 \u003ccode class=\"envar\"\u003ePGHOST\u003c/code\u003e 环境变量（如果已设置），否则尝试使用 Unix 域套接字连接。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-PG_DUMP-VARLISTENTRY-74\"\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\u003cdd\u003e\u003cp\u003e\n        指定服务器正在监听连接的 TCP 端口，或本地 Unix 域套接字文件扩展名。默认值取自 \u003ccode class=\"envar\"\u003ePGPORT\u003c/code\u003e 环境变量（如果已设置），否则使用编译时默认值。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-PG_DUMP-VARLISTENTRY-75\"\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\u003cdd\u003e\u003cp\u003e\n        用于连接的用户名。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-PG_DUMP-VARLISTENTRY-76\"\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\u003cdd\u003e\u003cp\u003e\n        绝不发出密码提示。如果服务器要求密码认证，而又无法通过\n        \u003ccode class=\"filename\"\u003e.pgpass\u003c/code\u003e 文件等其他方式获得密码，则连接尝试将失败。在没有用户在场输入密码的批处理作业和脚本中，此选项很有用。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-PG_DUMP-VARLISTENTRY-77\"\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\u003cdd\u003e\u003cp\u003e\n        强制 \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e 在连接数据库之前提示输入密码。\n       \u003c/p\u003e\u003cp\u003e\n        这个选项绝非必需，因为如果服务器要求密码认证，\u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e 会自动提示输入密码。不过，\u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e 会先浪费一次连接尝试来发现服务器需要密码。在某些情况下值得输入 \u003ccode class=\"option\"\u003e-W\u003c/code\u003e，因为可以避免这次额外的连接尝试。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-PG_DUMP-VARLISTENTRY-78\"\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\u003cdd\u003e\u003cp\u003e\n        指定用于创建转储的角色名称。此选项会让\n        \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e 在连接数据库后发出\n        \u003ccode class=\"command\"\u003eSET ROLE\u003c/code\u003e \u003cem class=\"replaceable\"\u003e\u003ccode\u003erolename\u003c/code\u003e\u003c/em\u003e\n        命令。当已认证用户（由 \u003ccode class=\"option\"\u003e-U\u003c/code\u003e 指定）缺少\n        \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e 所需权限，但可以切换到具有所需权限的角色时，此选项很有用。有些安装环境有禁止直接以超级用户登录的策略，使用此选项就可以在不违反该策略的情况下进行转储。\n       \u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e\u003cp\u003e\n\u003c/p\u003e\u003c/div\u003e\u003cdiv class=\"refsect1\" id=\"id-1.9.4.14.7\"\u003e\u003ch2\u003e环境\u003c/h2\u003e\u003cdiv class=\"variablelist\"\u003e\u003cdl class=\"variablelist\"\u003e\u003cdt id=\"ZH18-AUTO-PG_DUMP-VARLISTENTRY-79\"\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\u003cdd\u003e\u003cp\u003e\n      默认连接参数。\n     \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-PG_DUMP-VARLISTENTRY-80\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003ePG_COLOR\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      指定诊断消息是否使用颜色。可选值为\n      \u003ccode class=\"literal\"\u003ealways\u003c/code\u003e、\u003ccode class=\"literal\"\u003eauto\u003c/code\u003e 和\n      \u003ccode class=\"literal\"\u003enever\u003c/code\u003e。\n     \u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e\u003cp\u003e\n   与大多数其他 \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e 工具一样，此工具也使用\n   \u003cspan class=\"application\"\u003elibpq\u003c/span\u003e 支持的环境变量（见\u003ca class=\"xref\" href=\"/zh/docs/18/libpq-envars.html\" title=\"32.15. 环境变量\"\u003e第 32.15 节\u003c/a\u003e）。\n  \u003c/p\u003e\u003c/div\u003e\u003cdiv class=\"refsect1\" id=\"APP-PGDUMP-DIAGNOSTICS\"\u003e\u003ch2\u003e诊断\u003c/h2\u003e\u003cp\u003e\n\u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e 在内部执行 \u003ccode class=\"command\"\u003eSELECT\u003c/code\u003e\n   语句。如果运行 \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e 时遇到问题，请确认能够例如使用 \u003ca class=\"xref\" href=\"/zh/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 从数据库中查询信息。此外，\u003cspan class=\"application\"\u003elibpq\u003c/span\u003e 前端库所使用的任何默认连接设置和环境变量也都会生效。\n  \u003c/p\u003e\u003cp\u003e\n\u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e 的数据库活动通常会被累积统计系统收集。如果不希望如此，可以将参数 \u003ccode class=\"varname\"\u003etrack_counts\u003c/code\u003e 通过\n   \u003ccode class=\"envar\"\u003ePGOPTIONS\u003c/code\u003e 或 \u003ccode class=\"literal\"\u003eALTER USER\u003c/code\u003e 命令设置为\n   false。\n  \u003c/p\u003e\u003c/div\u003e\u003cdiv class=\"refsect1\" id=\"PG-DUMP-NOTES\"\u003e\u003ch2\u003e注解\u003c/h2\u003e\u003cp\u003e\n   如果数据库集簇在 \u003ccode class=\"literal\"\u003etemplate1\u003c/code\u003e 数据库中有任何本地添加的内容，要小心把 \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e 的输出恢复到一个真正空的数据库中；否则很可能因为这些新增对象的重复定义而报错。要创建一个不含任何本地添加的空数据库，应从 \u003ccode class=\"literal\"\u003etemplate0\u003c/code\u003e 而不是\n   \u003ccode class=\"literal\"\u003etemplate1\u003c/code\u003e 复制，例如：\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003e\nCREATE DATABASE foo WITH TEMPLATE template0;\n\u003c/pre\u003e\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n   当选择不包含模式的转储并使用 \u003ccode class=\"option\"\u003e--disable-triggers\u003c/code\u003e 选项时，\u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e 会在插入数据前发出命令禁用用户表上的触发器，并在数据插入完成后发出命令重新启用它们。如果恢复在中途停止，系统目录可能会保持在错误状态。\n  \u003c/p\u003e\u003cp\u003e\n   当指定 \u003ccode class=\"option\"\u003e--statistics\u003c/code\u003e 时，\u003ccode class=\"command\"\u003epg_dump\u003c/code\u003e 会在生成的转储文件中包含大多数优化器统计信息。但这并不包括所有统计信息，例如通过 \u003ca class=\"xref\" href=\"/zh/docs/18/sql-createstatistics.html\" title=\"CREATE STATISTICS\"\u003e\u003cspan class=\"refentrytitle\"\u003eCREATE STATISTICS\u003c/span\u003e\u003c/a\u003e 显式创建的统计信息、扩展添加的自定义统计信息，或由累积统计系统收集的统计信息。因此，从转储文件恢复后再运行 \u003ccode class=\"command\"\u003eANALYZE\u003c/code\u003e 以确保最佳性能，可能仍然有用；更多信息见\u003ca class=\"xref\" href=\"/zh/docs/18/routine-vacuuming.html#VACUUM-FOR-STATISTICS\" title=\"24.1.3. 更新规划器统计信息\"\u003e第 24.1.3 节\u003c/a\u003e和\u003ca class=\"xref\" href=\"/zh/docs/18/routine-vacuuming.html#AUTOVACUUM\" title=\"24.1.6. 自动清理守护进程\"\u003e第 24.1.6 节\u003c/a\u003e。\n  \u003c/p\u003e\u003cp\u003e\n   由于 \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e 常被用来把数据迁移到更新版本的\n   \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e，因此通常可以期望\n   \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e 的输出能够装载到\n   \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e 服务器中，而这些服务器的版本比\n   \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e 更高。\u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e 也可以从版本比它自身更旧的\n   \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e 服务器上转储数据。（目前支持回溯到\n   9.2 版的服务器。）然而，\u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e 不能从主版本高于它自身的 \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e 服务器上转储；它甚至会拒绝尝试，以免冒生成无效转储的风险。另外，也不能保证\n   \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e 的输出能够装载到更旧主版本的服务器上\n   — 即使转储正是从该版本服务器上取得的。把转储文件装载到较旧服务器时，可能需要手工编辑转储文件，移除旧服务器无法理解的语法。在跨版本场景中，建议使用 \u003ccode class=\"option\"\u003e--quote-all-identifiers\u003c/code\u003e 选项，因为它可以防止不同 \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e 版本保留字列表差异带来的问题。\n  \u003c/p\u003e\u003cp\u003e\n   在转储逻辑复制订阅时，\u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e 会生成\n   \u003ccode class=\"command\"\u003eCREATE SUBSCRIPTION\u003c/code\u003e 命令，并带上\n   \u003ccode class=\"literal\"\u003econnect = false\u003c/code\u003e 选项，这样恢复订阅时就不会为了创建复制槽或执行初始表复制而建立远程连接。这样一来，无需网络访问远程服务器也能恢复转储。随后由用户以适当方式重新激活订阅。如果涉及的主机已经变化，则可能需要修改连接信息。在开始一次新的完整表复制之前，可能也适合先截断目标表。如果用户打算在刷新期间复制初始数据，则必须以 \u003ccode class=\"literal\"\u003etwo_phase = false\u003c/code\u003e 创建该槽。初始同步之后，订阅者会自动启用\n   \u003ca class=\"link\" href=\"/zh/docs/18/sql-createsubscription.html#SQL-CREATESUBSCRIPTION-PARAMS-WITH-TWO-PHASE\"\u003e\u003ccode class=\"literal\"\u003etwo_phase\u003c/code\u003e\u003c/a\u003e\n   选项，前提是该订阅最初是以 \u003ccode class=\"literal\"\u003etwo_phase = true\u003c/code\u003e 选项创建的。\n  \u003c/p\u003e\u003cp\u003e\n   通常建议在恢复数据库时使用\n   \u003ccode class=\"option\"\u003e-X\u003c/code\u003e（\u003ccode class=\"option\"\u003e--no-psqlrc\u003c/code\u003e）选项来处理纯文本\n   \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e 脚本，以确保恢复过程干净，并防止与非默认\n   \u003cspan class=\"application\"\u003epsql\u003c/span\u003e 配置发生潜在冲突。\n  \u003c/p\u003e\u003c/div\u003e\u003cdiv class=\"refsect1\" id=\"PG-DUMP-EXAMPLES\"\u003e\u003ch2\u003e示例\u003c/h2\u003e\u003cp\u003e\n   要把数据库 \u003ccode class=\"literal\"\u003emydb\u003c/code\u003e 转储到一个 SQL 脚本文件：\n\u003c/p\u003e\u003cpre class=\"screen\"\u003e\n\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\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n   要把这样的脚本重新装入一个（新创建的）名为 \u003ccode class=\"literal\"\u003enewdb\u003c/code\u003e 的数据库：\n\n\u003c/p\u003e\u003cpre class=\"screen\"\u003e\n\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\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n   要把一个数据库转储为 custom 格式归档文件：\n\n\u003c/p\u003e\u003cpre class=\"screen\"\u003e\n\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\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n   要把一个数据库转储为 directory 格式归档：\n\n\u003c/p\u003e\u003cpre class=\"screen\"\u003e\n\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\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n   要使用 5 个并行工作任务把一个数据库转储为 directory 格式归档：\n\n\u003c/p\u003e\u003cpre class=\"screen\"\u003e\n\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\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n   要把一个归档文件重新装入到一个（新创建的）名为\n   \u003ccode class=\"literal\"\u003enewdb\u003c/code\u003e 的数据库：\n\n\u003c/p\u003e\u003cpre class=\"screen\"\u003e\n\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\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n   要把一个归档文件重新装入生成该归档的同一个数据库，并丢弃该数据库的当前内容：\n\n\u003c/p\u003e\u003cpre class=\"screen\"\u003e\n\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\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n   要转储一个名为 \u003ccode class=\"literal\"\u003emytab\u003c/code\u003e 的表：\n\n\u003c/p\u003e\u003cpre class=\"screen\"\u003e\n\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\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n   要转储 \u003ccode class=\"literal\"\u003edetroit\u003c/code\u003e 模式中名称以 \u003ccode class=\"literal\"\u003eemp\u003c/code\u003e\n   开头的所有表，但排除名为 \u003ccode class=\"literal\"\u003eemployee_log\u003c/code\u003e 的表：\n\n\u003c/p\u003e\u003cpre class=\"screen\"\u003e\n\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\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n   要转储名称以 \u003ccode class=\"literal\"\u003eeast\u003c/code\u003e 或 \u003ccode class=\"literal\"\u003ewest\u003c/code\u003e 开头、并且以\n   \u003ccode class=\"literal\"\u003egsm\u003c/code\u003e 结尾的所有模式，同时排除名称中包含单词\n   \u003ccode class=\"literal\"\u003etest\u003c/code\u003e 的任何模式：\n\n\u003c/p\u003e\u003cpre class=\"screen\"\u003e\n\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\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n   同样，使用正则表达式记法来合并这些开关：\n\n\u003c/p\u003e\u003cpre class=\"screen\"\u003e\n\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\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n   要转储除名称以 \u003ccode class=\"literal\"\u003ets_\u003c/code\u003e 开头的表之外的所有数据库对象：\n\n\u003c/p\u003e\u003cpre class=\"screen\"\u003e\n\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\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n   在 \u003ccode class=\"option\"\u003e-t\u003c/code\u003e 及相关开关中，如果要指定一个大写或混合大小写的名称，就需要对该名称加双引号；否则它会被折叠成小写（见\u003ca class=\"xref\" href=\"/zh/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"模式\"\u003e模式\u003c/a\u003e）。但双引号对 shell 来说又是特殊字符，因此反过来还必须再被引用。因此，要转储一个具有混合大小写名称的单个表，需要类似下面这样：\n\n\u003c/p\u003e\u003cpre class=\"screen\"\u003e\n\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\u003cp\u003e\n   要转储所有名称以 \u003ccode class=\"literal\"\u003emytable\u003c/code\u003e 开头、但排除\n   \u003ccode class=\"literal\"\u003emytable2\u003c/code\u003e 表的表，请指定如下过滤文件\n   \u003ccode class=\"filename\"\u003efilter.txt\u003c/code\u003e：\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003e\ninclude table mytable*\nexclude table mytable2\n\u003c/pre\u003e\u003cp\u003e\n\u003c/p\u003e\u003cpre class=\"screen\"\u003e\n\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\u003c/div\u003e\u003cdiv class=\"refsect1\" id=\"id-1.9.4.14.11\"\u003e\u003ch2\u003e另见\u003c/h2\u003e\u003cspan class=\"simplelist\"\u003e\u003ca class=\"xref\" href=\"/zh/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=\"/zh/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=\"/zh/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\u003c/div\u003e\u003c/div\u003e","documentation_revision":{"inputs":[{"file":"app-pgdump.html","kind":"same-version-reviewed-manual","locale":"en","sha256":"2a808d6692816614b8c6adf7c870f13710b41951bd073375046f0676f33ab5ac","version":"18.7"},{"file":"reference-client.html","kind":"same-version-reviewed-manual","locale":"en","sha256":"a1c669b9a6dab81388171b696e61109033d96d2c4d5487219c77f62f14aecfa1","version":"18.7"},{"file":"app-pgdump.html","kind":"same-version-reviewed-manual","locale":"zh-Hans","sha256":"ae84b3fecddf3e0cad989af209087bf0ba8f2fe952bdb05693b4dce0367ccd2e","version":"18.7"},{"file":"reference-client.html","kind":"same-version-reviewed-manual","locale":"zh-Hans","sha256":"819e1b59b1a011bdaaff0c7cb9162348de1d0b34988a56179dc7ef1fee696a5a","version":"18.7"}],"release":"18.7","runtime_remeasured":false,"source_revision":"pgdoc:b9f0e7232f60f380d642ac9b99226606c254b552"},"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.7"},{"label":"Reference inventory","value":"Client applications"},{"label":"Option definition groups","value":"73"}],"facts_zh":[{"label":"手册中的可执行程序","value":"pg_dump"},{"label":"程序版本","value":"18.7"},{"label":"参考清单","value":"客户端程序"},{"label":"选项定义组","value":"73"}],"localization":{"documentation_release":"18.7","language":"en","source_language":"en","source_revision":"pgdoc:b9f0e7232f60f380d642ac9b99226606c254b552","status":"same-version-reviewed-manual"},"manual_html":"\u003cdiv\u003e\u003cdiv class=\"refentry\" id=\"APP-PGDUMP\"\u003e\u003cdiv class=\"titlepage\"\u003e\u003c/div\u003e\u003cdiv class=\"refnamediv\"\u003e\u003ch2\u003e\u003cspan class=\"refentrytitle\"\u003e\u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e\u003c/span\u003e\u003c/h2\u003e\u003cp\u003epg_dump — \n   export a \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e database as an SQL script or to other formats\n  \u003c/p\u003e\u003c/div\u003e\u003cdiv class=\"refsynopsisdiv\"\u003e\u003ch2\u003eSynopsis\u003c/h2\u003e\u003cdiv class=\"cmdsynopsis\"\u003e\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\u003c/div\u003e\u003c/div\u003e\u003cdiv class=\"refsect1\" id=\"PG-DUMP-DESCRIPTION\"\u003e\u003ch2\u003eDescription\u003c/h2\u003e\u003cp\u003e\n\u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e is a utility for exporting a\n   \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e database. It makes consistent\n   exports even if the database is being used concurrently.\n   \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e does not block other users\n   accessing the database (readers or writers).\n   Note, however, that except in simple cases,\n   \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e is generally not the right choice for\n   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.\n  \u003c/p\u003e\u003cp\u003e\n\u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e only dumps a single database.\n   To export an entire cluster, or to export global objects that are\n   common to all databases in a cluster (such as roles and tablespaces),\n   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.\n  \u003c/p\u003e\u003cp\u003e\n   Dumps can be output in script or archive file formats. Script\n   dumps are plain-text files containing the SQL commands required\n   to reconstruct the database to the state it was in at the time it was\n   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\n   can be used to reconstruct the database even on other machines and\n   other architectures; with some modifications, even on other SQL\n   database products.\n  \u003c/p\u003e\u003cp\u003e\n   The alternative archive file formats must be used with\n   \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\n   allow \u003cspan class=\"application\"\u003epg_restore\u003c/span\u003e to be selective about\n   what is restored, or even to reorder the items prior to being\n   restored.\n   The archive file formats are designed to be portable across\n   architectures.\n  \u003c/p\u003e\u003cp\u003e\n   When used with one of the archive file formats and combined with\n   \u003cspan class=\"application\"\u003epg_restore\u003c/span\u003e,\n   \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e provides a flexible archival and\n   transfer mechanism. \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e can be used to\n   export an entire database, then \u003cspan class=\"application\"\u003epg_restore\u003c/span\u003e\n   can be used to examine the archive and/or select which parts of the\n   database are to be restored. The most flexible output file formats are\n   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\n   \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\n   for selection and reordering of all archived items, support parallel\n   restoration, and are compressed by default. The \u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003edirectory\u003c/span\u003e”\u003c/span\u003e\n   format is the only format that supports parallel dumps.\n  \u003c/p\u003e\u003cp\u003e\n   While running \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e, one should examine the\n   output for any warnings (printed on standard error), especially in\n   light of the limitations listed below.\n  \u003c/p\u003e\u003cdiv class=\"warning\"\u003e\u003ch3 class=\"title\"\u003eWarning\u003c/h3\u003e\u003cp\u003e\n    Restoring a dump causes the destination to execute arbitrary code of the\n    source superusers' choice.  Partial dumps and partial restores do not limit\n    that.  If the source superusers are not trusted, the dumped SQL statements\n    must be inspected before restoring.  Non-plain-text dumps can be inspected\n    by using \u003cspan class=\"application\"\u003epg_restore\u003c/span\u003e's \u003ccode class=\"option\"\u003e--file\u003c/code\u003e\n    option.  Note that the client running the dump and restore need not trust\n    the source or destination superusers.\n   \u003c/p\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv class=\"refsect1\" id=\"PG-DUMP-OPTIONS\"\u003e\u003ch2\u003eOptions\u003c/h2\u003e\u003cp\u003e\n    The following command-line options control the content and\n    format of the output.\n\n    \u003c/p\u003e\u003cdiv class=\"variablelist\"\u003e\u003cdl class=\"variablelist\"\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Specifies the name of the database to be dumped.  If this is\n        not specified, the environment variable\n        \u003ccode class=\"envar\"\u003ePGDATABASE\u003c/code\u003e is used.  If that is not set, the\n        user name specified for the connection is used.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        Dump only the data, not the schema (data definitions) or statistics.\n        Table data, large objects, and sequence values are dumped.\n       \u003c/p\u003e\u003cp\u003e\n        This option is similar to, but for historical reasons not identical\n        to, specifying \u003ccode class=\"option\"\u003e--section=data\u003c/code\u003e.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        Include large objects in the dump.  This is the default behavior\n        except when \u003ccode class=\"option\"\u003e--schema\u003c/code\u003e, \u003ccode class=\"option\"\u003e--table\u003c/code\u003e,\n        \u003ccode class=\"option\"\u003e--schema-only\u003c/code\u003e, \u003ccode class=\"option\"\u003e--statistics-only\u003c/code\u003e, or\n        \u003ccode class=\"option\"\u003e--no-data\u003c/code\u003e is specified.  The \u003ccode class=\"option\"\u003e-b\u003c/code\u003e\n        switch is therefore only useful to add large objects to dumps where a\n        specific schema or table has been requested.  Note that large objects\n        are considered data and therefore will be included when\n        \u003ccode class=\"option\"\u003e--data-only\u003c/code\u003e is used, but not when\n        \u003ccode class=\"option\"\u003e--schema-only\u003c/code\u003e or \u003ccode class=\"option\"\u003e--statistics-only\u003c/code\u003e\n        is.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        Exclude large objects in the dump.\n       \u003c/p\u003e\u003cp\u003e\n        When both \u003ccode class=\"option\"\u003e-b\u003c/code\u003e and \u003ccode class=\"option\"\u003e-B\u003c/code\u003e are given, the behavior\n        is to output large objects, when data is being dumped, see the\n        \u003ccode class=\"option\"\u003e-b\u003c/code\u003e documentation.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        Output commands to \u003ccode class=\"command\"\u003eDROP\u003c/code\u003e all the dumped\n        database objects prior to outputting the commands for creating them.\n        This option is useful when the restore is to overwrite an existing\n        database.  If any of the objects do not exist in the destination\n        database, ignorable error messages will be reported during\n        restore, unless \u003ccode class=\"option\"\u003e--if-exists\u003c/code\u003e is also specified.\n       \u003c/p\u003e\u003cp\u003e\n        This option is ignored when emitting an archive (non-text) output\n        file.  For the archive formats, you can specify the option when you\n        call \u003ccode class=\"command\"\u003epg_restore\u003c/code\u003e.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        Begin the output with a command to create the\n        database itself and reconnect to the created database.  (With a\n        script of this form, it doesn't matter which database in the\n        destination installation you connect to before running the script.)\n        If \u003ccode class=\"option\"\u003e--clean\u003c/code\u003e is also specified, the script drops and\n        recreates the target database before reconnecting to it.\n       \u003c/p\u003e\u003cp\u003e\n        With \u003ccode class=\"option\"\u003e--create\u003c/code\u003e, the output also includes the\n        database's comment if any, and any configuration variable settings\n        that are specific to this database, that is,\n        any \u003ccode class=\"command\"\u003eALTER DATABASE ... SET ...\u003c/code\u003e\n        and \u003ccode class=\"command\"\u003eALTER ROLE ... IN DATABASE ... SET ...\u003c/code\u003e\n        commands that mention this database.\n        Access privileges for the database itself are also dumped,\n        unless \u003ccode class=\"option\"\u003e--no-acl\u003c/code\u003e is specified.\n       \u003c/p\u003e\u003cp\u003e\n        This option is ignored when emitting an archive (non-text) output\n        file.  For the archive formats, you can specify the option when you\n        call \u003ccode class=\"command\"\u003epg_restore\u003c/code\u003e.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        Dump only extensions matching \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e.  When this option is not\n        specified, all non-system extensions in the target database will be\n        dumped.  Multiple extensions can be selected by writing multiple\n        \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\n        pattern according to the same rules used by\n        \u003cspan class=\"application\"\u003epsql\u003c/span\u003e's \u003ccode class=\"literal\"\u003e\\d\u003c/code\u003e commands (see\n        \u003ca class=\"xref\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003ePatterns\u003c/a\u003e), so multiple extensions can also\n        be selected by writing wildcard characters in the pattern.  When using\n        wildcards, be careful to quote the pattern if needed to prevent the\n        shell from expanding the wildcards.\n       \u003c/p\u003e\u003cp\u003e\n        Any configuration relation registered by\n        \u003ccode class=\"function\"\u003epg_extension_config_dump\u003c/code\u003e is included in the\n        dump if its extension is specified by \u003ccode class=\"option\"\u003e--extension\u003c/code\u003e.\n       \u003c/p\u003e\u003cdiv class=\"note\"\u003e\u003ch3 class=\"title\"\u003eNote\u003c/h3\u003e\u003cp\u003e\n         When \u003ccode class=\"option\"\u003e-e\u003c/code\u003e is specified,\n         \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e makes no attempt to dump any other\n         database objects that the selected extension(s) might depend upon.\n         Therefore, there is no guarantee that the results of a\n         specific-extension dump can be successfully restored by themselves\n         into a clean database.\n        \u003c/p\u003e\u003c/div\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        Create the dump in the specified character set encoding. By default,\n        the dump is created in the database encoding.  (Another way to get the\n        same result is to set the \u003ccode class=\"envar\"\u003ePGCLIENTENCODING\u003c/code\u003e environment\n        variable to the desired dump encoding.)  The supported encodings are\n        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.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        Send output to the specified file. This parameter can be omitted for\n        file based output formats, in which case the standard output is used.\n        It must be given for the directory output format however, where it\n        specifies the target directory instead of a file. In this case the\n        directory is created by \u003ccode class=\"command\"\u003epg_dump\u003c/code\u003e and must not exist\n        before.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        Selects the format of the output.\n        \u003cem class=\"replaceable\"\u003e\u003ccode\u003eformat\u003c/code\u003e\u003c/em\u003e can be one of the following:\n\n       \u003c/p\u003e\u003cdiv class=\"variablelist\"\u003e\u003cdl class=\"variablelist\"\u003e\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\u003cdd\u003e\u003cp\u003e\n           Output a plain-text SQL script file (the default).\n          \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n           Output a custom-format archive suitable for input into\n           \u003cspan class=\"application\"\u003epg_restore\u003c/span\u003e.\n           Together with the directory output format, this is the most flexible\n           output format in that it allows manual selection and reordering of\n           archived items during restore. This format is also compressed by\n           default.\n          \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n           Output a directory-format archive suitable for input into\n           \u003cspan class=\"application\"\u003epg_restore\u003c/span\u003e. This will create a directory\n           with one file for each table and large object being dumped, plus a\n           so-called Table of Contents file describing the dumped objects in a\n           machine-readable format that \u003cspan class=\"application\"\u003epg_restore\u003c/span\u003e\n           can read. A directory format archive can be manipulated with\n           standard Unix tools; for example, files in an uncompressed archive\n           can be compressed with the \u003cspan class=\"application\"\u003egzip\u003c/span\u003e,\n           \u003cspan class=\"application\"\u003elz4\u003c/span\u003e, or\n           \u003cspan class=\"application\"\u003ezstd\u003c/span\u003e tools.\n           This format is compressed by default using \u003ccode class=\"literal\"\u003egzip\u003c/code\u003e\n           and also supports parallel dumps.\n          \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n           Output a \u003ccode class=\"command\"\u003etar\u003c/code\u003e-format archive suitable for input\n           into \u003cspan class=\"application\"\u003epg_restore\u003c/span\u003e. The tar format is\n           compatible with the directory format: extracting a tar-format\n           archive produces a valid directory-format archive.\n           However, the tar format does not support compression. Also, when\n           using tar format the relative order of table data items cannot be\n           changed during restore.\n          \u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        Run the dump in parallel by dumping \u003cem class=\"replaceable\"\u003e\u003ccode\u003enjobs\u003c/code\u003e\u003c/em\u003e\n        tables simultaneously. This option may reduce the time needed to perform the dump but it also\n        increases the load on the database server. You can only use this option with the\n        directory output format because this is the only output format where multiple processes\n        can write their data at the same time.\n       \u003c/p\u003e\u003cp\u003e\u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e will open \u003cem class=\"replaceable\"\u003e\u003ccode\u003enjobs\u003c/code\u003e\u003c/em\u003e\n        + 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\n        setting is high enough to accommodate all connections.\n       \u003c/p\u003e\u003cp\u003e\n        Requesting exclusive locks on database objects while running a parallel dump could\n        cause the dump to fail. The reason is that the \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e leader process\n        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\n        objects that the worker processes are going to dump later in order to\n        make sure that nobody deletes them and makes them go away while the dump is running.\n        If another client then requests an exclusive lock on a table, that lock will not be\n        granted but will be queued waiting for the shared lock of the leader process to be\n        released. Consequently any other access to the table will not be granted either and\n        will queue after the exclusive lock request. This includes the worker process trying\n        to dump the table. Without any precautions this would be a classic deadlock situation.\n        To detect this conflict, the \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e worker process requests another\n        shared lock using the \u003ccode class=\"literal\"\u003eNOWAIT\u003c/code\u003e option. If the worker process is not granted\n        this shared lock, somebody else must have requested an exclusive lock in the meantime\n        and there is no way to continue with the dump, so \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e has no choice\n        but to abort the dump.\n       \u003c/p\u003e\u003cp\u003e\n        To perform a parallel dump, the database server needs to support\n        synchronized snapshots, a feature that was introduced in\n        \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e 9.2 for primary servers and 10\n        for standbys. With this feature, database clients can ensure they see\n        the same data set even though they use different connections.\n        \u003ccode class=\"command\"\u003epg_dump -j\u003c/code\u003e uses multiple database connections; it\n        connects to the database once with the leader process and once again\n        for each worker job. Without the synchronized snapshot feature, the\n        different worker jobs wouldn't be guaranteed to see the same data in\n        each connection, which could lead to an inconsistent backup.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        Dump only schemas matching \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e; this selects both the\n        schema itself, and all its contained objects.  When this option is\n        not specified, all non-system schemas in the target database will be\n        dumped.  Multiple schemas can be\n        selected by writing multiple \u003ccode class=\"option\"\u003e-n\u003c/code\u003e switches.  The\n        \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e parameter is\n        interpreted as a pattern according to the same rules used by\n        \u003cspan class=\"application\"\u003epsql\u003c/span\u003e's \u003ccode class=\"literal\"\u003e\\d\u003c/code\u003e commands\n        (see \u003ca class=\"xref\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003ePatterns\u003c/a\u003e),\n        so multiple schemas can also be selected by writing wildcard characters\n        in the pattern.  When using wildcards, be careful to quote the pattern\n        if needed to prevent the shell from expanding the wildcards;  see\n        \u003ca class=\"xref\" href=\"/docs/18/app-pgdump.html#PG-DUMP-EXAMPLES\" title=\"Examples\"\u003eExamples\u003c/a\u003e below.\n       \u003c/p\u003e\u003cdiv class=\"note\"\u003e\u003ch3 class=\"title\"\u003eNote\u003c/h3\u003e\u003cp\u003e\n         When \u003ccode class=\"option\"\u003e-n\u003c/code\u003e is specified, \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e\n         makes no attempt to dump any other database objects that the selected\n         schema(s) might depend upon. Therefore, there is no guarantee\n         that the results of a specific-schema dump can be successfully\n         restored by themselves into a clean database.\n        \u003c/p\u003e\u003c/div\u003e\u003cdiv class=\"note\"\u003e\u003ch3 class=\"title\"\u003eNote\u003c/h3\u003e\u003cp\u003e\n         Non-schema objects such as large objects are not dumped when \u003ccode class=\"option\"\u003e-n\u003c/code\u003e is\n         specified.  You can add large objects back to the dump with the\n         \u003ccode class=\"option\"\u003e--large-objects\u003c/code\u003e switch.\n        \u003c/p\u003e\u003c/div\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        Do not dump any schemas matching \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e.  The pattern is\n        interpreted according to the same rules as for \u003ccode class=\"option\"\u003e-n\u003c/code\u003e.\n        \u003ccode class=\"option\"\u003e-N\u003c/code\u003e can be given more than once to exclude schemas\n        matching any of several patterns.\n       \u003c/p\u003e\u003cp\u003e\n        When both \u003ccode class=\"option\"\u003e-n\u003c/code\u003e and \u003ccode class=\"option\"\u003e-N\u003c/code\u003e are given, the behavior\n        is to dump just the schemas that match at least one \u003ccode class=\"option\"\u003e-n\u003c/code\u003e\n        switch but no \u003ccode class=\"option\"\u003e-N\u003c/code\u003e switches.  If \u003ccode class=\"option\"\u003e-N\u003c/code\u003e appears\n        without \u003ccode class=\"option\"\u003e-n\u003c/code\u003e, then schemas matching \u003ccode class=\"option\"\u003e-N\u003c/code\u003e are\n        excluded from what is otherwise a normal dump.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        Do not output commands to set\n        ownership of objects to match the original database.\n        By default, \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e issues\n        \u003ccode class=\"command\"\u003eALTER OWNER\u003c/code\u003e or\n        \u003ccode class=\"command\"\u003eSET SESSION AUTHORIZATION\u003c/code\u003e\n        statements to set ownership of created database objects.\n        These statements\n        will fail when the script is run unless it is started by a superuser\n        (or the same user that owns all of the objects in the script).\n        To make a script that can be restored by any user, but will give\n        that user ownership of all the objects, specify \u003ccode class=\"option\"\u003e-O\u003c/code\u003e.\n       \u003c/p\u003e\u003cp\u003e\n        This option is ignored when emitting an archive (non-text) output\n        file.  For the archive formats, you can specify the option when you\n        call \u003ccode class=\"command\"\u003epg_restore\u003c/code\u003e.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        This option is obsolete but still accepted for backwards\n        compatibility.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        Dump only the object definitions (schema), not data or statistics.\n       \u003c/p\u003e\u003cp\u003e\n        This option cannot be used with \u003ccode class=\"option\"\u003e--data-only\u003c/code\u003e\n        or \u003ccode class=\"option\"\u003e--statistics-only\u003c/code\u003e.\n        It is similar to, but for historical reasons not identical to,\n        specifying\n        \u003ccode class=\"option\"\u003e--section=pre-data --section=post-data\u003c/code\u003e.\n       \u003c/p\u003e\u003cp\u003e\n        (Do not confuse this with the \u003ccode class=\"option\"\u003e--schema\u003c/code\u003e option, which\n        uses the word \u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003eschema\u003c/span\u003e”\u003c/span\u003e in a different meaning.)\n       \u003c/p\u003e\u003cp\u003e\n        To exclude table data for only a subset of tables in the database,\n        see \u003ccode class=\"option\"\u003e--exclude-table-data\u003c/code\u003e.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        Specify the superuser user name to use when disabling triggers.\n        This is relevant only if \u003ccode class=\"option\"\u003e--disable-triggers\u003c/code\u003e is used.\n        (Usually, it's better to leave this out, and instead start the\n        resulting script as superuser.)\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        Dump only tables with names matching\n        \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e. Multiple tables\n        can be selected by writing multiple \u003ccode class=\"option\"\u003e-t\u003c/code\u003e switches.  The\n        \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e parameter is\n        interpreted as a pattern according to the same rules used by\n        \u003cspan class=\"application\"\u003epsql\u003c/span\u003e's \u003ccode class=\"literal\"\u003e\\d\u003c/code\u003e commands\n        (see \u003ca class=\"xref\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003ePatterns\u003c/a\u003e),\n        so multiple tables can also be selected by writing wildcard characters\n        in the pattern.  When using wildcards, be careful to quote the pattern\n        if needed to prevent the shell from expanding the wildcards;  see\n        \u003ca class=\"xref\" href=\"/docs/18/app-pgdump.html#PG-DUMP-EXAMPLES\" title=\"Examples\"\u003eExamples\u003c/a\u003e below.\n       \u003c/p\u003e\u003cp\u003e\n        As well as tables, this option can be used to dump the definition of matching\n        views, materialized views, foreign tables, and sequences.  It will not dump the\n        contents of views or materialized views, and the contents of foreign tables will\n        only be dumped if the corresponding foreign server is specified with\n        \u003ccode class=\"option\"\u003e--include-foreign-data\u003c/code\u003e.\n       \u003c/p\u003e\u003cp\u003e\n        The \u003ccode class=\"option\"\u003e-n\u003c/code\u003e and \u003ccode class=\"option\"\u003e-N\u003c/code\u003e switches have no effect when\n        \u003ccode class=\"option\"\u003e-t\u003c/code\u003e is used, because tables selected by \u003ccode class=\"option\"\u003e-t\u003c/code\u003e will\n        be dumped regardless of those switches, and non-table objects will not\n        be dumped.\n       \u003c/p\u003e\u003cdiv class=\"note\"\u003e\u003ch3 class=\"title\"\u003eNote\u003c/h3\u003e\u003cp\u003e\n         When \u003ccode class=\"option\"\u003e-t\u003c/code\u003e is specified, \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e\n         makes no attempt to dump any other database objects that the selected\n         table(s) might depend upon. Therefore, there is no guarantee\n         that the results of a specific-table dump can be successfully\n         restored by themselves into a clean database.\n        \u003c/p\u003e\u003c/div\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        Do not dump any tables matching \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e.  The pattern is\n        interpreted according to the same rules as for \u003ccode class=\"option\"\u003e-t\u003c/code\u003e.\n        \u003ccode class=\"option\"\u003e-T\u003c/code\u003e can be given more than once to exclude tables\n        matching any of several patterns.\n       \u003c/p\u003e\u003cp\u003e\n        When both \u003ccode class=\"option\"\u003e-t\u003c/code\u003e and \u003ccode class=\"option\"\u003e-T\u003c/code\u003e are given, the behavior\n        is to dump just the tables that match at least one \u003ccode class=\"option\"\u003e-t\u003c/code\u003e\n        switch but no \u003ccode class=\"option\"\u003e-T\u003c/code\u003e switches.  If \u003ccode class=\"option\"\u003e-T\u003c/code\u003e appears\n        without \u003ccode class=\"option\"\u003e-t\u003c/code\u003e, then tables matching \u003ccode class=\"option\"\u003e-T\u003c/code\u003e are\n        excluded from what is otherwise a normal dump.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        Specifies verbose mode.  This will cause\n        \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e to output detailed object\n        comments and start/stop times to the dump file, and progress\n        messages to standard error.\n        Repeating the option causes additional debug-level messages\n        to appear on standard error.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n       Print the \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e version and exit.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        Prevent dumping of access privileges (grant/revoke commands).\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        Specify the compression method and/or the compression level to use.\n        The compression method can be set to \u003ccode class=\"literal\"\u003egzip\u003c/code\u003e,\n        \u003ccode class=\"literal\"\u003elz4\u003c/code\u003e, \u003ccode class=\"literal\"\u003ezstd\u003c/code\u003e,\n        or \u003ccode class=\"literal\"\u003enone\u003c/code\u003e for no compression.\n        A compression detail string can optionally be specified.  If the\n        detail string is an integer, it specifies the compression level.\n        Otherwise, it should be a comma-separated list of items, each of the\n        form \u003ccode class=\"literal\"\u003ekeyword\u003c/code\u003e or \u003ccode class=\"literal\"\u003ekeyword=value\u003c/code\u003e.\n        Currently, the supported keywords are \u003ccode class=\"literal\"\u003elevel\u003c/code\u003e and\n        \u003ccode class=\"literal\"\u003elong\u003c/code\u003e.\n       \u003c/p\u003e\u003cp\u003e\n        If no compression level is specified, the default compression\n        level will be used. If only a level is specified without mentioning\n        an algorithm, \u003ccode class=\"literal\"\u003egzip\u003c/code\u003e compression will be used if\n        the level is greater than \u003ccode class=\"literal\"\u003e0\u003c/code\u003e, and no compression\n        will be used if the level is \u003ccode class=\"literal\"\u003e0\u003c/code\u003e.\n       \u003c/p\u003e\u003cp\u003e\n        For the custom and directory archive formats, this specifies compression of\n        individual table-data segments, and the default is to compress using\n        \u003ccode class=\"literal\"\u003egzip\u003c/code\u003e at a moderate level. For plain text output,\n        setting a nonzero compression level causes the entire output file to be compressed,\n        as though it had been fed through \u003cspan class=\"application\"\u003egzip\u003c/span\u003e,\n        \u003cspan class=\"application\"\u003elz4\u003c/span\u003e, or \u003cspan class=\"application\"\u003ezstd\u003c/span\u003e;\n        but the default is not to compress.\n        With zstd compression, \u003ccode class=\"literal\"\u003elong\u003c/code\u003e mode may improve the\n        compression ratio, at the cost of increased memory use.\n       \u003c/p\u003e\u003cp\u003e\n        The tar archive format currently does not support compression at all.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--binary-upgrade\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        This option is for use by in-place upgrade utilities.  Its use\n        for other purposes is not recommended or supported.  The\n        behavior of the option may change in future releases without\n        notice.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        Dump data as \u003ccode class=\"command\"\u003eINSERT\u003c/code\u003e commands with explicit\n        column names (\u003ccode class=\"literal\"\u003eINSERT INTO\n        \u003cem class=\"replaceable\"\u003e\u003ccode\u003etable\u003c/code\u003e\u003c/em\u003e\n        (\u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolumn\u003c/code\u003e\u003c/em\u003e, ...) VALUES\n        ...\u003c/code\u003e).  This will make restoration very slow; it is mainly\n        useful for making dumps that can be loaded into\n        non-\u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e databases.\n        Any error during restoring will cause only rows that are part of the\n        problematic \u003ccode class=\"command\"\u003eINSERT\u003c/code\u003e to be lost, rather than the\n        entire table contents.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--disable-dollar-quoting\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        This option disables the use of dollar quoting for function bodies,\n        and forces them to be quoted using SQL standard string syntax.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--disable-triggers\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        This option is relevant only when creating a dump that includes data\n        but does not include schema.\n        It instructs \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e to include commands\n        to temporarily disable triggers on the target tables while\n        the data is restored.  Use this if you have referential\n        integrity checks or other triggers on the tables that you\n        do not want to invoke during data restore.\n       \u003c/p\u003e\u003cp\u003e\n        Presently, the commands emitted for \u003ccode class=\"option\"\u003e--disable-triggers\u003c/code\u003e\n        must be done as superuser.  So, you should also specify\n        a superuser name with \u003ccode class=\"option\"\u003e-S\u003c/code\u003e, or preferably be careful to\n        start the resulting script as a superuser.\n       \u003c/p\u003e\u003cp\u003e\n        This option is ignored when emitting an archive (non-text) output\n        file.  For the archive formats, you can specify the option when you\n        call \u003ccode class=\"command\"\u003epg_restore\u003c/code\u003e.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--enable-row-security\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        This option is relevant only when dumping the contents of a table\n        which has row security.  By default, \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e will set\n        \u003ca class=\"xref\" href=\"/docs/18/runtime-config-client.html#GUC-ROW-SECURITY\"\u003erow_security\u003c/a\u003e to off, to ensure\n        that all data is dumped from the table.  If the user does not have\n        sufficient privileges to bypass row security, then an error is thrown.\n        This parameter instructs \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e to set\n        \u003ca class=\"xref\" href=\"/docs/18/runtime-config-client.html#GUC-ROW-SECURITY\"\u003erow_security\u003c/a\u003e to on instead, allowing the user\n        to dump the parts of the contents of the table that they have access to.\n       \u003c/p\u003e\u003cp\u003e\n        Note that if you use this option currently, you probably also want\n        the dump be in \u003ccode class=\"command\"\u003eINSERT\u003c/code\u003e format, as the\n        \u003ccode class=\"command\"\u003eCOPY FROM\u003c/code\u003e during restore does not support row security.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        Do not dump any extensions matching \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e.  The pattern is\n        interpreted according to the same rules as for \u003ccode class=\"option\"\u003e-e\u003c/code\u003e.\n        \u003ccode class=\"option\"\u003e--exclude-extension\u003c/code\u003e can be given more than once to exclude extensions\n        matching any of several patterns.\n       \u003c/p\u003e\u003cp\u003e\n        When both \u003ccode class=\"option\"\u003e-e\u003c/code\u003e and \u003ccode class=\"option\"\u003e--exclude-extension\u003c/code\u003e are given, the behavior\n        is to dump just the extensions that match at least one \u003ccode class=\"option\"\u003e-e\u003c/code\u003e\n        switch but no \u003ccode class=\"option\"\u003e--exclude-extension\u003c/code\u003e switches.  If \u003ccode class=\"option\"\u003e--exclude-extension\u003c/code\u003e\n        appears without \u003ccode class=\"option\"\u003e-e\u003c/code\u003e, then extensions matching \u003ccode class=\"option\"\u003e--exclude-extension\u003c/code\u003e are\n        excluded from what is otherwise a normal dump.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        This is the same as\n        the \u003ccode class=\"option\"\u003e-T\u003c/code\u003e/\u003ccode class=\"option\"\u003e--exclude-table\u003c/code\u003e option,\n        except that it also excludes any partitions or inheritance child\n        tables of the table(s) matching the\n        \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        Do not dump data for any tables matching \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e. The pattern is\n        interpreted according to the same rules as for \u003ccode class=\"option\"\u003e-t\u003c/code\u003e.\n        \u003ccode class=\"option\"\u003e--exclude-table-data\u003c/code\u003e can be given more than once to\n        exclude tables matching any of several patterns. This option is\n        useful when you need the definition of a particular table even\n        though you do not need the data in it.\n       \u003c/p\u003e\u003cp\u003e\n        To exclude data for all tables in the database, see \u003ccode class=\"option\"\u003e--schema-only\u003c/code\u003e\n        or \u003ccode class=\"option\"\u003e--statistics-only\u003c/code\u003e.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        This is the same as the \u003ccode class=\"option\"\u003e--exclude-table-data\u003c/code\u003e option,\n        except that it also excludes data of any partitions or inheritance\n        child tables of the table(s) matching the\n        \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        Use the specified value of \u003ccode class=\"option\"\u003eextra_float_digits\u003c/code\u003e when dumping\n        floating-point data, instead of the maximum available precision.\n        Routine dumps made for backup purposes should not use this option.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        Specify a filename from which to read patterns for objects to include\n        or exclude from the dump. The patterns are interpreted according to the\n        same rules as the corresponding options:\n        \u003ccode class=\"option\"\u003e-t\u003c/code\u003e/\u003ccode class=\"option\"\u003e--table\u003c/code\u003e,\n        \u003ccode class=\"option\"\u003e--table-and-children\u003c/code\u003e,\n        \u003ccode class=\"option\"\u003e-T\u003c/code\u003e/\u003ccode class=\"option\"\u003e--exclude-table\u003c/code\u003e, and\n        \u003ccode class=\"option\"\u003e--exclude-table-and-children\u003c/code\u003e for tables,\n        \u003ccode class=\"option\"\u003e-n\u003c/code\u003e/\u003ccode class=\"option\"\u003e--schema\u003c/code\u003e and\n        \u003ccode class=\"option\"\u003e-N\u003c/code\u003e/\u003ccode class=\"option\"\u003e--exclude-schema\u003c/code\u003e for schemas,\n        \u003ccode class=\"option\"\u003e--include-foreign-data\u003c/code\u003e for data on foreign servers,\n        \u003ccode class=\"option\"\u003e--exclude-table-data\u003c/code\u003e and\n        \u003ccode class=\"option\"\u003e--exclude-table-data-and-children\u003c/code\u003e for table data, and\n        \u003ccode class=\"option\"\u003e-e\u003c/code\u003e/\u003ccode class=\"option\"\u003e--extension\u003c/code\u003e and\n        \u003ccode class=\"option\"\u003e--exclude-extension\u003c/code\u003e for extensions.\n        To read from \u003ccode class=\"literal\"\u003eSTDIN\u003c/code\u003e, use \u003ccode class=\"filename\"\u003e-\u003c/code\u003e as the\n        filename.  The \u003ccode class=\"option\"\u003e--filter\u003c/code\u003e option can be specified in\n        conjunction with the above listed options for including or excluding\n        objects, and can also be specified more than once for multiple filter\n        files.\n       \u003c/p\u003e\u003cp\u003e\n        The file lists one object pattern per row, with the following format:\n\u003c/p\u003e\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\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n        The first keyword specifies whether the objects matched by the pattern\n        are to be included or excluded. The second keyword specifies the type\n        of object to be filtered using the pattern:\n        \u003c/p\u003e\u003cdiv class=\"itemizedlist\"\u003e\u003cul class=\"itemizedlist\"\u003e\u003cli class=\"listitem\"\u003e\u003cp\u003e\n\u003ccode class=\"literal\"\u003eextension\u003c/code\u003e: extensions. This works like the\n           \u003ccode class=\"option\"\u003e-e\u003c/code\u003e/\u003ccode class=\"option\"\u003e--extension\u003c/code\u003e or\n           \u003ccode class=\"option\"\u003e--exclude-extension\u003c/code\u003e option.\n          \u003c/p\u003e\u003c/li\u003e\u003cli class=\"listitem\"\u003e\u003cp\u003e\n\u003ccode class=\"literal\"\u003eforeign_data\u003c/code\u003e: data on foreign servers. This works like\n           the \u003ccode class=\"option\"\u003e--include-foreign-data\u003c/code\u003e option. This keyword can\n           only be used with the \u003ccode class=\"literal\"\u003einclude\u003c/code\u003e keyword.\n          \u003c/p\u003e\u003c/li\u003e\u003cli class=\"listitem\"\u003e\u003cp\u003e\n\u003ccode class=\"literal\"\u003etable\u003c/code\u003e: tables. This works like the\n           \u003ccode class=\"option\"\u003e-t\u003c/code\u003e/\u003ccode class=\"option\"\u003e--table\u003c/code\u003e or\n           \u003ccode class=\"option\"\u003e-T\u003c/code\u003e/\u003ccode class=\"option\"\u003e--exclude-table\u003c/code\u003e option.\n          \u003c/p\u003e\u003c/li\u003e\u003cli class=\"listitem\"\u003e\u003cp\u003e\n\u003ccode class=\"literal\"\u003etable_and_children\u003c/code\u003e: tables including any partitions\n           or inheritance child tables. This works like the\n           \u003ccode class=\"option\"\u003e--table-and-children\u003c/code\u003e or\n           \u003ccode class=\"option\"\u003e--exclude-table-and-children\u003c/code\u003e option.\n          \u003c/p\u003e\u003c/li\u003e\u003cli class=\"listitem\"\u003e\u003cp\u003e\n\u003ccode class=\"literal\"\u003etable_data\u003c/code\u003e: table data of any tables matching\n           \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e. This works like the\n           \u003ccode class=\"option\"\u003e--exclude-table-data\u003c/code\u003e option. This keyword can only\n           be used with the \u003ccode class=\"literal\"\u003eexclude\u003c/code\u003e keyword.\n          \u003c/p\u003e\u003c/li\u003e\u003cli class=\"listitem\"\u003e\u003cp\u003e\n\u003ccode class=\"literal\"\u003etable_data_and_children\u003c/code\u003e: table data of any tables\n           matching \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e as well as any partitions\n           or inheritance children of the table(s). This works like the\n           \u003ccode class=\"option\"\u003e--exclude-table-data-and-children\u003c/code\u003e option. This\n           keyword can only be used with the \u003ccode class=\"literal\"\u003eexclude\u003c/code\u003e keyword.\n          \u003c/p\u003e\u003c/li\u003e\u003cli class=\"listitem\"\u003e\u003cp\u003e\n\u003ccode class=\"literal\"\u003eschema\u003c/code\u003e: schemas. This works like the\n           \u003ccode class=\"option\"\u003e-n\u003c/code\u003e/\u003ccode class=\"option\"\u003e--schema\u003c/code\u003e or\n           \u003ccode class=\"option\"\u003e-N\u003c/code\u003e/\u003ccode class=\"option\"\u003e--exclude-schema\u003c/code\u003e option.\n          \u003c/p\u003e\u003c/li\u003e\u003c/ul\u003e\u003c/div\u003e\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n        Lines starting with \u003ccode class=\"literal\"\u003e#\u003c/code\u003e are considered comments and\n        ignored. Comments can be placed after an object pattern row as well.\n        Blank lines are also ignored. See \u003ca class=\"xref\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003ePatterns\u003c/a\u003e\n        for how to perform quoting in patterns.\n       \u003c/p\u003e\u003cp\u003e\n        Example files are listed below in the \u003ca class=\"xref\" href=\"/docs/18/app-pgdump.html#PG-DUMP-EXAMPLES\" title=\"Examples\"\u003eExamples\u003c/a\u003e\n        section.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--if-exists\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Use \u003ccode class=\"literal\"\u003eDROP ... IF EXISTS\u003c/code\u003e commands to drop objects\n        in \u003ccode class=\"option\"\u003e--clean\u003c/code\u003e mode.  This suppresses \u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003edoes not\n        exist\u003c/span\u003e”\u003c/span\u003e errors that might otherwise be reported.  This\n        option is not valid unless \u003ccode class=\"option\"\u003e--clean\u003c/code\u003e is also\n        specified.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        Dump the data for any foreign table with a foreign server\n        matching \u003cem class=\"replaceable\"\u003e\u003ccode\u003eforeignserver\u003c/code\u003e\u003c/em\u003e\n        pattern. Multiple foreign servers can be selected by writing multiple\n        \u003ccode class=\"option\"\u003e--include-foreign-data\u003c/code\u003e switches.\n        Also, the \u003cem class=\"replaceable\"\u003e\u003ccode\u003eforeignserver\u003c/code\u003e\u003c/em\u003e parameter is\n        interpreted as a pattern according to the same rules used by\n        \u003cspan class=\"application\"\u003epsql\u003c/span\u003e's \u003ccode class=\"literal\"\u003e\\d\u003c/code\u003e commands\n        (see \u003ca class=\"xref\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003ePatterns\u003c/a\u003e),\n        so multiple foreign servers can also be selected by writing wildcard characters\n        in the pattern.  When using wildcards, be careful to quote the pattern\n        if needed to prevent the shell from expanding the wildcards; see\n        \u003ca class=\"xref\" href=\"/docs/18/app-pgdump.html#PG-DUMP-EXAMPLES\" title=\"Examples\"\u003eExamples\u003c/a\u003e below.\n        The only exception is that an empty pattern is disallowed.\n       \u003c/p\u003e\u003cdiv class=\"note\"\u003e\u003ch3 class=\"title\"\u003eNote\u003c/h3\u003e\u003cp\u003e\n         Using wildcards in \u003ccode class=\"option\"\u003e--include-foreign-data\u003c/code\u003e may result\n         in access to unexpected foreign servers. Also, to use this option securely,\n         make sure that the named server must have a trusted owner.\n        \u003c/p\u003e\u003c/div\u003e\u003cdiv class=\"note\"\u003e\u003ch3 class=\"title\"\u003eNote\u003c/h3\u003e\u003cp\u003e\n         When \u003ccode class=\"option\"\u003e--include-foreign-data\u003c/code\u003e is specified,\n         \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e does not check that the foreign\n         table is writable.  Therefore, there is no guarantee that the\n         results of a foreign table dump can be successfully restored.\n        \u003c/p\u003e\u003c/div\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--inserts\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Dump data as \u003ccode class=\"command\"\u003eINSERT\u003c/code\u003e commands (rather\n        than \u003ccode class=\"command\"\u003eCOPY\u003c/code\u003e).  This will make restoration very slow;\n        it is mainly useful for making dumps that can be loaded into\n        non-\u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e databases.\n        Any error during restoring will cause only rows that are part of the\n        problematic \u003ccode class=\"command\"\u003eINSERT\u003c/code\u003e to be lost, rather than the\n        entire table contents.  Note that the restore might fail altogether if\n        you have rearranged column order.  The\n        \u003ccode class=\"option\"\u003e--column-inserts\u003c/code\u003e option is safe against column order\n        changes, though even slower.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--load-via-partition-root\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        When dumping data for a table partition, make\n        the \u003ccode class=\"command\"\u003eCOPY\u003c/code\u003e or \u003ccode class=\"command\"\u003eINSERT\u003c/code\u003e statements\n        target the root of the partitioning hierarchy that contains it, rather\n        than the partition itself.  This causes the appropriate partition to\n        be re-determined for each row when the data is loaded.  This may be\n        useful when restoring data on a server where rows do not always fall\n        into the same partitions as they did on the original server.  That\n        could happen, for example, if the partitioning column is of type text\n        and the two systems have different definitions of the collation used\n        to sort the partitioning column.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        Do not wait forever to acquire shared table locks at the beginning of\n        the dump. Instead fail if unable to lock a table within the specified\n        \u003cem class=\"replaceable\"\u003e\u003ccode\u003etimeout\u003c/code\u003e\u003c/em\u003e. The timeout may be\n        specified in any of the formats accepted by \u003ccode class=\"command\"\u003eSET\n        statement_timeout\u003c/code\u003e.  (Allowed formats vary depending on the server\n        version you are dumping from, but an integer number of milliseconds\n        is accepted by all versions.)\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-comments\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Do not dump \u003ccode class=\"command\"\u003eCOMMENT\u003c/code\u003e commands.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-data\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Do not dump data.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-policies\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Do not dump row security policies.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-publications\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Do not dump publications.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-schema\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Do not dump schema (data definitions).\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-security-labels\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Do not dump security labels.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-statistics\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Do not dump statistics. This is the default.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-subscriptions\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Do not dump subscriptions.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-sync\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        By default, \u003ccode class=\"command\"\u003epg_dump\u003c/code\u003e will wait for all files\n        to be written safely to disk.  This option causes\n        \u003ccode class=\"command\"\u003epg_dump\u003c/code\u003e to return without waiting, which is\n        faster, but means that a subsequent operating system crash can leave\n        the dump corrupt.  Generally, this option is useful for testing\n        but should not be used when dumping data from production installation.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-table-access-method\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Do not output commands to select table access methods.\n        With this option, all objects will be created with whichever\n        table access method is the default during restore.\n       \u003c/p\u003e\u003cp\u003e\n        This option is ignored when emitting an archive (non-text) output\n        file.  For the archive formats, you can specify the option when you\n        call \u003ccode class=\"command\"\u003epg_restore\u003c/code\u003e.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-tablespaces\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Do not output commands to select tablespaces.\n        With this option, all objects will be created in whichever\n        tablespace is the default during restore.\n       \u003c/p\u003e\u003cp\u003e\n        This option is ignored when emitting an archive (non-text) output\n        file.  For the archive formats, you can specify the option when you\n        call \u003ccode class=\"command\"\u003epg_restore\u003c/code\u003e.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-toast-compression\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Do not output commands to set TOAST compression\n        methods.\n        With this option, all columns will be restored with the default\n        compression setting.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-unlogged-table-data\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Do not dump the contents of unlogged tables and sequences.  This\n        option has no effect on whether or not the table and sequence\n        definitions (schema) are dumped; it only suppresses dumping the table\n        and sequence data. Data in unlogged tables and sequences\n        is always excluded when dumping from a standby server.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--on-conflict-do-nothing\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Add \u003ccode class=\"literal\"\u003eON CONFLICT DO NOTHING\u003c/code\u003e to\n        \u003ccode class=\"command\"\u003eINSERT\u003c/code\u003e commands.\n        This option is not valid unless \u003ccode class=\"option\"\u003e--inserts\u003c/code\u003e,\n        \u003ccode class=\"option\"\u003e--column-inserts\u003c/code\u003e or\n        \u003ccode class=\"option\"\u003e--rows-per-insert\u003c/code\u003e is also specified.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--quote-all-identifiers\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Force quoting of all identifiers.  This option is recommended when\n        dumping a database from a server whose \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e\n        major version is different from \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e's, or when\n        the output is intended to be loaded into a server of a different\n        major version.  By default, \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e quotes only\n        identifiers that are reserved words in its own major version.\n        This sometimes results in compatibility issues when dealing with\n        servers of other versions that may have slightly different sets\n        of reserved words.  Using \u003ccode class=\"option\"\u003e--quote-all-identifiers\u003c/code\u003e prevents\n        such issues, at the price of a harder-to-read dump script.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        Use the provided string as the \u003cspan class=\"application\"\u003epsql\u003c/span\u003e\n\u003ccode class=\"command\"\u003e\\restrict\u003c/code\u003e key in the dump output.  If no restrict\n        key is specified,\n        \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e will generate a random one as\n        needed.  Keys may contain only alphanumeric characters.\n       \u003c/p\u003e\u003cp\u003e\n        This option is primarily intended for testing purposes and other\n        scenarios that require repeatable output (e.g., comparing dump files).\n        It is not recommended for general use, as a malicious server with\n        advance knowledge of the key may be able to inject arbitrary code that\n        will be executed on the machine that runs\n        \u003cspan class=\"application\"\u003epsql\u003c/span\u003e with the dump output.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        Dump data as \u003ccode class=\"command\"\u003eINSERT\u003c/code\u003e commands (rather than\n        \u003ccode class=\"command\"\u003eCOPY\u003c/code\u003e).  Controls the maximum number of rows per\n        \u003ccode class=\"command\"\u003eINSERT\u003c/code\u003e command. The value specified must be a\n        number greater than zero.  Any error during restoring will cause only\n        rows that are part of the problematic \u003ccode class=\"command\"\u003eINSERT\u003c/code\u003e to be\n        lost, rather than the entire table contents.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n          Only dump the named section. The section name can be\n          \u003ccode class=\"option\"\u003epre-data\u003c/code\u003e, \u003ccode class=\"option\"\u003edata\u003c/code\u003e, or \u003ccode class=\"option\"\u003epost-data\u003c/code\u003e.\n          This option can be specified more than once to select multiple\n          sections. The default is to dump all sections.\n         \u003c/p\u003e\u003cp\u003e\n          The data section contains actual table data, large-object\n          contents, sequence values, and statistics for tables,\n          materialized views, and foreign tables.\n          Post-data items include definitions of indexes, triggers, rules,\n          statistics for indexes, and constraints other than validated check\n          and not-null constraints.\n          Pre-data items include all other data definition items.\n         \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--sequence-data\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Include sequence data in the dump.  This is the default behavior except\n        when \u003ccode class=\"option\"\u003e--no-data\u003c/code\u003e, \u003ccode class=\"option\"\u003e--schema-only\u003c/code\u003e, or\n        \u003ccode class=\"option\"\u003e--statistics-only\u003c/code\u003e is specified.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--serializable-deferrable\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Use a \u003ccode class=\"literal\"\u003eserializable\u003c/code\u003e transaction for the dump, to\n        ensure that the snapshot used is consistent with later database\n        states; but do this by waiting for a point in the transaction stream\n        at which no anomalies can be present, so that there isn't a risk of\n        the dump failing or causing other transactions to roll back with a\n        \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\n        for more information about transaction isolation and concurrency\n        control.\n       \u003c/p\u003e\u003cp\u003e\n        This option is not beneficial for a dump which is intended only for\n        disaster recovery.  It could be useful for a dump used to load a\n        copy of the database for reporting or other read-only load sharing\n        while the original database continues to be updated.  Without it the\n        dump may reflect a state which is not consistent with any serial\n        execution of the transactions eventually committed.  For example, if\n        batch processing techniques are used, a batch may show as closed in\n        the dump without all of the items which are in the batch appearing.\n       \u003c/p\u003e\u003cp\u003e\n        This option will make no difference if there are no read-write\n        transactions active when pg_dump is started.  If read-write\n        transactions are active, the start of the dump may be delayed for an\n        indeterminate length of time.  Once running, performance with or\n        without the switch is the same.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n          Use the specified synchronized snapshot when making a dump of the\n          database (see\n          \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\n          details).\n         \u003c/p\u003e\u003cp\u003e\n          This option is useful when needing to synchronize the dump with\n          a logical replication slot (see \u003ca class=\"xref\" href=\"/docs/18/logicaldecoding.html\" title=\"Chapter 47. Logical Decoding\"\u003eChapter 47\u003c/a\u003e)\n          or with a concurrent session.\n         \u003c/p\u003e\u003cp\u003e\n          In the case of a parallel dump, the snapshot name defined by this\n          option is used rather than taking a new snapshot.\n         \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--statistics\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Dump optimizer statistics.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--statistics-only\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Dump only the statistics, not the schema (data definitions) or data.\n        Optimizer statistics for tables, materialized views, foreign tables,\n        and indexes are dumped.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--strict-names\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Require that each\n        extension (\u003ccode class=\"option\"\u003e-e\u003c/code\u003e/\u003ccode class=\"option\"\u003e--extension\u003c/code\u003e),\n        schema (\u003ccode class=\"option\"\u003e-n\u003c/code\u003e/\u003ccode class=\"option\"\u003e--schema\u003c/code\u003e) and\n        table (\u003ccode class=\"option\"\u003e-t\u003c/code\u003e/\u003ccode class=\"option\"\u003e--table\u003c/code\u003e) pattern\n        match at least one extension/schema/table in the database to be dumped.\n        This also applies to filters used with \u003ccode class=\"option\"\u003e--filter\u003c/code\u003e.\n        Note that if none of the extension/schema/table patterns find\n        matches, \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e will generate an error\n        even without \u003ccode class=\"option\"\u003e--strict-names\u003c/code\u003e.\n       \u003c/p\u003e\u003cp\u003e\n        This option has no effect\n        on \u003ccode class=\"option\"\u003e--exclude-extension\u003c/code\u003e,\n        \u003ccode class=\"option\"\u003e-N\u003c/code\u003e/\u003ccode class=\"option\"\u003e--exclude-schema\u003c/code\u003e,\n        \u003ccode class=\"option\"\u003e-T\u003c/code\u003e/\u003ccode class=\"option\"\u003e--exclude-table\u003c/code\u003e,\n        or \u003ccode class=\"option\"\u003e--exclude-table-data\u003c/code\u003e.  An exclude pattern failing\n        to match any objects is not considered an error.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        When set to \u003ccode class=\"literal\"\u003efsync\u003c/code\u003e, which is the default,\n        \u003ccode class=\"command\"\u003epg_dump --format=directory\u003c/code\u003e will recursively open and\n        synchronize all files in the archive directory.\n       \u003c/p\u003e\u003cp\u003e\n        On Linux, \u003ccode class=\"literal\"\u003esyncfs\u003c/code\u003e may be used instead to ask the\n        operating system to synchronize the whole file system that contains the\n        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\n        for information about the caveats to be aware of when using\n        \u003ccode class=\"literal\"\u003esyncfs\u003c/code\u003e.\n       \u003c/p\u003e\u003cp\u003e\n        This option has no effect when \u003ccode class=\"option\"\u003e--no-sync\u003c/code\u003e is used or\n        \u003ccode class=\"option\"\u003e--format\u003c/code\u003e is not set to \u003ccode class=\"literal\"\u003edirectory\u003c/code\u003e.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        This is the same as\n        the \u003ccode class=\"option\"\u003e-t\u003c/code\u003e/\u003ccode class=\"option\"\u003e--table\u003c/code\u003e option,\n        except that it also includes any partitions or inheritance child\n        tables of the table(s) matching the\n        \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--use-set-session-authorization\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Output SQL-standard \u003ccode class=\"command\"\u003eSET SESSION AUTHORIZATION\u003c/code\u003e commands\n        instead of \u003ccode class=\"command\"\u003eALTER OWNER\u003c/code\u003e commands to determine object\n        ownership.  This makes the dump more standards-compatible, but\n        depending on the history of the objects in the dump, might not restore\n        properly.  Also, a dump using \u003ccode class=\"command\"\u003eSET SESSION AUTHORIZATION\u003c/code\u003e\n        will certainly require superuser privileges to restore correctly,\n        whereas \u003ccode class=\"command\"\u003eALTER OWNER\u003c/code\u003e requires lesser privileges.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n       Show help about \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e command line\n       arguments, and exit.\n       \u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n    The following command-line options control the database connection parameters.\n\n    \u003c/p\u003e\u003cdiv class=\"variablelist\"\u003e\u003cdl class=\"variablelist\"\u003e\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\u003cdd\u003e\u003cp\u003e\n       Specifies the name of the database to connect to. This is\n       equivalent to specifying \u003cem class=\"replaceable\"\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e as the first non-option\n       argument on the command line.  The \u003cem class=\"replaceable\"\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e\n       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.\n       If so, connection string parameters will override any conflicting\n       command line options.\n      \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        Specifies the host name of the machine on which the server is\n        running.  If the value begins with a slash, it is used as the\n        directory for the Unix domain socket. The default is taken\n        from the \u003ccode class=\"envar\"\u003ePGHOST\u003c/code\u003e environment variable, if set,\n        else a Unix domain socket connection is attempted.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        Specifies the TCP port or local Unix domain socket file\n        extension on which the server is listening for connections.\n        Defaults to the \u003ccode class=\"envar\"\u003ePGPORT\u003c/code\u003e environment variable, if\n        set, or a compiled-in default.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        User name to connect as.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        Never issue a password prompt.  If the server requires\n        password authentication and a password is not available by\n        other means such as a \u003ccode class=\"filename\"\u003e.pgpass\u003c/code\u003e file, the\n        connection attempt will fail.  This option can be useful in\n        batch jobs and scripts where no user is present to enter a\n        password.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        Force \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e to prompt for a\n        password before connecting to a database.\n       \u003c/p\u003e\u003cp\u003e\n        This option is never essential, since\n        \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e will automatically prompt\n        for a password if the server demands password authentication.\n        However, \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e will waste a\n        connection attempt finding out that the server wants a password.\n        In some cases it is worth typing \u003ccode class=\"option\"\u003e-W\u003c/code\u003e to avoid the extra\n        connection attempt.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        Specifies a role name to be used to create the dump.\n        This option causes \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e to issue a\n        \u003ccode class=\"command\"\u003eSET ROLE\u003c/code\u003e \u003cem class=\"replaceable\"\u003e\u003ccode\u003erolename\u003c/code\u003e\u003c/em\u003e\n        command after connecting to the database. It is useful when the\n        authenticated user (specified by \u003ccode class=\"option\"\u003e-U\u003c/code\u003e) lacks privileges\n        needed by \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e, but can switch to a role with\n        the required rights.  Some installations have a policy against\n        logging in directly as a superuser, and use of this option allows\n        dumps to be made without violating the policy.\n       \u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e\u003cp\u003e\n\u003c/p\u003e\u003c/div\u003e\u003cdiv class=\"refsect1\" id=\"id-1.9.4.14.7\"\u003e\u003ch2\u003eEnvironment\u003c/h2\u003e\u003cdiv class=\"variablelist\"\u003e\u003cdl class=\"variablelist\"\u003e\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\u003cdd\u003e\u003cp\u003e\n      Default connection parameters.\n     \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003ePG_COLOR\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      Specifies whether to use color in diagnostic messages. Possible values\n      are \u003ccode class=\"literal\"\u003ealways\u003c/code\u003e, \u003ccode class=\"literal\"\u003eauto\u003c/code\u003e and\n      \u003ccode class=\"literal\"\u003enever\u003c/code\u003e.\n     \u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e\u003cp\u003e\n   This utility, like most other \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e utilities,\n   also uses the environment variables supported by \u003cspan class=\"application\"\u003elibpq\u003c/span\u003e\n   (see \u003ca class=\"xref\" href=\"/docs/18/libpq-envars.html\" title=\"32.15. Environment Variables\"\u003eSection 32.15\u003c/a\u003e).\n  \u003c/p\u003e\u003c/div\u003e\u003cdiv class=\"refsect1\" id=\"APP-PGDUMP-DIAGNOSTICS\"\u003e\u003ch2\u003eDiagnostics\u003c/h2\u003e\u003cp\u003e\n\u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e internally executes\n   \u003ccode class=\"command\"\u003eSELECT\u003c/code\u003e statements. If you have problems running\n   \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e, make sure you are able to\n   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\n   variables used by the \u003cspan class=\"application\"\u003elibpq\u003c/span\u003e front-end\n   library will apply.\n  \u003c/p\u003e\u003cp\u003e\n   The database activity of \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e is\n   normally collected by the cumulative statistics system.  If this is\n   undesirable, you can set parameter \u003ccode class=\"varname\"\u003etrack_counts\u003c/code\u003e\n   to false via \u003ccode class=\"envar\"\u003ePGOPTIONS\u003c/code\u003e or the \u003ccode class=\"literal\"\u003eALTER\n   USER\u003c/code\u003e command.\n  \u003c/p\u003e\u003c/div\u003e\u003cdiv class=\"refsect1\" id=\"PG-DUMP-NOTES\"\u003e\u003ch2\u003eNotes\u003c/h2\u003e\u003cp\u003e\n   If your database cluster has any local additions to the \u003ccode class=\"literal\"\u003etemplate1\u003c/code\u003e database,\n   be careful to restore the output of \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e into a\n   truly empty database; otherwise you are likely to get errors due to\n   duplicate definitions of the added objects.  To make an empty database\n   without any local additions, copy from \u003ccode class=\"literal\"\u003etemplate0\u003c/code\u003e not \u003ccode class=\"literal\"\u003etemplate1\u003c/code\u003e,\n   for example:\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003eCREATE DATABASE foo WITH TEMPLATE template0;\n\u003c/pre\u003e\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n   When a dump without schema is chosen and the option \u003ccode class=\"option\"\u003e--disable-triggers\u003c/code\u003e\n   is used, \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e emits commands\n   to disable triggers on user tables before inserting the data,\n   and then commands to re-enable them after the data has been\n   inserted.  If the restore is stopped in the middle, the system\n   catalogs might be left in the wrong state.\n  \u003c/p\u003e\u003cp\u003e\n   When \u003ccode class=\"option\"\u003e--statistics\u003c/code\u003e is specified,\n   \u003ccode class=\"command\"\u003epg_dump\u003c/code\u003e will include most optimizer statistics in the\n   resulting dump file.  This does not include all statistics, such as\n   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,\n   custom statistics added by an extension, or statistics collected by the\n   cumulative statistics system. Therefore, it may still be useful to\n   run \u003ccode class=\"command\"\u003eANALYZE\u003c/code\u003e after restoring from a dump file to ensure\n   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.\n  \u003c/p\u003e\u003cp\u003e\n   Because \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e is used to transfer data\n   to newer versions of \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e, the output of\n   \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e can be expected to load into\n   \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e server versions newer than\n   \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e's version.  \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e can also\n   dump from \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e servers older than its own version.\n   (Currently, servers back to version 9.2 are supported.)\n   However, \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e cannot dump from\n   \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e servers newer than its own major version;\n   it will refuse to even try, rather than risk making an invalid dump.\n   Also, it is not guaranteed that \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e's output can\n   be loaded into a server of an older major version — not even if the\n   dump was taken from a server of that version.  Loading a dump file\n   into an older server may require manual editing of the dump file\n   to remove syntax not understood by the older server.\n   Use of the \u003ccode class=\"option\"\u003e--quote-all-identifiers\u003c/code\u003e option is recommended\n   in cross-version cases, as it can prevent problems arising from varying\n   reserved-word lists in different \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e versions.\n  \u003c/p\u003e\u003cp\u003e\n   When dumping logical replication subscriptions,\n   \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e will generate \u003ccode class=\"command\"\u003eCREATE\n   SUBSCRIPTION\u003c/code\u003e commands that use the \u003ccode class=\"literal\"\u003econnect = false\u003c/code\u003e\n   option, so that restoring the subscription does not make remote connections\n   for creating a replication slot or for initial table copy.  That way, the\n   dump can be restored without requiring network access to the remote\n   servers.  It is then up to the user to reactivate the subscriptions in a\n   suitable way.  If the involved hosts have changed, the connection\n   information might have to be changed.  It might also be appropriate to\n   truncate the target tables before initiating a new full table copy.  If users\n   intend to copy initial data during refresh they must create the slot with\n   \u003ccode class=\"literal\"\u003etwo_phase = false\u003c/code\u003e.  After the initial sync, the\n   \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\n   option will be automatically enabled by the subscriber if the subscription\n   had been originally created with \u003ccode class=\"literal\"\u003etwo_phase = true\u003c/code\u003e option.\n  \u003c/p\u003e\u003cp\u003e\n   It is generally recommended to use the \u003ccode class=\"option\"\u003e-X\u003c/code\u003e\n   (\u003ccode class=\"option\"\u003e--no-psqlrc\u003c/code\u003e) option when restoring a database from a\n   plain-text \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e script to ensure a clean\n   restore process and prevent potential conflicts with\n   non-default \u003cspan class=\"application\"\u003epsql\u003c/span\u003e configurations.\n  \u003c/p\u003e\u003c/div\u003e\u003cdiv class=\"refsect1\" id=\"PG-DUMP-EXAMPLES\"\u003e\u003ch2\u003eExamples\u003c/h2\u003e\u003cp\u003e\n   To dump a database called \u003ccode class=\"literal\"\u003emydb\u003c/code\u003e into an SQL-script file:\n\u003c/p\u003e\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\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n   To reload such a script into a (freshly created) database named\n   \u003ccode class=\"literal\"\u003enewdb\u003c/code\u003e:\n\n\u003c/p\u003e\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\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n   To dump a database into a custom-format archive file:\n\n\u003c/p\u003e\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\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n   To dump a database into a directory-format archive:\n\n\u003c/p\u003e\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\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n   To dump a database into a directory-format archive in parallel with\n   5 worker jobs:\n\n\u003c/p\u003e\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\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n   To reload an archive file into a (freshly created) database named\n   \u003ccode class=\"literal\"\u003enewdb\u003c/code\u003e:\n\n\u003c/p\u003e\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\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n   To reload an archive file into the same database it was dumped from,\n   discarding the current contents of that database:\n\n\u003c/p\u003e\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\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n   To dump a single table named \u003ccode class=\"literal\"\u003emytab\u003c/code\u003e:\n\n\u003c/p\u003e\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\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n   To dump all tables whose names start with \u003ccode class=\"literal\"\u003eemp\u003c/code\u003e in the\n   \u003ccode class=\"literal\"\u003edetroit\u003c/code\u003e schema, except for the table named\n   \u003ccode class=\"literal\"\u003eemployee_log\u003c/code\u003e:\n\n\u003c/p\u003e\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\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n   To dump all schemas whose names start with \u003ccode class=\"literal\"\u003eeast\u003c/code\u003e or\n   \u003ccode class=\"literal\"\u003ewest\u003c/code\u003e and end in \u003ccode class=\"literal\"\u003egsm\u003c/code\u003e, excluding any schemas whose\n   names contain the word \u003ccode class=\"literal\"\u003etest\u003c/code\u003e:\n\n\u003c/p\u003e\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\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n   The same, using regular expression notation to consolidate the switches:\n\n\u003c/p\u003e\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\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n   To dump all database objects except for tables whose names begin with\n   \u003ccode class=\"literal\"\u003ets_\u003c/code\u003e:\n\n\u003c/p\u003e\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\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n   To specify an upper-case or mixed-case name in \u003ccode class=\"option\"\u003e-t\u003c/code\u003e and related\n   switches, you need to double-quote the name; else it will be folded to\n   lower case (see \u003ca class=\"xref\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003ePatterns\u003c/a\u003e).  But\n   double quotes are special to the shell, so in turn they must be quoted.\n   Thus, to dump a single table with a mixed-case name, you need something\n   like\n\n\u003c/p\u003e\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\u003cp\u003e\n   To dump all tables whose names start with \u003ccode class=\"literal\"\u003emytable\u003c/code\u003e, except\n   for table \u003ccode class=\"literal\"\u003emytable2\u003c/code\u003e, specify a filter file\n   \u003ccode class=\"filename\"\u003efilter.txt\u003c/code\u003e like:\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003einclude table mytable*\nexclude table mytable2\n\u003c/pre\u003e\u003cp\u003e\n\u003c/p\u003e\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\u003c/div\u003e\u003cdiv class=\"refsect1\" id=\"id-1.9.4.14.11\"\u003e\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\u003c/div\u003e\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. 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. 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"}],"related_zh":[{"label":"libpq 连接参数","url":"/wiki/conn/?v=18"}],"release":{"channel":"stable","evidence_kind":"English manual and source declarations","label":"18.7","major":"18","manifest":{"major":"18","release":"18.7","source_sha256":"441dfae4280cae3e0425e5f876f80559fb0731c140f1aae22b3e5a54d0411bfd","source_url":"https://ftp.postgresql.org/pub/source/v18.7/postgresql-18.7.tar.bz2"},"ref":"https://ftp.postgresql.org/pub/source/v18.7/postgresql-18.7.tar.bz2","revision":"1b2d62b4845aa46374f2cb680f95d3392322cc8128646992ae4e18d0e7084915","source_sha256":"441dfae4280cae3e0425e5f876f80559fb0731c140f1aae22b3e5a54d0411bfd"},"sections":[],"sections_zh":[],"signature":"pg_dump [ connection-option ...] [ option ...] [ dbname ]","sources":[{"anchor":"","file":"app-pgdump.html","label":"18.7 English manual · app-pgdump.html","sha256":"2a808d6692816614b8c6adf7c870f13710b41951bd073375046f0676f33ab5ac","url":"/docs/18/app-pgdump.html"},{"anchor":"","file":"reference-client.html","label":"Client applications inventory","sha256":"a1c669b9a6dab81388171b696e61109033d96d2c4d5487219c77f62f14aecfa1","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. 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"}],"tables_zh":[{"columns":[{"key":"signature","label":"选项与参数"},{"key":"summary","label":"说明"}],"key":"options","rows":[{"signature":{"text":"-a --data-only","url":"/docs/18/app-pgdump.html"},"summary":"只转储数据，不转储模式（数据定义）或统计信息。会转储表数据、大对象和序列值。"},{"signature":{"text":"-b --large-objects --blobs （已弃用）","url":"/docs/18/app-pgdump.html"},"summary":"在转储中包含大对象。除非指定了 --schema 、 --table 、 --schema-only 、 --statistics-only 或 --no-data ，否则这是默认行为。因此， -b 开关只在已经请求了特定模式或表的转储中，需要把大对象再加回来时才有用。注意，大对象被视为数据，因此在使用 --data-only 时会包含，在使用 --schema-only 或 --statistics-only 时则不会包含。"},{"signature":{"text":"-B --no-large-objects --no-blobs （已弃用）","url":"/docs/18/app-pgdump.html"},"summary":"在转储中排除大对象。"},{"signature":{"text":"-c --clean","url":"/docs/18/app-pgdump.html"},"summary":"在输出创建这些对象的命令之前，先输出用于 DROP 所有被转储数据库对象的命令。当恢复要覆盖现有数据库时，此选项很有用。如果目标数据库中某些对象不存在，则在恢复期间会报告可忽略的错误信息，除非还指定了 --if-exists 。"},{"signature":{"text":"-C --create","url":"/docs/18/app-pgdump.html"},"summary":"让输出以创建数据库本身并重新连接到新建数据库的命令开始。（使用这种形式的脚本时，在目标安装中先连接到哪个数据库再运行脚本都无关紧要。）如果还指定了 --clean ，则脚本会在重新连接到目标数据库之前先删除并重新创建它。"},{"signature":{"text":"-e pattern --extension= pattern","url":"/docs/18/app-pgdump.html"},"summary":"仅转储与 pattern 匹配的扩展。当未指定此选项时，将转储目标数据库中的所有非系统扩展。可以通过写多个 -e 开关来选择多个扩展。 pattern 参数按照 psql 的 \\d 命令所使用的同样规则进行解释（请参阅 模式 ），因此也可以通过在模式中使用通配符来选择多个扩展。使用通配符时，如有需要请小心为模式加引号，以防止 shell 展开通配符。"},{"signature":{"text":"-E encoding --encoding= encoding","url":"/docs/18/app-pgdump.html"},"summary":"在指定的字符集编码中创建转储。默认情况下，转储将以数据库编码创建。（获得相同结果的另一种方法是将 PGCLIENTENCODING 环境变量设置为所需的转储编码。）支持的编码在 第 23.3.1 节 中描述。"},{"signature":{"text":"-f file --file= file","url":"/docs/18/app-pgdump.html"},"summary":"将输出发送到指定文件。对于基于文件的输出格式，可以省略此参数，这时使用标准输出。不过，对于目录输出格式，必须给出此参数，因为它指定的是目标目录而不是文件。在这种情况下，该目录由 pg_dump 创建，并且在此之前必须不存在。"},{"signature":{"text":"-F format --format= format","url":"/docs/18/app-pgdump.html"},"summary":"选择输出的格式。 format 可以是以下之一："},{"signature":{"text":"-j njobs --jobs= njobs","url":"/docs/18/app-pgdump.html"},"summary":"以并行方式运行转储，同时转储 njobs 个表。此选项可能减少执行转储所需的时间，但也会增加数据库服务器的负载。只能在目录输出格式下使用此选项，因为只有这种输出格式允许多个进程同时写入数据。"},{"signature":{"text":"-n pattern --schema= pattern","url":"/docs/18/app-pgdump.html"},"summary":"只转储匹配 pattern 的模式；这既会选择模式本身，也会选择其中包含的所有对象。未指定此选项时，将转储目标数据库中的所有非系统模式。可以通过写多个 -n 开关来选择多个模式。 pattern 参数按照 psql 的 \\d 命令所使用的同样规则进行解释（见 模式 ），因此也可以通过在模式中使用通配符来选择多个模式。使用通配符时，如有需要请小心为模式加引号，以防止 shell 展开通配符；见下文的 示例 。"},{"signature":{"text":"-N pattern --exclude-schema= pattern","url":"/docs/18/app-pgdump.html"},"summary":"不转储任何匹配 pattern 的模式。该模式按照与 -n 相同的规则解释。 -N 可以给出多次，以排除匹配所给模式中任意一个的模式。"},{"signature":{"text":"-O --no-owner","url":"/docs/18/app-pgdump.html"},"summary":"不输出用于把对象所有权设置成与原始数据库一致的命令。默认情况下， pg_dump 会发出 ALTER OWNER 或 SET SESSION AUTHORIZATION 语句来设置新建数据库对象的所有权。除非脚本由超级用户（或拥有脚本中所有对象的同一用户）启动，否则这些语句会在运行脚本时报错。若要创建一个可由任意用户恢复、并让该用户拥有所有对象的脚本，请指定 -O 。"},{"signature":{"text":"-R --no-reconnect","url":"/docs/18/app-pgdump.html"},"summary":"这个选项已经过时，但仍然被接受以保持向后兼容性。"},{"signature":{"text":"-s --schema-only","url":"/docs/18/app-pgdump.html"},"summary":"只转储对象定义（模式），不转储数据或统计信息。"},{"signature":{"text":"-S username --superuser= username","url":"/docs/18/app-pgdump.html"},"summary":"指定在禁用触发器时要使用的超级用户名。这只在使用 --disable-triggers 时相关。（通常最好省略它，而是以超级用户身份运行生成的脚本。）"},{"signature":{"text":"-t pattern --table= pattern","url":"/docs/18/app-pgdump.html"},"summary":"只转储名称匹配 pattern 的表。可以通过写多个 -t 开关来选择多个表。 pattern 参数按照 psql 的 \\d 命令所使用的同样规则进行解释（见 模式 ），因此也可以通过在模式中使用通配符来选择多个表。使用通配符时，如有需要请小心为模式加引号，以防止 shell 展开通配符；见下文的 示例 。"},{"signature":{"text":"-T pattern --exclude-table= pattern","url":"/docs/18/app-pgdump.html"},"summary":"不转储任何匹配 pattern 的表。该模式按照与 -t 相同的规则解释。 -T 可以给出多次，以排除匹配所给模式中任意一个的表。"},{"signature":{"text":"-v --verbose","url":"/docs/18/app-pgdump.html"},"summary":"指定详细模式。这会使 pg_dump 将详细的对象注释、开始/停止时间写入转储文件，并把进度消息写到标准错误。重复该选项会让更多调试级别消息出现在标准错误中。"},{"signature":{"text":"-V --version","url":"/docs/18/app-pgdump.html"},"summary":"打印 pg_dump 的版本并退出。"},{"signature":{"text":"-x --no-privileges --no-acl","url":"/docs/18/app-pgdump.html"},"summary":"不转储访问权限（grant/revoke 命令）。"},{"signature":{"text":"-Z level -Z method [: detail ] --compress= level --compress= method [: detail ]","url":"/docs/18/app-pgdump.html"},"summary":"指定要使用的压缩方法和/或压缩级别。压缩方法可以设置为 gzip 、 lz4 、 zstd 或 none （表示不压缩）。也可以选择指定压缩细节字符串。如果细节字符串是一个整数，则表示压缩级别；否则，它应是一个用逗号分隔的项列表，每项形如 keyword 或 keyword=value 。目前支持的关键字是 level 和 long 。"},{"signature":{"text":"--binary-upgrade","url":"/docs/18/app-pgdump.html"},"summary":"此选项供就地升级实用程序使用。不建议也不支持将其用于其他目的。该选项的行为可能在未来的版本中更改而不另行通知。"},{"signature":{"text":"--column-inserts --attribute-inserts","url":"/docs/18/app-pgdump.html"},"summary":"将数据转储为带有显式列名的 INSERT 命令（ INSERT INTO table ( column , ...) VALUES ... ）。这会使恢复变得非常缓慢；它主要用于生成可装入非 PostgreSQL 数据库的转储文件。恢复期间发生的任何错误都只会导致有问题的 INSERT 所包含的行丢失，而不会导致整个表内容丢失。"},{"signature":{"text":"--disable-dollar-quoting","url":"/docs/18/app-pgdump.html"},"summary":"此选项禁用对函数体的美元引用，并强制用 SQL 标准字符串语法对它们加引号。"},{"signature":{"text":"--disable-triggers","url":"/docs/18/app-pgdump.html"},"summary":"此选项只在创建包含数据但不包含模式的转储时才相关。它指示 pg_dump 在输出中包含一些命令，以便在恢复数据时临时禁用目标表上的触发器。如果这些表上存在不希望在数据恢复期间触发的引用完整性检查或其他触发器，请使用此选项。"},{"signature":{"text":"--enable-row-security","url":"/docs/18/app-pgdump.html"},"summary":"此选项只在转储启用了行安全的表内容时才相关。默认情况下， pg_dump 会将 row_security 设置为 off，以确保把表中的所有数据都转储出来。如果用户没有足够的权限绕过行安全，则会抛出错误。该参数会指示 pg_dump 改为将 row_security 设置为 on，从而允许用户只转储其有权访问的那部分表内容。"},{"signature":{"text":"--exclude-extension= pattern","url":"/docs/18/app-pgdump.html"},"summary":"不转储任何匹配 pattern 的扩展。该模式按照与 -e 相同的规则解释。 --exclude-extension 可以给出多次，以排除匹配所给模式中任意一个的扩展。"},{"signature":{"text":"--exclude-table-and-children= pattern","url":"/docs/18/app-pgdump.html"},"summary":"这与 -T / --exclude-table 选项相同，只是它还会排除匹配 pattern 的表的任何分区或继承子表。"},{"signature":{"text":"--exclude-table-data= pattern","url":"/docs/18/app-pgdump.html"},"summary":"不转储任何匹配 pattern 的表的数据。该模式按照与 -t 相同的规则解释。 --exclude-table-data 可以给出多次，以排除匹配所给模式中任意一个的表。当需要某个特定表的定义、但不需要其中数据时，此选项很有用。"},{"signature":{"text":"--exclude-table-data-and-children= pattern","url":"/docs/18/app-pgdump.html"},"summary":"这与 --exclude-table-data 选项相同，只是它还会排除匹配 pattern 的表的任何分区或继承子表的数据。"},{"signature":{"text":"--extra-float-digits= ndigits","url":"/docs/18/app-pgdump.html"},"summary":"在转储浮点数据时，使用指定的 extra_float_digits 值，而不是最大可用精度。出于备份目的的常规转储不应使用此选项。"},{"signature":{"text":"--filter= filename","url":"/docs/18/app-pgdump.html"},"summary":"指定一个文件名，从中读取要在转储中包含或排除的对象匹配模式。模式按照对应选项的同样规则解释：对于表，使用 -t / --table 、 --table-and-children 、 -T / --exclude-table 和 --exclude-table-and-children 的规则；对于模式，使用 -n / --schema 和 -N / --exclude-schema 的规则；对于外部服务器上的数据，使用 --include-foreign-data 的规则；对于表数据，使用 --exclude-table-data 和 --exclude-table-data-and-children 的规则；对于扩展，使用 -e / --extension 和 --exclude-extension 的规则。若要从 STDIN 读取，请使用 - 作为文件名。 --filter 选项可以与上述包含或排除对象的选项一起使用，也可以为多个过滤文件指定多次。"},{"signature":{"text":"--if-exists","url":"/docs/18/app-pgdump.html"},"summary":"使用 DROP ... IF EXISTS 命令在 --clean 模式下删除对象。这会抑制原本可能报告的 “ does not exist ” 错误信息。除非同时指定了 --clean ，否则此选项无效。"},{"signature":{"text":"--include-foreign-data= foreignserver","url":"/docs/18/app-pgdump.html"},"summary":"转储任何外部表的数据，只要其外部服务器匹配 foreignserver 模式。可以通过写多个 --include-foreign-data 开关来选择多个外部服务器。此外， foreignserver 参数按照 psql 的 \\d 命令所使用的同样规则进行解释（见 模式 ），因此也可以通过在模式中使用通配符来选择多个外部服务器。使用通配符时，如有需要请小心为模式加引号，以防止 shell 展开通配符；见下文的 示例 。唯一的例外是不允许空模式。"},{"signature":{"text":"--inserts","url":"/docs/18/app-pgdump.html"},"summary":"把数据转储为 INSERT 命令（而不是 COPY ）。这会使恢复非常缓慢；它主要用于生成可装入非 PostgreSQL 数据库的转储。恢复期间发生的任何错误都只会导致有问题的 INSERT 所包含的行丢失，而不会导致整个表内容丢失。注意，如果重新安排了列顺序，恢复可能会彻底失败。 --column-inserts 选项可以避免列顺序变化带来的问题，但速度更慢。"},{"signature":{"text":"--load-via-partition-root","url":"/docs/18/app-pgdump.html"},"summary":"当为表分区转储数据时，让 COPY 或 INSERT 语句以包含该分区的分区层次结构根为目标，而不是以该分区本身为目标。这会导致在加载数据时为每一行重新确定适当的分区。当在另一台服务器上恢复数据，而行并不总是落在与原始服务器相同的分区中时，这可能很有用。例如，如果分区列是 text 类型，而两个系统对用于排序该分区列的排序规则定义不同，就可能发生这种情况。"},{"signature":{"text":"--lock-wait-timeout= timeout","url":"/docs/18/app-pgdump.html"},"summary":"在转储开始时，不要无限等待获取共享表锁。如果无法在指定的 timeout 内锁定某个表，就让转储失败。超时可以用 SET statement_timeout 接受的任意格式指定。（允许的格式因被转储源服务器的版本而异，但所有版本都接受以毫秒为单位的整数。）"},{"signature":{"text":"--no-comments","url":"/docs/18/app-pgdump.html"},"summary":"不要转储 COMMENT 命令。"},{"signature":{"text":"--no-data","url":"/docs/18/app-pgdump.html"},"summary":"不要转储数据。"},{"signature":{"text":"--no-policies","url":"/docs/18/app-pgdump.html"},"summary":"不要转储行安全性策略。"},{"signature":{"text":"--no-publications","url":"/docs/18/app-pgdump.html"},"summary":"不要转储发布。"},{"signature":{"text":"--no-schema","url":"/docs/18/app-pgdump.html"},"summary":"不要转储模式（数据定义）。"},{"signature":{"text":"--no-security-labels","url":"/docs/18/app-pgdump.html"},"summary":"不要转储安全标签。"},{"signature":{"text":"--no-statistics","url":"/docs/18/app-pgdump.html"},"summary":"不要转储统计信息。这是默认行为。"},{"signature":{"text":"--no-subscriptions","url":"/docs/18/app-pgdump.html"},"summary":"不要转储订阅。"},{"signature":{"text":"--no-sync","url":"/docs/18/app-pgdump.html"},"summary":"默认情况下， pg_dump 会等待所有文件都被安全写入磁盘。该选项会使 pg_dump 立即返回而不等待，这样更快，但意味着随后如果操作系统崩溃，转储可能会损坏。通常，此选项适用于测试，但不应在从生产安装转储数据时使用。"},{"signature":{"text":"--no-table-access-method","url":"/docs/18/app-pgdump.html"},"summary":"不输出用于选择表访问方法的命令。使用此选项时，所有对象在恢复时都会使用当时默认的表访问方法创建。"},{"signature":{"text":"--no-tablespaces","url":"/docs/18/app-pgdump.html"},"summary":"不输出用于选择表空间的命令。使用此选项时，所有对象在恢复时都会创建在当时默认的表空间中。"},{"signature":{"text":"--no-toast-compression","url":"/docs/18/app-pgdump.html"},"summary":"不输出用于设置 TOAST 压缩方法的命令。使用此选项时，所有列都会以默认压缩设置恢复。"},{"signature":{"text":"--no-unlogged-table-data","url":"/docs/18/app-pgdump.html"},"summary":"不要转储不记录 WAL 的表和序列的内容。此选项不会影响是否转储表和序列的定义（模式）；它只会抑制表和序列数据的转储。从备库转储时，不记录 WAL 的表和序列中的数据始终会被排除。"},{"signature":{"text":"--on-conflict-do-nothing","url":"/docs/18/app-pgdump.html"},"summary":"添加 ON CONFLICT DO NOTHING 到 INSERT 命令中。除非同时指定了 --inserts 、 --column-inserts 或 --rows-per-insert ，否则此选项无效。"},{"signature":{"text":"--quote-all-identifiers","url":"/docs/18/app-pgdump.html"},"summary":"强制为所有标识符加引号。当从某个服务器转储数据库，而该服务器的 PostgreSQL 主版本与 pg_dump 不同，或者输出打算装入另一主版本的服务器时，推荐使用此选项。默认情况下， pg_dump 只会为在其自身主版本中属于保留字的标识符加引号。这有时会在处理其他版本服务器时导致兼容性问题，因为这些版本的保留字集合可能略有不同。使用 --quote-all-identifiers 可以防止此类问题，但代价是转储脚本更难阅读。"},{"signature":{"text":"--restrict-key= restrict_key","url":"/docs/18/app-pgdump.html"},"summary":"在转储输出中，把给定字符串用作 psql 的 \\restrict 键。若未指定该键， pg_dump 会按需要随机生成一个。键只能包含字母数字字符。"},{"signature":{"text":"--rows-per-insert= nrows","url":"/docs/18/app-pgdump.html"},"summary":"将数据转储为 INSERT 命令（而不是 COPY ）。它控制每个 INSERT 命令的最大行数。指定的值必须是大于零的数字。恢复过程中的任何错误将导致只有属于有问题的 INSERT 的行丢失，而不是整个表的内容。"},{"signature":{"text":"--section= sectionname","url":"/docs/18/app-pgdump.html"},"summary":"仅转储指定的部分。部分名称可以是 pre-data 、 data 或 post-data 。可以多次指定此选项以选择多个部分。默认情况下是转储所有部分。"},{"signature":{"text":"--sequence-data","url":"/docs/18/app-pgdump.html"},"summary":"在转储中包含序列数据。除非指定了 --no-data 、 --schema-only 或 --statistics-only ，否则这是默认行为。"},{"signature":{"text":"--serializable-deferrable","url":"/docs/18/app-pgdump.html"},"summary":"使用 serializable 事务来执行转储，以确保所用快照与后续数据库状态一致；但这是通过等待事务流到达一个不会出现异常的时点来实现的，从而避免转储失败或导致其他事务因 serialization_failure 而回滚。有关事务隔离和并发控制的更多信息，请参见 第 13 章 。"},{"signature":{"text":"--snapshot= snapshotname","url":"/docs/18/app-pgdump.html"},"summary":"在制作数据库转储时，使用指定的同步快照（详见 表 9.100 ）。"},{"signature":{"text":"--statistics","url":"/docs/18/app-pgdump.html"},"summary":"转储优化器统计信息。"},{"signature":{"text":"--statistics-only","url":"/docs/18/app-pgdump.html"},"summary":"只转储统计信息，不转储模式（数据定义）或数据。会转储表、物化视图、外部表和索引的优化器统计信息。"},{"signature":{"text":"--strict-names","url":"/docs/18/app-pgdump.html"},"summary":"要求每个扩展（ -e / --extension ）、模式（ -n / --schema ）和表（ -t / --table ）模式在要转储的数据库中至少匹配一个扩展/模式/表。这也适用于配合 --filter 使用的过滤器。请注意，如果所有扩展/模式/表模式都找不到匹配项，那么 pg_dump 即使在不使用 --strict-names 的情况下也会报错。"},{"signature":{"text":"--sync-method= method","url":"/docs/18/app-pgdump.html"},"summary":"当设为 fsync 时（这是默认值）， pg_dump --format=directory 会递归打开并同步归档目录中的所有文件。"},{"signature":{"text":"--table-and-children= pattern","url":"/docs/18/app-pgdump.html"},"summary":"这与 -t / --table 选项相同，只是它还会包含匹配 pattern 的表的任何分区或继承子表。"},{"signature":{"text":"--use-set-session-authorization","url":"/docs/18/app-pgdump.html"},"summary":"输出符合 SQL 标准的 SET SESSION AUTHORIZATION 命令，而不是 ALTER OWNER 命令来确定对象所有权。这会让转储更符合标准，但根据转储中对象的历史，可能无法正确恢复。另外，使用 SET SESSION AUTHORIZATION 的转储肯定需要超级用户权限才能正确恢复，而 ALTER OWNER 只需较低权限。"},{"signature":{"text":"-? --help","url":"/docs/18/app-pgdump.html"},"summary":"显示关于 pg_dump 命令行参数的帮助信息，并退出。"},{"signature":{"text":"-d dbname --dbname= dbname","url":"/docs/18/app-pgdump.html"},"summary":"指定要连接的数据库名称。这等价于在命令行上把 dbname 作为第一个非选项参数指定。 dbname 可以是 连接字符串 。如果是这样，连接字符串中的参数将覆盖任何冲突的命令行选项。"},{"signature":{"text":"-h host --host= host","url":"/docs/18/app-pgdump.html"},"summary":"指定服务器所在机器的主机名。如果值以斜杠开头，则被用作 Unix 域套接字的目录。默认值取自 PGHOST 环境变量（如果已设置），否则尝试使用 Unix 域套接字连接。"},{"signature":{"text":"-p port --port= port","url":"/docs/18/app-pgdump.html"},"summary":"指定服务器正在监听连接的 TCP 端口，或本地 Unix 域套接字文件扩展名。默认值取自 PGPORT 环境变量（如果已设置），否则使用编译时默认值。"},{"signature":{"text":"-U username --username= username","url":"/docs/18/app-pgdump.html"},"summary":"用于连接的用户名。"},{"signature":{"text":"-w --no-password","url":"/docs/18/app-pgdump.html"},"summary":"绝不发出密码提示。如果服务器要求密码认证，而又无法通过 .pgpass 文件等其他方式获得密码，则连接尝试将失败。在没有用户在场输入密码的批处理作业和脚本中，此选项很有用。"},{"signature":{"text":"-W --password","url":"/docs/18/app-pgdump.html"},"summary":"强制 pg_dump 在连接数据库之前提示输入密码。"},{"signature":{"text":"--role= rolename","url":"/docs/18/app-pgdump.html"},"summary":"指定用于创建转储的角色名称。此选项会让 pg_dump 在连接数据库后发出 SET ROLE rolename 命令。当已认证用户（由 -U 指定）缺少 pg_dump 所需权限，但可以切换到具有所需权限的角色时，此选项很有用。有些安装环境有禁止直接以超级用户登录的策略，使用此选项就可以在不违反该策略的情况下进行转储。"}],"title":"手册中的选项"},{"columns":[{"key":"name","label":"变量"},{"key":"description","label":"含义"}],"key":"environment","rows":[{"description":"默认连接参数。","name":"PGDATABASE PGHOST PGOPTIONS PGPORT PGUSER"},{"description":"指定诊断消息是否使用颜色。可选值为 always 、 auto 和 never 。","name":"PG_COLOR"}],"title":"环境变量"}],"zh_from":"same-version-manual"},"ManualEvidence":{"manual_path":"app-pgdump.html","release":{"channel":"stable","evidence_kind":"English manual and source declarations","label":"18.7","major":"18","manifest":{"major":"18","release":"18.7","source_sha256":"441dfae4280cae3e0425e5f876f80559fb0731c140f1aae22b3e5a54d0411bfd","source_url":"https://ftp.postgresql.org/pub/source/v18.7/postgresql-18.7.tar.bz2"},"ref":"https://ftp.postgresql.org/pub/source/v18.7/postgresql-18.7.tar.bz2","revision":"1b2d62b4845aa46374f2cb680f95d3392322cc8128646992ae4e18d0e7084915","source_sha256":"441dfae4280cae3e0425e5f876f80559fb0731c140f1aae22b3e5a54d0411bfd"},"sources":[{"anchor":"","file":"app-pgdump.html","label":"18.7 English manual · app-pgdump.html","sha256":"2a808d6692816614b8c6adf7c870f13710b41951bd073375046f0676f33ab5ac","url":"/docs/18/app-pgdump.html"},{"anchor":"","file":"reference-client.html","label":"Client applications inventory","sha256":"a1c669b9a6dab81388171b696e61109033d96d2c4d5487219c77f62f14aecfa1","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\u003cdiv\u003e\u003c/div\u003e\u003cdiv\u003e\u003ch2\u003e\u003cspan\u003e\u003cspan\u003epg_dump\u003c/span\u003e\u003c/span\u003e\u003c/h2\u003e\u003cp\u003epg_dump — \n   export a \u003cspan\u003ePostgreSQL\u003c/span\u003e database as an SQL script or to other formats\n  \u003c/p\u003e\u003c/div\u003e\u003cdiv\u003e\u003ch2\u003eSynopsis\u003c/h2\u003e\u003cdiv\u003e\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\u003c/div\u003e\u003c/div\u003e\u003cdiv id=\"PG-DUMP-DESCRIPTION\"\u003e\u003ch2\u003eDescription\u003c/h2\u003e\u003cp\u003e\n\u003cspan\u003epg_dump\u003c/span\u003e is a utility for exporting a\n   \u003cspan\u003ePostgreSQL\u003c/span\u003e database. It makes consistent\n   exports even if the database is being used concurrently.\n   \u003cspan\u003epg_dump\u003c/span\u003e does not block other users\n   accessing the database (readers or writers).\n   Note, however, that except in simple cases,\n   \u003cspan\u003epg_dump\u003c/span\u003e is generally not the right choice for\n   taking regular backups of production databases.  See \u003ca href=\"/docs/18/backup.html\" rel=\"nofollow\"\u003eChapter 25\u003c/a\u003e for further discussion.\n  \u003c/p\u003e\u003cp\u003e\n\u003cspan\u003epg_dump\u003c/span\u003e only dumps a single database.\n   To export an entire cluster, or to export global objects that are\n   common to all databases in a cluster (such as roles and tablespaces),\n   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.\n  \u003c/p\u003e\u003cp\u003e\n   Dumps can be output in script or archive file formats. Script\n   dumps are plain-text files containing the SQL commands required\n   to reconstruct the database to the state it was in at the time it was\n   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\n   can be used to reconstruct the database even on other machines and\n   other architectures; with some modifications, even on other SQL\n   database products.\n  \u003c/p\u003e\u003cp\u003e\n   The alternative archive file formats must be used with\n   \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\n   allow \u003cspan\u003epg_restore\u003c/span\u003e to be selective about\n   what is restored, or even to reorder the items prior to being\n   restored.\n   The archive file formats are designed to be portable across\n   architectures.\n  \u003c/p\u003e\u003cp\u003e\n   When used with one of the archive file formats and combined with\n   \u003cspan\u003epg_restore\u003c/span\u003e,\n   \u003cspan\u003epg_dump\u003c/span\u003e provides a flexible archival and\n   transfer mechanism. \u003cspan\u003epg_dump\u003c/span\u003e can be used to\n   export an entire database, then \u003cspan\u003epg_restore\u003c/span\u003e\n   can be used to examine the archive and/or select which parts of the\n   database are to be restored. The most flexible output file formats are\n   the \u003cspan\u003e“\u003cspan\u003ecustom\u003c/span\u003e”\u003c/span\u003e format (\u003ccode\u003e-Fc\u003c/code\u003e) and the\n   \u003cspan\u003e“\u003cspan\u003edirectory\u003c/span\u003e”\u003c/span\u003e format (\u003ccode\u003e-Fd\u003c/code\u003e). They allow\n   for selection and reordering of all archived items, support parallel\n   restoration, and are compressed by default. The \u003cspan\u003e“\u003cspan\u003edirectory\u003c/span\u003e”\u003c/span\u003e\n   format is the only format that supports parallel dumps.\n  \u003c/p\u003e\u003cp\u003e\n   While running \u003cspan\u003epg_dump\u003c/span\u003e, one should examine the\n   output for any warnings (printed on standard error), especially in\n   light of the limitations listed below.\n  \u003c/p\u003e\u003cdiv\u003e\u003ch3\u003eWarning\u003c/h3\u003e\u003cp\u003e\n    Restoring a dump causes the destination to execute arbitrary code of the\n    source superusers\u0026#39; choice.  Partial dumps and partial restores do not limit\n    that.  If the source superusers are not trusted, the dumped SQL statements\n    must be inspected before restoring.  Non-plain-text dumps can be inspected\n    by using \u003cspan\u003epg_restore\u003c/span\u003e\u0026#39;s \u003ccode\u003e--file\u003c/code\u003e\n    option.  Note that the client running the dump and restore need not trust\n    the source or destination superusers.\n   \u003c/p\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv id=\"PG-DUMP-OPTIONS\"\u003e\u003ch2\u003eOptions\u003c/h2\u003e\u003cp\u003e\n    The following command-line options control the content and\n    format of the output.\n\n    \u003c/p\u003e\u003cdiv\u003e\u003cdl\u003e\u003cdt\u003e\u003cspan\u003e\u003cem\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Specifies the name of the database to be dumped.  If this is\n        not specified, the environment variable\n        \u003ccode\u003ePGDATABASE\u003c/code\u003e is used.  If that is not set, the\n        user name specified for the connection is used.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        Dump only the data, not the schema (data definitions) or statistics.\n        Table data, large objects, and sequence values are dumped.\n       \u003c/p\u003e\u003cp\u003e\n        This option is similar to, but for historical reasons not identical\n        to, specifying \u003ccode\u003e--section=data\u003c/code\u003e.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        Include large objects in the dump.  This is the default behavior\n        except when \u003ccode\u003e--schema\u003c/code\u003e, \u003ccode\u003e--table\u003c/code\u003e,\n        \u003ccode\u003e--schema-only\u003c/code\u003e, \u003ccode\u003e--statistics-only\u003c/code\u003e, or\n        \u003ccode\u003e--no-data\u003c/code\u003e is specified.  The \u003ccode\u003e-b\u003c/code\u003e\n        switch is therefore only useful to add large objects to dumps where a\n        specific schema or table has been requested.  Note that large objects\n        are considered data and therefore will be included when\n        \u003ccode\u003e--data-only\u003c/code\u003e is used, but not when\n        \u003ccode\u003e--schema-only\u003c/code\u003e or \u003ccode\u003e--statistics-only\u003c/code\u003e\n        is.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        Exclude large objects in the dump.\n       \u003c/p\u003e\u003cp\u003e\n        When both \u003ccode\u003e-b\u003c/code\u003e and \u003ccode\u003e-B\u003c/code\u003e are given, the behavior\n        is to output large objects, when data is being dumped, see the\n        \u003ccode\u003e-b\u003c/code\u003e documentation.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        Output commands to \u003ccode\u003eDROP\u003c/code\u003e all the dumped\n        database objects prior to outputting the commands for creating them.\n        This option is useful when the restore is to overwrite an existing\n        database.  If any of the objects do not exist in the destination\n        database, ignorable error messages will be reported during\n        restore, unless \u003ccode\u003e--if-exists\u003c/code\u003e is also specified.\n       \u003c/p\u003e\u003cp\u003e\n        This option is ignored when emitting an archive (non-text) output\n        file.  For the archive formats, you can specify the option when you\n        call \u003ccode\u003epg_restore\u003c/code\u003e.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        Begin the output with a command to create the\n        database itself and reconnect to the created database.  (With a\n        script of this form, it doesn\u0026#39;t matter which database in the\n        destination installation you connect to before running the script.)\n        If \u003ccode\u003e--clean\u003c/code\u003e is also specified, the script drops and\n        recreates the target database before reconnecting to it.\n       \u003c/p\u003e\u003cp\u003e\n        With \u003ccode\u003e--create\u003c/code\u003e, the output also includes the\n        database\u0026#39;s comment if any, and any configuration variable settings\n        that are specific to this database, that is,\n        any \u003ccode\u003eALTER DATABASE ... SET ...\u003c/code\u003e\n        and \u003ccode\u003eALTER ROLE ... IN DATABASE ... SET ...\u003c/code\u003e\n        commands that mention this database.\n        Access privileges for the database itself are also dumped,\n        unless \u003ccode\u003e--no-acl\u003c/code\u003e is specified.\n       \u003c/p\u003e\u003cp\u003e\n        This option is ignored when emitting an archive (non-text) output\n        file.  For the archive formats, you can specify the option when you\n        call \u003ccode\u003epg_restore\u003c/code\u003e.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        Dump only extensions matching \u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e.  When this option is not\n        specified, all non-system extensions in the target database will be\n        dumped.  Multiple extensions can be selected by writing multiple\n        \u003ccode\u003e-e\u003c/code\u003e switches.  The \u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e parameter is interpreted as a\n        pattern according to the same rules used by\n        \u003cspan\u003epsql\u003c/span\u003e\u0026#39;s \u003ccode\u003e\\d\u003c/code\u003e commands (see\n        \u003ca href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\" rel=\"nofollow\"\u003ePatterns\u003c/a\u003e), so multiple extensions can also\n        be selected by writing wildcard characters in the pattern.  When using\n        wildcards, be careful to quote the pattern if needed to prevent the\n        shell from expanding the wildcards.\n       \u003c/p\u003e\u003cp\u003e\n        Any configuration relation registered by\n        \u003ccode\u003epg_extension_config_dump\u003c/code\u003e is included in the\n        dump if its extension is specified by \u003ccode\u003e--extension\u003c/code\u003e.\n       \u003c/p\u003e\u003cdiv\u003e\u003ch3\u003eNote\u003c/h3\u003e\u003cp\u003e\n         When \u003ccode\u003e-e\u003c/code\u003e is specified,\n         \u003cspan\u003epg_dump\u003c/span\u003e makes no attempt to dump any other\n         database objects that the selected extension(s) might depend upon.\n         Therefore, there is no guarantee that the results of a\n         specific-extension dump can be successfully restored by themselves\n         into a clean database.\n        \u003c/p\u003e\u003c/div\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        Create the dump in the specified character set encoding. By default,\n        the dump is created in the database encoding.  (Another way to get the\n        same result is to set the \u003ccode\u003ePGCLIENTENCODING\u003c/code\u003e environment\n        variable to the desired dump encoding.)  The supported encodings are\n        described in \u003ca href=\"/docs/18/multibyte.html#MULTIBYTE-CHARSET-SUPPORTED\" rel=\"nofollow\"\u003eSection 23.3.1\u003c/a\u003e.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        Send output to the specified file. This parameter can be omitted for\n        file based output formats, in which case the standard output is used.\n        It must be given for the directory output format however, where it\n        specifies the target directory instead of a file. In this case the\n        directory is created by \u003ccode\u003epg_dump\u003c/code\u003e and must not exist\n        before.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        Selects the format of the output.\n        \u003cem\u003e\u003ccode\u003eformat\u003c/code\u003e\u003c/em\u003e can be one of the following:\n\n       \u003c/p\u003e\u003cdiv\u003e\u003cdl\u003e\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\u003cdd\u003e\u003cp\u003e\n           Output a plain-text SQL script file (the default).\n          \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n           Output a custom-format archive suitable for input into\n           \u003cspan\u003epg_restore\u003c/span\u003e.\n           Together with the directory output format, this is the most flexible\n           output format in that it allows manual selection and reordering of\n           archived items during restore. This format is also compressed by\n           default.\n          \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n           Output a directory-format archive suitable for input into\n           \u003cspan\u003epg_restore\u003c/span\u003e. This will create a directory\n           with one file for each table and large object being dumped, plus a\n           so-called Table of Contents file describing the dumped objects in a\n           machine-readable format that \u003cspan\u003epg_restore\u003c/span\u003e\n           can read. A directory format archive can be manipulated with\n           standard Unix tools; for example, files in an uncompressed archive\n           can be compressed with the \u003cspan\u003egzip\u003c/span\u003e,\n           \u003cspan\u003elz4\u003c/span\u003e, or\n           \u003cspan\u003ezstd\u003c/span\u003e tools.\n           This format is compressed by default using \u003ccode\u003egzip\u003c/code\u003e\n           and also supports parallel dumps.\n          \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n           Output a \u003ccode\u003etar\u003c/code\u003e-format archive suitable for input\n           into \u003cspan\u003epg_restore\u003c/span\u003e. The tar format is\n           compatible with the directory format: extracting a tar-format\n           archive produces a valid directory-format archive.\n           However, the tar format does not support compression. Also, when\n           using tar format the relative order of table data items cannot be\n           changed during restore.\n          \u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        Run the dump in parallel by dumping \u003cem\u003e\u003ccode\u003enjobs\u003c/code\u003e\u003c/em\u003e\n        tables simultaneously. This option may reduce the time needed to perform the dump but it also\n        increases the load on the database server. You can only use this option with the\n        directory output format because this is the only output format where multiple processes\n        can write their data at the same time.\n       \u003c/p\u003e\u003cp\u003e\u003cspan\u003epg_dump\u003c/span\u003e will open \u003cem\u003e\u003ccode\u003enjobs\u003c/code\u003e\u003c/em\u003e\n        + 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\n        setting is high enough to accommodate all connections.\n       \u003c/p\u003e\u003cp\u003e\n        Requesting exclusive locks on database objects while running a parallel dump could\n        cause the dump to fail. The reason is that the \u003cspan\u003epg_dump\u003c/span\u003e leader process\n        requests shared locks (\u003ca href=\"/docs/18/explicit-locking.html#LOCKING-TABLES\" rel=\"nofollow\"\u003eACCESS SHARE\u003c/a\u003e) on the\n        objects that the worker processes are going to dump later in order to\n        make sure that nobody deletes them and makes them go away while the dump is running.\n        If another client then requests an exclusive lock on a table, that lock will not be\n        granted but will be queued waiting for the shared lock of the leader process to be\n        released. Consequently any other access to the table will not be granted either and\n        will queue after the exclusive lock request. This includes the worker process trying\n        to dump the table. Without any precautions this would be a classic deadlock situation.\n        To detect this conflict, the \u003cspan\u003epg_dump\u003c/span\u003e worker process requests another\n        shared lock using the \u003ccode\u003eNOWAIT\u003c/code\u003e option. If the worker process is not granted\n        this shared lock, somebody else must have requested an exclusive lock in the meantime\n        and there is no way to continue with the dump, so \u003cspan\u003epg_dump\u003c/span\u003e has no choice\n        but to abort the dump.\n       \u003c/p\u003e\u003cp\u003e\n        To perform a parallel dump, the database server needs to support\n        synchronized snapshots, a feature that was introduced in\n        \u003cspan\u003ePostgreSQL\u003c/span\u003e 9.2 for primary servers and 10\n        for standbys. With this feature, database clients can ensure they see\n        the same data set even though they use different connections.\n        \u003ccode\u003epg_dump -j\u003c/code\u003e uses multiple database connections; it\n        connects to the database once with the leader process and once again\n        for each worker job. Without the synchronized snapshot feature, the\n        different worker jobs wouldn\u0026#39;t be guaranteed to see the same data in\n        each connection, which could lead to an inconsistent backup.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        Dump only schemas matching \u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e; this selects both the\n        schema itself, and all its contained objects.  When this option is\n        not specified, all non-system schemas in the target database will be\n        dumped.  Multiple schemas can be\n        selected by writing multiple \u003ccode\u003e-n\u003c/code\u003e switches.  The\n        \u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e parameter is\n        interpreted as a pattern according to the same rules used by\n        \u003cspan\u003epsql\u003c/span\u003e\u0026#39;s \u003ccode\u003e\\d\u003c/code\u003e commands\n        (see \u003ca href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\" rel=\"nofollow\"\u003ePatterns\u003c/a\u003e),\n        so multiple schemas can also be selected by writing wildcard characters\n        in the pattern.  When using wildcards, be careful to quote the pattern\n        if needed to prevent the shell from expanding the wildcards;  see\n        \u003ca href=\"/docs/18/app-pgdump.html#PG-DUMP-EXAMPLES\" title=\"Examples\" rel=\"nofollow\"\u003eExamples\u003c/a\u003e below.\n       \u003c/p\u003e\u003cdiv\u003e\u003ch3\u003eNote\u003c/h3\u003e\u003cp\u003e\n         When \u003ccode\u003e-n\u003c/code\u003e is specified, \u003cspan\u003epg_dump\u003c/span\u003e\n         makes no attempt to dump any other database objects that the selected\n         schema(s) might depend upon. Therefore, there is no guarantee\n         that the results of a specific-schema dump can be successfully\n         restored by themselves into a clean database.\n        \u003c/p\u003e\u003c/div\u003e\u003cdiv\u003e\u003ch3\u003eNote\u003c/h3\u003e\u003cp\u003e\n         Non-schema objects such as large objects are not dumped when \u003ccode\u003e-n\u003c/code\u003e is\n         specified.  You can add large objects back to the dump with the\n         \u003ccode\u003e--large-objects\u003c/code\u003e switch.\n        \u003c/p\u003e\u003c/div\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        Do not dump any schemas matching \u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e.  The pattern is\n        interpreted according to the same rules as for \u003ccode\u003e-n\u003c/code\u003e.\n        \u003ccode\u003e-N\u003c/code\u003e can be given more than once to exclude schemas\n        matching any of several patterns.\n       \u003c/p\u003e\u003cp\u003e\n        When both \u003ccode\u003e-n\u003c/code\u003e and \u003ccode\u003e-N\u003c/code\u003e are given, the behavior\n        is to dump just the schemas that match at least one \u003ccode\u003e-n\u003c/code\u003e\n        switch but no \u003ccode\u003e-N\u003c/code\u003e switches.  If \u003ccode\u003e-N\u003c/code\u003e appears\n        without \u003ccode\u003e-n\u003c/code\u003e, then schemas matching \u003ccode\u003e-N\u003c/code\u003e are\n        excluded from what is otherwise a normal dump.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        Do not output commands to set\n        ownership of objects to match the original database.\n        By default, \u003cspan\u003epg_dump\u003c/span\u003e issues\n        \u003ccode\u003eALTER OWNER\u003c/code\u003e or\n        \u003ccode\u003eSET SESSION AUTHORIZATION\u003c/code\u003e\n        statements to set ownership of created database objects.\n        These statements\n        will fail when the script is run unless it is started by a superuser\n        (or the same user that owns all of the objects in the script).\n        To make a script that can be restored by any user, but will give\n        that user ownership of all the objects, specify \u003ccode\u003e-O\u003c/code\u003e.\n       \u003c/p\u003e\u003cp\u003e\n        This option is ignored when emitting an archive (non-text) output\n        file.  For the archive formats, you can specify the option when you\n        call \u003ccode\u003epg_restore\u003c/code\u003e.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        This option is obsolete but still accepted for backwards\n        compatibility.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        Dump only the object definitions (schema), not data or statistics.\n       \u003c/p\u003e\u003cp\u003e\n        This option cannot be used with \u003ccode\u003e--data-only\u003c/code\u003e\n        or \u003ccode\u003e--statistics-only\u003c/code\u003e.\n        It is similar to, but for historical reasons not identical to,\n        specifying\n        \u003ccode\u003e--section=pre-data --section=post-data\u003c/code\u003e.\n       \u003c/p\u003e\u003cp\u003e\n        (Do not confuse this with the \u003ccode\u003e--schema\u003c/code\u003e option, which\n        uses the word \u003cspan\u003e“\u003cspan\u003eschema\u003c/span\u003e”\u003c/span\u003e in a different meaning.)\n       \u003c/p\u003e\u003cp\u003e\n        To exclude table data for only a subset of tables in the database,\n        see \u003ccode\u003e--exclude-table-data\u003c/code\u003e.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        Specify the superuser user name to use when disabling triggers.\n        This is relevant only if \u003ccode\u003e--disable-triggers\u003c/code\u003e is used.\n        (Usually, it\u0026#39;s better to leave this out, and instead start the\n        resulting script as superuser.)\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        Dump only tables with names matching\n        \u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e. Multiple tables\n        can be selected by writing multiple \u003ccode\u003e-t\u003c/code\u003e switches.  The\n        \u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e parameter is\n        interpreted as a pattern according to the same rules used by\n        \u003cspan\u003epsql\u003c/span\u003e\u0026#39;s \u003ccode\u003e\\d\u003c/code\u003e commands\n        (see \u003ca href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\" rel=\"nofollow\"\u003ePatterns\u003c/a\u003e),\n        so multiple tables can also be selected by writing wildcard characters\n        in the pattern.  When using wildcards, be careful to quote the pattern\n        if needed to prevent the shell from expanding the wildcards;  see\n        \u003ca href=\"/docs/18/app-pgdump.html#PG-DUMP-EXAMPLES\" title=\"Examples\" rel=\"nofollow\"\u003eExamples\u003c/a\u003e below.\n       \u003c/p\u003e\u003cp\u003e\n        As well as tables, this option can be used to dump the definition of matching\n        views, materialized views, foreign tables, and sequences.  It will not dump the\n        contents of views or materialized views, and the contents of foreign tables will\n        only be dumped if the corresponding foreign server is specified with\n        \u003ccode\u003e--include-foreign-data\u003c/code\u003e.\n       \u003c/p\u003e\u003cp\u003e\n        The \u003ccode\u003e-n\u003c/code\u003e and \u003ccode\u003e-N\u003c/code\u003e switches have no effect when\n        \u003ccode\u003e-t\u003c/code\u003e is used, because tables selected by \u003ccode\u003e-t\u003c/code\u003e will\n        be dumped regardless of those switches, and non-table objects will not\n        be dumped.\n       \u003c/p\u003e\u003cdiv\u003e\u003ch3\u003eNote\u003c/h3\u003e\u003cp\u003e\n         When \u003ccode\u003e-t\u003c/code\u003e is specified, \u003cspan\u003epg_dump\u003c/span\u003e\n         makes no attempt to dump any other database objects that the selected\n         table(s) might depend upon. Therefore, there is no guarantee\n         that the results of a specific-table dump can be successfully\n         restored by themselves into a clean database.\n        \u003c/p\u003e\u003c/div\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        Do not dump any tables matching \u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e.  The pattern is\n        interpreted according to the same rules as for \u003ccode\u003e-t\u003c/code\u003e.\n        \u003ccode\u003e-T\u003c/code\u003e can be given more than once to exclude tables\n        matching any of several patterns.\n       \u003c/p\u003e\u003cp\u003e\n        When both \u003ccode\u003e-t\u003c/code\u003e and \u003ccode\u003e-T\u003c/code\u003e are given, the behavior\n        is to dump just the tables that match at least one \u003ccode\u003e-t\u003c/code\u003e\n        switch but no \u003ccode\u003e-T\u003c/code\u003e switches.  If \u003ccode\u003e-T\u003c/code\u003e appears\n        without \u003ccode\u003e-t\u003c/code\u003e, then tables matching \u003ccode\u003e-T\u003c/code\u003e are\n        excluded from what is otherwise a normal dump.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        Specifies verbose mode.  This will cause\n        \u003cspan\u003epg_dump\u003c/span\u003e to output detailed object\n        comments and start/stop times to the dump file, and progress\n        messages to standard error.\n        Repeating the option causes additional debug-level messages\n        to appear on standard error.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n       Print the \u003cspan\u003epg_dump\u003c/span\u003e version and exit.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        Prevent dumping of access privileges (grant/revoke commands).\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        Specify the compression method and/or the compression level to use.\n        The compression method can be set to \u003ccode\u003egzip\u003c/code\u003e,\n        \u003ccode\u003elz4\u003c/code\u003e, \u003ccode\u003ezstd\u003c/code\u003e,\n        or \u003ccode\u003enone\u003c/code\u003e for no compression.\n        A compression detail string can optionally be specified.  If the\n        detail string is an integer, it specifies the compression level.\n        Otherwise, it should be a comma-separated list of items, each of the\n        form \u003ccode\u003ekeyword\u003c/code\u003e or \u003ccode\u003ekeyword=value\u003c/code\u003e.\n        Currently, the supported keywords are \u003ccode\u003elevel\u003c/code\u003e and\n        \u003ccode\u003elong\u003c/code\u003e.\n       \u003c/p\u003e\u003cp\u003e\n        If no compression level is specified, the default compression\n        level will be used. If only a level is specified without mentioning\n        an algorithm, \u003ccode\u003egzip\u003c/code\u003e compression will be used if\n        the level is greater than \u003ccode\u003e0\u003c/code\u003e, and no compression\n        will be used if the level is \u003ccode\u003e0\u003c/code\u003e.\n       \u003c/p\u003e\u003cp\u003e\n        For the custom and directory archive formats, this specifies compression of\n        individual table-data segments, and the default is to compress using\n        \u003ccode\u003egzip\u003c/code\u003e at a moderate level. For plain text output,\n        setting a nonzero compression level causes the entire output file to be compressed,\n        as though it had been fed through \u003cspan\u003egzip\u003c/span\u003e,\n        \u003cspan\u003elz4\u003c/span\u003e, or \u003cspan\u003ezstd\u003c/span\u003e;\n        but the default is not to compress.\n        With zstd compression, \u003ccode\u003elong\u003c/code\u003e mode may improve the\n        compression ratio, at the cost of increased memory use.\n       \u003c/p\u003e\u003cp\u003e\n        The tar archive format currently does not support compression at all.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--binary-upgrade\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        This option is for use by in-place upgrade utilities.  Its use\n        for other purposes is not recommended or supported.  The\n        behavior of the option may change in future releases without\n        notice.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        Dump data as \u003ccode\u003eINSERT\u003c/code\u003e commands with explicit\n        column names (\u003ccode\u003eINSERT INTO\n        \u003cem\u003e\u003ccode\u003etable\u003c/code\u003e\u003c/em\u003e\n        (\u003cem\u003e\u003ccode\u003ecolumn\u003c/code\u003e\u003c/em\u003e, ...) VALUES\n        ...\u003c/code\u003e).  This will make restoration very slow; it is mainly\n        useful for making dumps that can be loaded into\n        non-\u003cspan\u003ePostgreSQL\u003c/span\u003e databases.\n        Any error during restoring will cause only rows that are part of the\n        problematic \u003ccode\u003eINSERT\u003c/code\u003e to be lost, rather than the\n        entire table contents.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--disable-dollar-quoting\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        This option disables the use of dollar quoting for function bodies,\n        and forces them to be quoted using SQL standard string syntax.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--disable-triggers\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        This option is relevant only when creating a dump that includes data\n        but does not include schema.\n        It instructs \u003cspan\u003epg_dump\u003c/span\u003e to include commands\n        to temporarily disable triggers on the target tables while\n        the data is restored.  Use this if you have referential\n        integrity checks or other triggers on the tables that you\n        do not want to invoke during data restore.\n       \u003c/p\u003e\u003cp\u003e\n        Presently, the commands emitted for \u003ccode\u003e--disable-triggers\u003c/code\u003e\n        must be done as superuser.  So, you should also specify\n        a superuser name with \u003ccode\u003e-S\u003c/code\u003e, or preferably be careful to\n        start the resulting script as a superuser.\n       \u003c/p\u003e\u003cp\u003e\n        This option is ignored when emitting an archive (non-text) output\n        file.  For the archive formats, you can specify the option when you\n        call \u003ccode\u003epg_restore\u003c/code\u003e.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--enable-row-security\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        This option is relevant only when dumping the contents of a table\n        which has row security.  By default, \u003cspan\u003epg_dump\u003c/span\u003e will set\n        \u003ca href=\"/docs/18/runtime-config-client.html#GUC-ROW-SECURITY\" rel=\"nofollow\"\u003erow_security\u003c/a\u003e to off, to ensure\n        that all data is dumped from the table.  If the user does not have\n        sufficient privileges to bypass row security, then an error is thrown.\n        This parameter instructs \u003cspan\u003epg_dump\u003c/span\u003e to set\n        \u003ca href=\"/docs/18/runtime-config-client.html#GUC-ROW-SECURITY\" rel=\"nofollow\"\u003erow_security\u003c/a\u003e to on instead, allowing the user\n        to dump the parts of the contents of the table that they have access to.\n       \u003c/p\u003e\u003cp\u003e\n        Note that if you use this option currently, you probably also want\n        the dump be in \u003ccode\u003eINSERT\u003c/code\u003e format, as the\n        \u003ccode\u003eCOPY FROM\u003c/code\u003e during restore does not support row security.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        Do not dump any extensions matching \u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e.  The pattern is\n        interpreted according to the same rules as for \u003ccode\u003e-e\u003c/code\u003e.\n        \u003ccode\u003e--exclude-extension\u003c/code\u003e can be given more than once to exclude extensions\n        matching any of several patterns.\n       \u003c/p\u003e\u003cp\u003e\n        When both \u003ccode\u003e-e\u003c/code\u003e and \u003ccode\u003e--exclude-extension\u003c/code\u003e are given, the behavior\n        is to dump just the extensions that match at least one \u003ccode\u003e-e\u003c/code\u003e\n        switch but no \u003ccode\u003e--exclude-extension\u003c/code\u003e switches.  If \u003ccode\u003e--exclude-extension\u003c/code\u003e\n        appears without \u003ccode\u003e-e\u003c/code\u003e, then extensions matching \u003ccode\u003e--exclude-extension\u003c/code\u003e are\n        excluded from what is otherwise a normal dump.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        This is the same as\n        the \u003ccode\u003e-T\u003c/code\u003e/\u003ccode\u003e--exclude-table\u003c/code\u003e option,\n        except that it also excludes any partitions or inheritance child\n        tables of the table(s) matching the\n        \u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        Do not dump data for any tables matching \u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e. The pattern is\n        interpreted according to the same rules as for \u003ccode\u003e-t\u003c/code\u003e.\n        \u003ccode\u003e--exclude-table-data\u003c/code\u003e can be given more than once to\n        exclude tables matching any of several patterns. This option is\n        useful when you need the definition of a particular table even\n        though you do not need the data in it.\n       \u003c/p\u003e\u003cp\u003e\n        To exclude data for all tables in the database, see \u003ccode\u003e--schema-only\u003c/code\u003e\n        or \u003ccode\u003e--statistics-only\u003c/code\u003e.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        This is the same as the \u003ccode\u003e--exclude-table-data\u003c/code\u003e option,\n        except that it also excludes data of any partitions or inheritance\n        child tables of the table(s) matching the\n        \u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        Use the specified value of \u003ccode\u003eextra_float_digits\u003c/code\u003e when dumping\n        floating-point data, instead of the maximum available precision.\n        Routine dumps made for backup purposes should not use this option.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        Specify a filename from which to read patterns for objects to include\n        or exclude from the dump. The patterns are interpreted according to the\n        same rules as the corresponding options:\n        \u003ccode\u003e-t\u003c/code\u003e/\u003ccode\u003e--table\u003c/code\u003e,\n        \u003ccode\u003e--table-and-children\u003c/code\u003e,\n        \u003ccode\u003e-T\u003c/code\u003e/\u003ccode\u003e--exclude-table\u003c/code\u003e, and\n        \u003ccode\u003e--exclude-table-and-children\u003c/code\u003e for tables,\n        \u003ccode\u003e-n\u003c/code\u003e/\u003ccode\u003e--schema\u003c/code\u003e and\n        \u003ccode\u003e-N\u003c/code\u003e/\u003ccode\u003e--exclude-schema\u003c/code\u003e for schemas,\n        \u003ccode\u003e--include-foreign-data\u003c/code\u003e for data on foreign servers,\n        \u003ccode\u003e--exclude-table-data\u003c/code\u003e and\n        \u003ccode\u003e--exclude-table-data-and-children\u003c/code\u003e for table data, and\n        \u003ccode\u003e-e\u003c/code\u003e/\u003ccode\u003e--extension\u003c/code\u003e and\n        \u003ccode\u003e--exclude-extension\u003c/code\u003e for extensions.\n        To read from \u003ccode\u003eSTDIN\u003c/code\u003e, use \u003ccode\u003e-\u003c/code\u003e as the\n        filename.  The \u003ccode\u003e--filter\u003c/code\u003e option can be specified in\n        conjunction with the above listed options for including or excluding\n        objects, and can also be specified more than once for multiple filter\n        files.\n       \u003c/p\u003e\u003cp\u003e\n        The file lists one object pattern per row, with the following format:\n\u003c/p\u003e\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\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n        The first keyword specifies whether the objects matched by the pattern\n        are to be included or excluded. The second keyword specifies the type\n        of object to be filtered using the pattern:\n        \u003c/p\u003e\u003cdiv\u003e\u003cul\u003e\u003cli\u003e\u003cp\u003e\n\u003ccode\u003eextension\u003c/code\u003e: extensions. This works like the\n           \u003ccode\u003e-e\u003c/code\u003e/\u003ccode\u003e--extension\u003c/code\u003e or\n           \u003ccode\u003e--exclude-extension\u003c/code\u003e option.\n          \u003c/p\u003e\u003c/li\u003e\u003cli\u003e\u003cp\u003e\n\u003ccode\u003eforeign_data\u003c/code\u003e: data on foreign servers. This works like\n           the \u003ccode\u003e--include-foreign-data\u003c/code\u003e option. This keyword can\n           only be used with the \u003ccode\u003einclude\u003c/code\u003e keyword.\n          \u003c/p\u003e\u003c/li\u003e\u003cli\u003e\u003cp\u003e\n\u003ccode\u003etable\u003c/code\u003e: tables. This works like the\n           \u003ccode\u003e-t\u003c/code\u003e/\u003ccode\u003e--table\u003c/code\u003e or\n           \u003ccode\u003e-T\u003c/code\u003e/\u003ccode\u003e--exclude-table\u003c/code\u003e option.\n          \u003c/p\u003e\u003c/li\u003e\u003cli\u003e\u003cp\u003e\n\u003ccode\u003etable_and_children\u003c/code\u003e: tables including any partitions\n           or inheritance child tables. This works like the\n           \u003ccode\u003e--table-and-children\u003c/code\u003e or\n           \u003ccode\u003e--exclude-table-and-children\u003c/code\u003e option.\n          \u003c/p\u003e\u003c/li\u003e\u003cli\u003e\u003cp\u003e\n\u003ccode\u003etable_data\u003c/code\u003e: table data of any tables matching\n           \u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e. This works like the\n           \u003ccode\u003e--exclude-table-data\u003c/code\u003e option. This keyword can only\n           be used with the \u003ccode\u003eexclude\u003c/code\u003e keyword.\n          \u003c/p\u003e\u003c/li\u003e\u003cli\u003e\u003cp\u003e\n\u003ccode\u003etable_data_and_children\u003c/code\u003e: table data of any tables\n           matching \u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e as well as any partitions\n           or inheritance children of the table(s). This works like the\n           \u003ccode\u003e--exclude-table-data-and-children\u003c/code\u003e option. This\n           keyword can only be used with the \u003ccode\u003eexclude\u003c/code\u003e keyword.\n          \u003c/p\u003e\u003c/li\u003e\u003cli\u003e\u003cp\u003e\n\u003ccode\u003eschema\u003c/code\u003e: schemas. This works like the\n           \u003ccode\u003e-n\u003c/code\u003e/\u003ccode\u003e--schema\u003c/code\u003e or\n           \u003ccode\u003e-N\u003c/code\u003e/\u003ccode\u003e--exclude-schema\u003c/code\u003e option.\n          \u003c/p\u003e\u003c/li\u003e\u003c/ul\u003e\u003c/div\u003e\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n        Lines starting with \u003ccode\u003e#\u003c/code\u003e are considered comments and\n        ignored. Comments can be placed after an object pattern row as well.\n        Blank lines are also ignored. See \u003ca href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\" rel=\"nofollow\"\u003ePatterns\u003c/a\u003e\n        for how to perform quoting in patterns.\n       \u003c/p\u003e\u003cp\u003e\n        Example files are listed below in the \u003ca href=\"/docs/18/app-pgdump.html#PG-DUMP-EXAMPLES\" title=\"Examples\" rel=\"nofollow\"\u003eExamples\u003c/a\u003e\n        section.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--if-exists\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Use \u003ccode\u003eDROP ... IF EXISTS\u003c/code\u003e commands to drop objects\n        in \u003ccode\u003e--clean\u003c/code\u003e mode.  This suppresses \u003cspan\u003e“\u003cspan\u003edoes not\n        exist\u003c/span\u003e”\u003c/span\u003e errors that might otherwise be reported.  This\n        option is not valid unless \u003ccode\u003e--clean\u003c/code\u003e is also\n        specified.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        Dump the data for any foreign table with a foreign server\n        matching \u003cem\u003e\u003ccode\u003eforeignserver\u003c/code\u003e\u003c/em\u003e\n        pattern. Multiple foreign servers can be selected by writing multiple\n        \u003ccode\u003e--include-foreign-data\u003c/code\u003e switches.\n        Also, the \u003cem\u003e\u003ccode\u003eforeignserver\u003c/code\u003e\u003c/em\u003e parameter is\n        interpreted as a pattern according to the same rules used by\n        \u003cspan\u003epsql\u003c/span\u003e\u0026#39;s \u003ccode\u003e\\d\u003c/code\u003e commands\n        (see \u003ca href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\" rel=\"nofollow\"\u003ePatterns\u003c/a\u003e),\n        so multiple foreign servers can also be selected by writing wildcard characters\n        in the pattern.  When using wildcards, be careful to quote the pattern\n        if needed to prevent the shell from expanding the wildcards; see\n        \u003ca href=\"/docs/18/app-pgdump.html#PG-DUMP-EXAMPLES\" title=\"Examples\" rel=\"nofollow\"\u003eExamples\u003c/a\u003e below.\n        The only exception is that an empty pattern is disallowed.\n       \u003c/p\u003e\u003cdiv\u003e\u003ch3\u003eNote\u003c/h3\u003e\u003cp\u003e\n         Using wildcards in \u003ccode\u003e--include-foreign-data\u003c/code\u003e may result\n         in access to unexpected foreign servers. Also, to use this option securely,\n         make sure that the named server must have a trusted owner.\n        \u003c/p\u003e\u003c/div\u003e\u003cdiv\u003e\u003ch3\u003eNote\u003c/h3\u003e\u003cp\u003e\n         When \u003ccode\u003e--include-foreign-data\u003c/code\u003e is specified,\n         \u003cspan\u003epg_dump\u003c/span\u003e does not check that the foreign\n         table is writable.  Therefore, there is no guarantee that the\n         results of a foreign table dump can be successfully restored.\n        \u003c/p\u003e\u003c/div\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--inserts\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Dump data as \u003ccode\u003eINSERT\u003c/code\u003e commands (rather\n        than \u003ccode\u003eCOPY\u003c/code\u003e).  This will make restoration very slow;\n        it is mainly useful for making dumps that can be loaded into\n        non-\u003cspan\u003ePostgreSQL\u003c/span\u003e databases.\n        Any error during restoring will cause only rows that are part of the\n        problematic \u003ccode\u003eINSERT\u003c/code\u003e to be lost, rather than the\n        entire table contents.  Note that the restore might fail altogether if\n        you have rearranged column order.  The\n        \u003ccode\u003e--column-inserts\u003c/code\u003e option is safe against column order\n        changes, though even slower.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--load-via-partition-root\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        When dumping data for a table partition, make\n        the \u003ccode\u003eCOPY\u003c/code\u003e or \u003ccode\u003eINSERT\u003c/code\u003e statements\n        target the root of the partitioning hierarchy that contains it, rather\n        than the partition itself.  This causes the appropriate partition to\n        be re-determined for each row when the data is loaded.  This may be\n        useful when restoring data on a server where rows do not always fall\n        into the same partitions as they did on the original server.  That\n        could happen, for example, if the partitioning column is of type text\n        and the two systems have different definitions of the collation used\n        to sort the partitioning column.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        Do not wait forever to acquire shared table locks at the beginning of\n        the dump. Instead fail if unable to lock a table within the specified\n        \u003cem\u003e\u003ccode\u003etimeout\u003c/code\u003e\u003c/em\u003e. The timeout may be\n        specified in any of the formats accepted by \u003ccode\u003eSET\n        statement_timeout\u003c/code\u003e.  (Allowed formats vary depending on the server\n        version you are dumping from, but an integer number of milliseconds\n        is accepted by all versions.)\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--no-comments\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Do not dump \u003ccode\u003eCOMMENT\u003c/code\u003e commands.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--no-data\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Do not dump data.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--no-policies\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Do not dump row security policies.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--no-publications\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Do not dump publications.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--no-schema\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Do not dump schema (data definitions).\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--no-security-labels\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Do not dump security labels.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--no-statistics\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Do not dump statistics. This is the default.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--no-subscriptions\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Do not dump subscriptions.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--no-sync\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        By default, \u003ccode\u003epg_dump\u003c/code\u003e will wait for all files\n        to be written safely to disk.  This option causes\n        \u003ccode\u003epg_dump\u003c/code\u003e to return without waiting, which is\n        faster, but means that a subsequent operating system crash can leave\n        the dump corrupt.  Generally, this option is useful for testing\n        but should not be used when dumping data from production installation.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--no-table-access-method\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Do not output commands to select table access methods.\n        With this option, all objects will be created with whichever\n        table access method is the default during restore.\n       \u003c/p\u003e\u003cp\u003e\n        This option is ignored when emitting an archive (non-text) output\n        file.  For the archive formats, you can specify the option when you\n        call \u003ccode\u003epg_restore\u003c/code\u003e.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--no-tablespaces\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Do not output commands to select tablespaces.\n        With this option, all objects will be created in whichever\n        tablespace is the default during restore.\n       \u003c/p\u003e\u003cp\u003e\n        This option is ignored when emitting an archive (non-text) output\n        file.  For the archive formats, you can specify the option when you\n        call \u003ccode\u003epg_restore\u003c/code\u003e.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--no-toast-compression\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Do not output commands to set TOAST compression\n        methods.\n        With this option, all columns will be restored with the default\n        compression setting.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--no-unlogged-table-data\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Do not dump the contents of unlogged tables and sequences.  This\n        option has no effect on whether or not the table and sequence\n        definitions (schema) are dumped; it only suppresses dumping the table\n        and sequence data. Data in unlogged tables and sequences\n        is always excluded when dumping from a standby server.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--on-conflict-do-nothing\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Add \u003ccode\u003eON CONFLICT DO NOTHING\u003c/code\u003e to\n        \u003ccode\u003eINSERT\u003c/code\u003e commands.\n        This option is not valid unless \u003ccode\u003e--inserts\u003c/code\u003e,\n        \u003ccode\u003e--column-inserts\u003c/code\u003e or\n        \u003ccode\u003e--rows-per-insert\u003c/code\u003e is also specified.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--quote-all-identifiers\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Force quoting of all identifiers.  This option is recommended when\n        dumping a database from a server whose \u003cspan\u003ePostgreSQL\u003c/span\u003e\n        major version is different from \u003cspan\u003epg_dump\u003c/span\u003e\u0026#39;s, or when\n        the output is intended to be loaded into a server of a different\n        major version.  By default, \u003cspan\u003epg_dump\u003c/span\u003e quotes only\n        identifiers that are reserved words in its own major version.\n        This sometimes results in compatibility issues when dealing with\n        servers of other versions that may have slightly different sets\n        of reserved words.  Using \u003ccode\u003e--quote-all-identifiers\u003c/code\u003e prevents\n        such issues, at the price of a harder-to-read dump script.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        Use the provided string as the \u003cspan\u003epsql\u003c/span\u003e\n\u003ccode\u003e\\restrict\u003c/code\u003e key in the dump output.  If no restrict\n        key is specified,\n        \u003cspan\u003epg_dump\u003c/span\u003e will generate a random one as\n        needed.  Keys may contain only alphanumeric characters.\n       \u003c/p\u003e\u003cp\u003e\n        This option is primarily intended for testing purposes and other\n        scenarios that require repeatable output (e.g., comparing dump files).\n        It is not recommended for general use, as a malicious server with\n        advance knowledge of the key may be able to inject arbitrary code that\n        will be executed on the machine that runs\n        \u003cspan\u003epsql\u003c/span\u003e with the dump output.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        Dump data as \u003ccode\u003eINSERT\u003c/code\u003e commands (rather than\n        \u003ccode\u003eCOPY\u003c/code\u003e).  Controls the maximum number of rows per\n        \u003ccode\u003eINSERT\u003c/code\u003e command. The value specified must be a\n        number greater than zero.  Any error during restoring will cause only\n        rows that are part of the problematic \u003ccode\u003eINSERT\u003c/code\u003e to be\n        lost, rather than the entire table contents.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n          Only dump the named section. The section name can be\n          \u003ccode\u003epre-data\u003c/code\u003e, \u003ccode\u003edata\u003c/code\u003e, or \u003ccode\u003epost-data\u003c/code\u003e.\n          This option can be specified more than once to select multiple\n          sections. The default is to dump all sections.\n         \u003c/p\u003e\u003cp\u003e\n          The data section contains actual table data, large-object\n          contents, sequence values, and statistics for tables,\n          materialized views, and foreign tables.\n          Post-data items include definitions of indexes, triggers, rules,\n          statistics for indexes, and constraints other than validated check\n          and not-null constraints.\n          Pre-data items include all other data definition items.\n         \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--sequence-data\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Include sequence data in the dump.  This is the default behavior except\n        when \u003ccode\u003e--no-data\u003c/code\u003e, \u003ccode\u003e--schema-only\u003c/code\u003e, or\n        \u003ccode\u003e--statistics-only\u003c/code\u003e is specified.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--serializable-deferrable\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Use a \u003ccode\u003eserializable\u003c/code\u003e transaction for the dump, to\n        ensure that the snapshot used is consistent with later database\n        states; but do this by waiting for a point in the transaction stream\n        at which no anomalies can be present, so that there isn\u0026#39;t a risk of\n        the dump failing or causing other transactions to roll back with a\n        \u003ccode\u003eserialization_failure\u003c/code\u003e.  See \u003ca href=\"/docs/18/mvcc.html\" rel=\"nofollow\"\u003eChapter 13\u003c/a\u003e\n        for more information about transaction isolation and concurrency\n        control.\n       \u003c/p\u003e\u003cp\u003e\n        This option is not beneficial for a dump which is intended only for\n        disaster recovery.  It could be useful for a dump used to load a\n        copy of the database for reporting or other read-only load sharing\n        while the original database continues to be updated.  Without it the\n        dump may reflect a state which is not consistent with any serial\n        execution of the transactions eventually committed.  For example, if\n        batch processing techniques are used, a batch may show as closed in\n        the dump without all of the items which are in the batch appearing.\n       \u003c/p\u003e\u003cp\u003e\n        This option will make no difference if there are no read-write\n        transactions active when pg_dump is started.  If read-write\n        transactions are active, the start of the dump may be delayed for an\n        indeterminate length of time.  Once running, performance with or\n        without the switch is the same.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n          Use the specified synchronized snapshot when making a dump of the\n          database (see\n          \u003ca href=\"/docs/18/functions-admin.html#FUNCTIONS-SNAPSHOT-SYNCHRONIZATION-TABLE\" rel=\"nofollow\"\u003eTable 9.100\u003c/a\u003e for more\n          details).\n         \u003c/p\u003e\u003cp\u003e\n          This option is useful when needing to synchronize the dump with\n          a logical replication slot (see \u003ca href=\"/docs/18/logicaldecoding.html\" rel=\"nofollow\"\u003eChapter 47\u003c/a\u003e)\n          or with a concurrent session.\n         \u003c/p\u003e\u003cp\u003e\n          In the case of a parallel dump, the snapshot name defined by this\n          option is used rather than taking a new snapshot.\n         \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--statistics\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Dump optimizer statistics.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--statistics-only\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Dump only the statistics, not the schema (data definitions) or data.\n        Optimizer statistics for tables, materialized views, foreign tables,\n        and indexes are dumped.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--strict-names\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Require that each\n        extension (\u003ccode\u003e-e\u003c/code\u003e/\u003ccode\u003e--extension\u003c/code\u003e),\n        schema (\u003ccode\u003e-n\u003c/code\u003e/\u003ccode\u003e--schema\u003c/code\u003e) and\n        table (\u003ccode\u003e-t\u003c/code\u003e/\u003ccode\u003e--table\u003c/code\u003e) pattern\n        match at least one extension/schema/table in the database to be dumped.\n        This also applies to filters used with \u003ccode\u003e--filter\u003c/code\u003e.\n        Note that if none of the extension/schema/table patterns find\n        matches, \u003cspan\u003epg_dump\u003c/span\u003e will generate an error\n        even without \u003ccode\u003e--strict-names\u003c/code\u003e.\n       \u003c/p\u003e\u003cp\u003e\n        This option has no effect\n        on \u003ccode\u003e--exclude-extension\u003c/code\u003e,\n        \u003ccode\u003e-N\u003c/code\u003e/\u003ccode\u003e--exclude-schema\u003c/code\u003e,\n        \u003ccode\u003e-T\u003c/code\u003e/\u003ccode\u003e--exclude-table\u003c/code\u003e,\n        or \u003ccode\u003e--exclude-table-data\u003c/code\u003e.  An exclude pattern failing\n        to match any objects is not considered an error.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        When set to \u003ccode\u003efsync\u003c/code\u003e, which is the default,\n        \u003ccode\u003epg_dump --format=directory\u003c/code\u003e will recursively open and\n        synchronize all files in the archive directory.\n       \u003c/p\u003e\u003cp\u003e\n        On Linux, \u003ccode\u003esyncfs\u003c/code\u003e may be used instead to ask the\n        operating system to synchronize the whole file system that contains the\n        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\n        for information about the caveats to be aware of when using\n        \u003ccode\u003esyncfs\u003c/code\u003e.\n       \u003c/p\u003e\u003cp\u003e\n        This option has no effect when \u003ccode\u003e--no-sync\u003c/code\u003e is used or\n        \u003ccode\u003e--format\u003c/code\u003e is not set to \u003ccode\u003edirectory\u003c/code\u003e.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        This is the same as\n        the \u003ccode\u003e-t\u003c/code\u003e/\u003ccode\u003e--table\u003c/code\u003e option,\n        except that it also includes any partitions or inheritance child\n        tables of the table(s) matching the\n        \u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--use-set-session-authorization\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Output SQL-standard \u003ccode\u003eSET SESSION AUTHORIZATION\u003c/code\u003e commands\n        instead of \u003ccode\u003eALTER OWNER\u003c/code\u003e commands to determine object\n        ownership.  This makes the dump more standards-compatible, but\n        depending on the history of the objects in the dump, might not restore\n        properly.  Also, a dump using \u003ccode\u003eSET SESSION AUTHORIZATION\u003c/code\u003e\n        will certainly require superuser privileges to restore correctly,\n        whereas \u003ccode\u003eALTER OWNER\u003c/code\u003e requires lesser privileges.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n       Show help about \u003cspan\u003epg_dump\u003c/span\u003e command line\n       arguments, and exit.\n       \u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n    The following command-line options control the database connection parameters.\n\n    \u003c/p\u003e\u003cdiv\u003e\u003cdl\u003e\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\u003cdd\u003e\u003cp\u003e\n       Specifies the name of the database to connect to. This is\n       equivalent to specifying \u003cem\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e as the first non-option\n       argument on the command line.  The \u003cem\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e\n       can be a \u003ca href=\"/docs/18/libpq-connect.html#LIBPQ-CONNSTRING\" rel=\"nofollow\"\u003econnection string\u003c/a\u003e.\n       If so, connection string parameters will override any conflicting\n       command line options.\n      \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        Specifies the host name of the machine on which the server is\n        running.  If the value begins with a slash, it is used as the\n        directory for the Unix domain socket. The default is taken\n        from the \u003ccode\u003ePGHOST\u003c/code\u003e environment variable, if set,\n        else a Unix domain socket connection is attempted.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        Specifies the TCP port or local Unix domain socket file\n        extension on which the server is listening for connections.\n        Defaults to the \u003ccode\u003ePGPORT\u003c/code\u003e environment variable, if\n        set, or a compiled-in default.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        User name to connect as.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        Never issue a password prompt.  If the server requires\n        password authentication and a password is not available by\n        other means such as a \u003ccode\u003e.pgpass\u003c/code\u003e file, the\n        connection attempt will fail.  This option can be useful in\n        batch jobs and scripts where no user is present to enter a\n        password.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        Force \u003cspan\u003epg_dump\u003c/span\u003e to prompt for a\n        password before connecting to a database.\n       \u003c/p\u003e\u003cp\u003e\n        This option is never essential, since\n        \u003cspan\u003epg_dump\u003c/span\u003e will automatically prompt\n        for a password if the server demands password authentication.\n        However, \u003cspan\u003epg_dump\u003c/span\u003e will waste a\n        connection attempt finding out that the server wants a password.\n        In some cases it is worth typing \u003ccode\u003e-W\u003c/code\u003e to avoid the extra\n        connection attempt.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        Specifies a role name to be used to create the dump.\n        This option causes \u003cspan\u003epg_dump\u003c/span\u003e to issue a\n        \u003ccode\u003eSET ROLE\u003c/code\u003e \u003cem\u003e\u003ccode\u003erolename\u003c/code\u003e\u003c/em\u003e\n        command after connecting to the database. It is useful when the\n        authenticated user (specified by \u003ccode\u003e-U\u003c/code\u003e) lacks privileges\n        needed by \u003cspan\u003epg_dump\u003c/span\u003e, but can switch to a role with\n        the required rights.  Some installations have a policy against\n        logging in directly as a superuser, and use of this option allows\n        dumps to be made without violating the policy.\n       \u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e\u003cp\u003e\n\u003c/p\u003e\u003c/div\u003e\u003cdiv id=\"id-1.9.4.14.7\"\u003e\u003ch2\u003eEnvironment\u003c/h2\u003e\u003cdiv\u003e\u003cdl\u003e\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\u003cdd\u003e\u003cp\u003e\n      Default connection parameters.\n     \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan\u003e\u003ccode\u003ePG_COLOR\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      Specifies whether to use color in diagnostic messages. Possible values\n      are \u003ccode\u003ealways\u003c/code\u003e, \u003ccode\u003eauto\u003c/code\u003e and\n      \u003ccode\u003enever\u003c/code\u003e.\n     \u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e\u003cp\u003e\n   This utility, like most other \u003cspan\u003ePostgreSQL\u003c/span\u003e utilities,\n   also uses the environment variables supported by \u003cspan\u003elibpq\u003c/span\u003e\n   (see \u003ca href=\"/docs/18/libpq-envars.html\" rel=\"nofollow\"\u003eSection 32.15\u003c/a\u003e).\n  \u003c/p\u003e\u003c/div\u003e\u003cdiv id=\"APP-PGDUMP-DIAGNOSTICS\"\u003e\u003ch2\u003eDiagnostics\u003c/h2\u003e\u003cp\u003e\n\u003cspan\u003epg_dump\u003c/span\u003e internally executes\n   \u003ccode\u003eSELECT\u003c/code\u003e statements. If you have problems running\n   \u003cspan\u003epg_dump\u003c/span\u003e, make sure you are able to\n   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\n   variables used by the \u003cspan\u003elibpq\u003c/span\u003e front-end\n   library will apply.\n  \u003c/p\u003e\u003cp\u003e\n   The database activity of \u003cspan\u003epg_dump\u003c/span\u003e is\n   normally collected by the cumulative statistics system.  If this is\n   undesirable, you can set parameter \u003ccode\u003etrack_counts\u003c/code\u003e\n   to false via \u003ccode\u003ePGOPTIONS\u003c/code\u003e or the \u003ccode\u003eALTER\n   USER\u003c/code\u003e command.\n  \u003c/p\u003e\u003c/div\u003e\u003cdiv id=\"PG-DUMP-NOTES\"\u003e\u003ch2\u003eNotes\u003c/h2\u003e\u003cp\u003e\n   If your database cluster has any local additions to the \u003ccode\u003etemplate1\u003c/code\u003e database,\n   be careful to restore the output of \u003cspan\u003epg_dump\u003c/span\u003e into a\n   truly empty database; otherwise you are likely to get errors due to\n   duplicate definitions of the added objects.  To make an empty database\n   without any local additions, copy from \u003ccode\u003etemplate0\u003c/code\u003e not \u003ccode\u003etemplate1\u003c/code\u003e,\n   for example:\n\u003c/p\u003e\u003cpre\u003eCREATE DATABASE foo WITH TEMPLATE template0;\n\u003c/pre\u003e\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n   When a dump without schema is chosen and the option \u003ccode\u003e--disable-triggers\u003c/code\u003e\n   is used, \u003cspan\u003epg_dump\u003c/span\u003e emits commands\n   to disable triggers on user tables before inserting the data,\n   and then commands to re-enable them after the data has been\n   inserted.  If the restore is stopped in the middle, the system\n   catalogs might be left in the wrong state.\n  \u003c/p\u003e\u003cp\u003e\n   When \u003ccode\u003e--statistics\u003c/code\u003e is specified,\n   \u003ccode\u003epg_dump\u003c/code\u003e will include most optimizer statistics in the\n   resulting dump file.  This does not include all statistics, such as\n   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,\n   custom statistics added by an extension, or statistics collected by the\n   cumulative statistics system. Therefore, it may still be useful to\n   run \u003ccode\u003eANALYZE\u003c/code\u003e after restoring from a dump file to ensure\n   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.\n  \u003c/p\u003e\u003cp\u003e\n   Because \u003cspan\u003epg_dump\u003c/span\u003e is used to transfer data\n   to newer versions of \u003cspan\u003ePostgreSQL\u003c/span\u003e, the output of\n   \u003cspan\u003epg_dump\u003c/span\u003e can be expected to load into\n   \u003cspan\u003ePostgreSQL\u003c/span\u003e server versions newer than\n   \u003cspan\u003epg_dump\u003c/span\u003e\u0026#39;s version.  \u003cspan\u003epg_dump\u003c/span\u003e can also\n   dump from \u003cspan\u003ePostgreSQL\u003c/span\u003e servers older than its own version.\n   (Currently, servers back to version 9.2 are supported.)\n   However, \u003cspan\u003epg_dump\u003c/span\u003e cannot dump from\n   \u003cspan\u003ePostgreSQL\u003c/span\u003e servers newer than its own major version;\n   it will refuse to even try, rather than risk making an invalid dump.\n   Also, it is not guaranteed that \u003cspan\u003epg_dump\u003c/span\u003e\u0026#39;s output can\n   be loaded into a server of an older major version — not even if the\n   dump was taken from a server of that version.  Loading a dump file\n   into an older server may require manual editing of the dump file\n   to remove syntax not understood by the older server.\n   Use of the \u003ccode\u003e--quote-all-identifiers\u003c/code\u003e option is recommended\n   in cross-version cases, as it can prevent problems arising from varying\n   reserved-word lists in different \u003cspan\u003ePostgreSQL\u003c/span\u003e versions.\n  \u003c/p\u003e\u003cp\u003e\n   When dumping logical replication subscriptions,\n   \u003cspan\u003epg_dump\u003c/span\u003e will generate \u003ccode\u003eCREATE\n   SUBSCRIPTION\u003c/code\u003e commands that use the \u003ccode\u003econnect = false\u003c/code\u003e\n   option, so that restoring the subscription does not make remote connections\n   for creating a replication slot or for initial table copy.  That way, the\n   dump can be restored without requiring network access to the remote\n   servers.  It is then up to the user to reactivate the subscriptions in a\n   suitable way.  If the involved hosts have changed, the connection\n   information might have to be changed.  It might also be appropriate to\n   truncate the target tables before initiating a new full table copy.  If users\n   intend to copy initial data during refresh they must create the slot with\n   \u003ccode\u003etwo_phase = false\u003c/code\u003e.  After the initial sync, the\n   \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\n   option will be automatically enabled by the subscriber if the subscription\n   had been originally created with \u003ccode\u003etwo_phase = true\u003c/code\u003e option.\n  \u003c/p\u003e\u003cp\u003e\n   It is generally recommended to use the \u003ccode\u003e-X\u003c/code\u003e\n   (\u003ccode\u003e--no-psqlrc\u003c/code\u003e) option when restoring a database from a\n   plain-text \u003cspan\u003epg_dump\u003c/span\u003e script to ensure a clean\n   restore process and prevent potential conflicts with\n   non-default \u003cspan\u003epsql\u003c/span\u003e configurations.\n  \u003c/p\u003e\u003c/div\u003e\u003cdiv id=\"PG-DUMP-EXAMPLES\"\u003e\u003ch2\u003eExamples\u003c/h2\u003e\u003cp\u003e\n   To dump a database called \u003ccode\u003emydb\u003c/code\u003e into an SQL-script file:\n\u003c/p\u003e\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\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n   To reload such a script into a (freshly created) database named\n   \u003ccode\u003enewdb\u003c/code\u003e:\n\n\u003c/p\u003e\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\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n   To dump a database into a custom-format archive file:\n\n\u003c/p\u003e\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\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n   To dump a database into a directory-format archive:\n\n\u003c/p\u003e\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\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n   To dump a database into a directory-format archive in parallel with\n   5 worker jobs:\n\n\u003c/p\u003e\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\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n   To reload an archive file into a (freshly created) database named\n   \u003ccode\u003enewdb\u003c/code\u003e:\n\n\u003c/p\u003e\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\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n   To reload an archive file into the same database it was dumped from,\n   discarding the current contents of that database:\n\n\u003c/p\u003e\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\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n   To dump a single table named \u003ccode\u003emytab\u003c/code\u003e:\n\n\u003c/p\u003e\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\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n   To dump all tables whose names start with \u003ccode\u003eemp\u003c/code\u003e in the\n   \u003ccode\u003edetroit\u003c/code\u003e schema, except for the table named\n   \u003ccode\u003eemployee_log\u003c/code\u003e:\n\n\u003c/p\u003e\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\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n   To dump all schemas whose names start with \u003ccode\u003eeast\u003c/code\u003e or\n   \u003ccode\u003ewest\u003c/code\u003e and end in \u003ccode\u003egsm\u003c/code\u003e, excluding any schemas whose\n   names contain the word \u003ccode\u003etest\u003c/code\u003e:\n\n\u003c/p\u003e\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\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n   The same, using regular expression notation to consolidate the switches:\n\n\u003c/p\u003e\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\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n   To dump all database objects except for tables whose names begin with\n   \u003ccode\u003ets_\u003c/code\u003e:\n\n\u003c/p\u003e\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\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n   To specify an upper-case or mixed-case name in \u003ccode\u003e-t\u003c/code\u003e and related\n   switches, you need to double-quote the name; else it will be folded to\n   lower case (see \u003ca href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\" rel=\"nofollow\"\u003ePatterns\u003c/a\u003e).  But\n   double quotes are special to the shell, so in turn they must be quoted.\n   Thus, to dump a single table with a mixed-case name, you need something\n   like\n\n\u003c/p\u003e\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\u003cp\u003e\n   To dump all tables whose names start with \u003ccode\u003emytable\u003c/code\u003e, except\n   for table \u003ccode\u003emytable2\u003c/code\u003e, specify a filter file\n   \u003ccode\u003efilter.txt\u003c/code\u003e like:\n\u003c/p\u003e\u003cpre\u003einclude table mytable*\nexclude table mytable2\n\u003c/pre\u003e\u003cp\u003e\n\u003c/p\u003e\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\u003c/div\u003e\u003cdiv id=\"id-1.9.4.14.11\"\u003e\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\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","SourceRevision":"1b2d62b4845aa46374f2cb680f95d3392322cc8128646992ae4e18d0e7084915","ContentHash":"1c3ec7fe6e354208cdda5a8005ff3f2fca9409e703e7c0a443d38e8b1f2e4934","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\u003cdiv class=\"titlepage\"\u003e\u003c/div\u003e\u003cdiv class=\"refnamediv\"\u003e\u003ch2\u003e\u003cspan class=\"refentrytitle\"\u003e\u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e\u003c/span\u003e\u003c/h2\u003e\u003cp\u003epg_dump — \n   export a \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e database as an SQL script or to other formats\n  \u003c/p\u003e\u003c/div\u003e\u003cdiv class=\"refsynopsisdiv\"\u003e\u003ch2\u003eSynopsis\u003c/h2\u003e\u003cdiv class=\"cmdsynopsis\"\u003e\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\u003c/div\u003e\u003c/div\u003e\u003cdiv class=\"refsect1\" id=\"PG-DUMP-DESCRIPTION\"\u003e\u003ch2\u003eDescription\u003c/h2\u003e\u003cp\u003e\n\u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e is a utility for exporting a\n   \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e database. It makes consistent\n   exports even if the database is being used concurrently.\n   \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e does not block other users\n   accessing the database (readers or writers).\n   Note, however, that except in simple cases,\n   \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e is generally not the right choice for\n   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.\n  \u003c/p\u003e\u003cp\u003e\n\u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e only dumps a single database.\n   To export an entire cluster, or to export global objects that are\n   common to all databases in a cluster (such as roles and tablespaces),\n   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.\n  \u003c/p\u003e\u003cp\u003e\n   Dumps can be output in script or archive file formats. Script\n   dumps are plain-text files containing the SQL commands required\n   to reconstruct the database to the state it was in at the time it was\n   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\n   can be used to reconstruct the database even on other machines and\n   other architectures; with some modifications, even on other SQL\n   database products.\n  \u003c/p\u003e\u003cp\u003e\n   The alternative archive file formats must be used with\n   \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\n   allow \u003cspan class=\"application\"\u003epg_restore\u003c/span\u003e to be selective about\n   what is restored, or even to reorder the items prior to being\n   restored.\n   The archive file formats are designed to be portable across\n   architectures.\n  \u003c/p\u003e\u003cp\u003e\n   When used with one of the archive file formats and combined with\n   \u003cspan class=\"application\"\u003epg_restore\u003c/span\u003e,\n   \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e provides a flexible archival and\n   transfer mechanism. \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e can be used to\n   export an entire database, then \u003cspan class=\"application\"\u003epg_restore\u003c/span\u003e\n   can be used to examine the archive and/or select which parts of the\n   database are to be restored. The most flexible output file formats are\n   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\n   \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\n   for selection and reordering of all archived items, support parallel\n   restoration, and are compressed by default. The \u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003edirectory\u003c/span\u003e”\u003c/span\u003e\n   format is the only format that supports parallel dumps.\n  \u003c/p\u003e\u003cp\u003e\n   While running \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e, one should examine the\n   output for any warnings (printed on standard error), especially in\n   light of the limitations listed below.\n  \u003c/p\u003e\u003cdiv class=\"warning\"\u003e\u003ch3 class=\"title\"\u003eWarning\u003c/h3\u003e\u003cp\u003e\n    Restoring a dump causes the destination to execute arbitrary code of the\n    source superusers' choice.  Partial dumps and partial restores do not limit\n    that.  If the source superusers are not trusted, the dumped SQL statements\n    must be inspected before restoring.  Non-plain-text dumps can be inspected\n    by using \u003cspan class=\"application\"\u003epg_restore\u003c/span\u003e's \u003ccode class=\"option\"\u003e--file\u003c/code\u003e\n    option.  Note that the client running the dump and restore need not trust\n    the source or destination superusers.\n   \u003c/p\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv class=\"refsect1\" id=\"PG-DUMP-OPTIONS\"\u003e\u003ch2\u003eOptions\u003c/h2\u003e\u003cp\u003e\n    The following command-line options control the content and\n    format of the output.\n\n    \u003c/p\u003e\u003cdiv class=\"variablelist\"\u003e\u003cdl class=\"variablelist\"\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Specifies the name of the database to be dumped.  If this is\n        not specified, the environment variable\n        \u003ccode class=\"envar\"\u003ePGDATABASE\u003c/code\u003e is used.  If that is not set, the\n        user name specified for the connection is used.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        Dump only the data, not the schema (data definitions) or statistics.\n        Table data, large objects, and sequence values are dumped.\n       \u003c/p\u003e\u003cp\u003e\n        This option is similar to, but for historical reasons not identical\n        to, specifying \u003ccode class=\"option\"\u003e--section=data\u003c/code\u003e.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        Include large objects in the dump.  This is the default behavior\n        except when \u003ccode class=\"option\"\u003e--schema\u003c/code\u003e, \u003ccode class=\"option\"\u003e--table\u003c/code\u003e,\n        \u003ccode class=\"option\"\u003e--schema-only\u003c/code\u003e, \u003ccode class=\"option\"\u003e--statistics-only\u003c/code\u003e, or\n        \u003ccode class=\"option\"\u003e--no-data\u003c/code\u003e is specified.  The \u003ccode class=\"option\"\u003e-b\u003c/code\u003e\n        switch is therefore only useful to add large objects to dumps where a\n        specific schema or table has been requested.  Note that large objects\n        are considered data and therefore will be included when\n        \u003ccode class=\"option\"\u003e--data-only\u003c/code\u003e is used, but not when\n        \u003ccode class=\"option\"\u003e--schema-only\u003c/code\u003e or \u003ccode class=\"option\"\u003e--statistics-only\u003c/code\u003e\n        is.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        Exclude large objects in the dump.\n       \u003c/p\u003e\u003cp\u003e\n        When both \u003ccode class=\"option\"\u003e-b\u003c/code\u003e and \u003ccode class=\"option\"\u003e-B\u003c/code\u003e are given, the behavior\n        is to output large objects, when data is being dumped, see the\n        \u003ccode class=\"option\"\u003e-b\u003c/code\u003e documentation.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        Output commands to \u003ccode class=\"command\"\u003eDROP\u003c/code\u003e all the dumped\n        database objects prior to outputting the commands for creating them.\n        This option is useful when the restore is to overwrite an existing\n        database.  If any of the objects do not exist in the destination\n        database, ignorable error messages will be reported during\n        restore, unless \u003ccode class=\"option\"\u003e--if-exists\u003c/code\u003e is also specified.\n       \u003c/p\u003e\u003cp\u003e\n        This option is ignored when emitting an archive (non-text) output\n        file.  For the archive formats, you can specify the option when you\n        call \u003ccode class=\"command\"\u003epg_restore\u003c/code\u003e.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        Begin the output with a command to create the\n        database itself and reconnect to the created database.  (With a\n        script of this form, it doesn't matter which database in the\n        destination installation you connect to before running the script.)\n        If \u003ccode class=\"option\"\u003e--clean\u003c/code\u003e is also specified, the script drops and\n        recreates the target database before reconnecting to it.\n       \u003c/p\u003e\u003cp\u003e\n        With \u003ccode class=\"option\"\u003e--create\u003c/code\u003e, the output also includes the\n        database's comment if any, and any configuration variable settings\n        that are specific to this database, that is,\n        any \u003ccode class=\"command\"\u003eALTER DATABASE ... SET ...\u003c/code\u003e\n        and \u003ccode class=\"command\"\u003eALTER ROLE ... IN DATABASE ... SET ...\u003c/code\u003e\n        commands that mention this database.\n        Access privileges for the database itself are also dumped,\n        unless \u003ccode class=\"option\"\u003e--no-acl\u003c/code\u003e is specified.\n       \u003c/p\u003e\u003cp\u003e\n        This option is ignored when emitting an archive (non-text) output\n        file.  For the archive formats, you can specify the option when you\n        call \u003ccode class=\"command\"\u003epg_restore\u003c/code\u003e.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        Dump only extensions matching \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e.  When this option is not\n        specified, all non-system extensions in the target database will be\n        dumped.  Multiple extensions can be selected by writing multiple\n        \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\n        pattern according to the same rules used by\n        \u003cspan class=\"application\"\u003epsql\u003c/span\u003e's \u003ccode class=\"literal\"\u003e\\d\u003c/code\u003e commands (see\n        \u003ca class=\"xref\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003ePatterns\u003c/a\u003e), so multiple extensions can also\n        be selected by writing wildcard characters in the pattern.  When using\n        wildcards, be careful to quote the pattern if needed to prevent the\n        shell from expanding the wildcards.\n       \u003c/p\u003e\u003cp\u003e\n        Any configuration relation registered by\n        \u003ccode class=\"function\"\u003epg_extension_config_dump\u003c/code\u003e is included in the\n        dump if its extension is specified by \u003ccode class=\"option\"\u003e--extension\u003c/code\u003e.\n       \u003c/p\u003e\u003cdiv class=\"note\"\u003e\u003ch3 class=\"title\"\u003eNote\u003c/h3\u003e\u003cp\u003e\n         When \u003ccode class=\"option\"\u003e-e\u003c/code\u003e is specified,\n         \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e makes no attempt to dump any other\n         database objects that the selected extension(s) might depend upon.\n         Therefore, there is no guarantee that the results of a\n         specific-extension dump can be successfully restored by themselves\n         into a clean database.\n        \u003c/p\u003e\u003c/div\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        Create the dump in the specified character set encoding. By default,\n        the dump is created in the database encoding.  (Another way to get the\n        same result is to set the \u003ccode class=\"envar\"\u003ePGCLIENTENCODING\u003c/code\u003e environment\n        variable to the desired dump encoding.)  The supported encodings are\n        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.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        Send output to the specified file. This parameter can be omitted for\n        file based output formats, in which case the standard output is used.\n        It must be given for the directory output format however, where it\n        specifies the target directory instead of a file. In this case the\n        directory is created by \u003ccode class=\"command\"\u003epg_dump\u003c/code\u003e and must not exist\n        before.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        Selects the format of the output.\n        \u003cem class=\"replaceable\"\u003e\u003ccode\u003eformat\u003c/code\u003e\u003c/em\u003e can be one of the following:\n\n       \u003c/p\u003e\u003cdiv class=\"variablelist\"\u003e\u003cdl class=\"variablelist\"\u003e\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\u003cdd\u003e\u003cp\u003e\n           Output a plain-text SQL script file (the default).\n          \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n           Output a custom-format archive suitable for input into\n           \u003cspan class=\"application\"\u003epg_restore\u003c/span\u003e.\n           Together with the directory output format, this is the most flexible\n           output format in that it allows manual selection and reordering of\n           archived items during restore. This format is also compressed by\n           default.\n          \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n           Output a directory-format archive suitable for input into\n           \u003cspan class=\"application\"\u003epg_restore\u003c/span\u003e. This will create a directory\n           with one file for each table and large object being dumped, plus a\n           so-called Table of Contents file describing the dumped objects in a\n           machine-readable format that \u003cspan class=\"application\"\u003epg_restore\u003c/span\u003e\n           can read. A directory format archive can be manipulated with\n           standard Unix tools; for example, files in an uncompressed archive\n           can be compressed with the \u003cspan class=\"application\"\u003egzip\u003c/span\u003e,\n           \u003cspan class=\"application\"\u003elz4\u003c/span\u003e, or\n           \u003cspan class=\"application\"\u003ezstd\u003c/span\u003e tools.\n           This format is compressed by default using \u003ccode class=\"literal\"\u003egzip\u003c/code\u003e\n           and also supports parallel dumps.\n          \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n           Output a \u003ccode class=\"command\"\u003etar\u003c/code\u003e-format archive suitable for input\n           into \u003cspan class=\"application\"\u003epg_restore\u003c/span\u003e. The tar format is\n           compatible with the directory format: extracting a tar-format\n           archive produces a valid directory-format archive.\n           However, the tar format does not support compression. Also, when\n           using tar format the relative order of table data items cannot be\n           changed during restore.\n          \u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        Run the dump in parallel by dumping \u003cem class=\"replaceable\"\u003e\u003ccode\u003enjobs\u003c/code\u003e\u003c/em\u003e\n        tables simultaneously. This option may reduce the time needed to perform the dump but it also\n        increases the load on the database server. You can only use this option with the\n        directory output format because this is the only output format where multiple processes\n        can write their data at the same time.\n       \u003c/p\u003e\u003cp\u003e\u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e will open \u003cem class=\"replaceable\"\u003e\u003ccode\u003enjobs\u003c/code\u003e\u003c/em\u003e\n        + 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\n        setting is high enough to accommodate all connections.\n       \u003c/p\u003e\u003cp\u003e\n        Requesting exclusive locks on database objects while running a parallel dump could\n        cause the dump to fail. The reason is that the \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e leader process\n        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\n        objects that the worker processes are going to dump later in order to\n        make sure that nobody deletes them and makes them go away while the dump is running.\n        If another client then requests an exclusive lock on a table, that lock will not be\n        granted but will be queued waiting for the shared lock of the leader process to be\n        released. Consequently any other access to the table will not be granted either and\n        will queue after the exclusive lock request. This includes the worker process trying\n        to dump the table. Without any precautions this would be a classic deadlock situation.\n        To detect this conflict, the \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e worker process requests another\n        shared lock using the \u003ccode class=\"literal\"\u003eNOWAIT\u003c/code\u003e option. If the worker process is not granted\n        this shared lock, somebody else must have requested an exclusive lock in the meantime\n        and there is no way to continue with the dump, so \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e has no choice\n        but to abort the dump.\n       \u003c/p\u003e\u003cp\u003e\n        To perform a parallel dump, the database server needs to support\n        synchronized snapshots, a feature that was introduced in\n        \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e 9.2 for primary servers and 10\n        for standbys. With this feature, database clients can ensure they see\n        the same data set even though they use different connections.\n        \u003ccode class=\"command\"\u003epg_dump -j\u003c/code\u003e uses multiple database connections; it\n        connects to the database once with the leader process and once again\n        for each worker job. Without the synchronized snapshot feature, the\n        different worker jobs wouldn't be guaranteed to see the same data in\n        each connection, which could lead to an inconsistent backup.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        Dump only schemas matching \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e; this selects both the\n        schema itself, and all its contained objects.  When this option is\n        not specified, all non-system schemas in the target database will be\n        dumped.  Multiple schemas can be\n        selected by writing multiple \u003ccode class=\"option\"\u003e-n\u003c/code\u003e switches.  The\n        \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e parameter is\n        interpreted as a pattern according to the same rules used by\n        \u003cspan class=\"application\"\u003epsql\u003c/span\u003e's \u003ccode class=\"literal\"\u003e\\d\u003c/code\u003e commands\n        (see \u003ca class=\"xref\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003ePatterns\u003c/a\u003e),\n        so multiple schemas can also be selected by writing wildcard characters\n        in the pattern.  When using wildcards, be careful to quote the pattern\n        if needed to prevent the shell from expanding the wildcards;  see\n        \u003ca class=\"xref\" href=\"/docs/18/app-pgdump.html#PG-DUMP-EXAMPLES\" title=\"Examples\"\u003eExamples\u003c/a\u003e below.\n       \u003c/p\u003e\u003cdiv class=\"note\"\u003e\u003ch3 class=\"title\"\u003eNote\u003c/h3\u003e\u003cp\u003e\n         When \u003ccode class=\"option\"\u003e-n\u003c/code\u003e is specified, \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e\n         makes no attempt to dump any other database objects that the selected\n         schema(s) might depend upon. Therefore, there is no guarantee\n         that the results of a specific-schema dump can be successfully\n         restored by themselves into a clean database.\n        \u003c/p\u003e\u003c/div\u003e\u003cdiv class=\"note\"\u003e\u003ch3 class=\"title\"\u003eNote\u003c/h3\u003e\u003cp\u003e\n         Non-schema objects such as large objects are not dumped when \u003ccode class=\"option\"\u003e-n\u003c/code\u003e is\n         specified.  You can add large objects back to the dump with the\n         \u003ccode class=\"option\"\u003e--large-objects\u003c/code\u003e switch.\n        \u003c/p\u003e\u003c/div\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        Do not dump any schemas matching \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e.  The pattern is\n        interpreted according to the same rules as for \u003ccode class=\"option\"\u003e-n\u003c/code\u003e.\n        \u003ccode class=\"option\"\u003e-N\u003c/code\u003e can be given more than once to exclude schemas\n        matching any of several patterns.\n       \u003c/p\u003e\u003cp\u003e\n        When both \u003ccode class=\"option\"\u003e-n\u003c/code\u003e and \u003ccode class=\"option\"\u003e-N\u003c/code\u003e are given, the behavior\n        is to dump just the schemas that match at least one \u003ccode class=\"option\"\u003e-n\u003c/code\u003e\n        switch but no \u003ccode class=\"option\"\u003e-N\u003c/code\u003e switches.  If \u003ccode class=\"option\"\u003e-N\u003c/code\u003e appears\n        without \u003ccode class=\"option\"\u003e-n\u003c/code\u003e, then schemas matching \u003ccode class=\"option\"\u003e-N\u003c/code\u003e are\n        excluded from what is otherwise a normal dump.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        Do not output commands to set\n        ownership of objects to match the original database.\n        By default, \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e issues\n        \u003ccode class=\"command\"\u003eALTER OWNER\u003c/code\u003e or\n        \u003ccode class=\"command\"\u003eSET SESSION AUTHORIZATION\u003c/code\u003e\n        statements to set ownership of created database objects.\n        These statements\n        will fail when the script is run unless it is started by a superuser\n        (or the same user that owns all of the objects in the script).\n        To make a script that can be restored by any user, but will give\n        that user ownership of all the objects, specify \u003ccode class=\"option\"\u003e-O\u003c/code\u003e.\n       \u003c/p\u003e\u003cp\u003e\n        This option is ignored when emitting an archive (non-text) output\n        file.  For the archive formats, you can specify the option when you\n        call \u003ccode class=\"command\"\u003epg_restore\u003c/code\u003e.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        This option is obsolete but still accepted for backwards\n        compatibility.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        Dump only the object definitions (schema), not data or statistics.\n       \u003c/p\u003e\u003cp\u003e\n        This option cannot be used with \u003ccode class=\"option\"\u003e--data-only\u003c/code\u003e\n        or \u003ccode class=\"option\"\u003e--statistics-only\u003c/code\u003e.\n        It is similar to, but for historical reasons not identical to,\n        specifying\n        \u003ccode class=\"option\"\u003e--section=pre-data --section=post-data\u003c/code\u003e.\n       \u003c/p\u003e\u003cp\u003e\n        (Do not confuse this with the \u003ccode class=\"option\"\u003e--schema\u003c/code\u003e option, which\n        uses the word \u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003eschema\u003c/span\u003e”\u003c/span\u003e in a different meaning.)\n       \u003c/p\u003e\u003cp\u003e\n        To exclude table data for only a subset of tables in the database,\n        see \u003ccode class=\"option\"\u003e--exclude-table-data\u003c/code\u003e.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        Specify the superuser user name to use when disabling triggers.\n        This is relevant only if \u003ccode class=\"option\"\u003e--disable-triggers\u003c/code\u003e is used.\n        (Usually, it's better to leave this out, and instead start the\n        resulting script as superuser.)\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        Dump only tables with names matching\n        \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e. Multiple tables\n        can be selected by writing multiple \u003ccode class=\"option\"\u003e-t\u003c/code\u003e switches.  The\n        \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e parameter is\n        interpreted as a pattern according to the same rules used by\n        \u003cspan class=\"application\"\u003epsql\u003c/span\u003e's \u003ccode class=\"literal\"\u003e\\d\u003c/code\u003e commands\n        (see \u003ca class=\"xref\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003ePatterns\u003c/a\u003e),\n        so multiple tables can also be selected by writing wildcard characters\n        in the pattern.  When using wildcards, be careful to quote the pattern\n        if needed to prevent the shell from expanding the wildcards;  see\n        \u003ca class=\"xref\" href=\"/docs/18/app-pgdump.html#PG-DUMP-EXAMPLES\" title=\"Examples\"\u003eExamples\u003c/a\u003e below.\n       \u003c/p\u003e\u003cp\u003e\n        As well as tables, this option can be used to dump the definition of matching\n        views, materialized views, foreign tables, and sequences.  It will not dump the\n        contents of views or materialized views, and the contents of foreign tables will\n        only be dumped if the corresponding foreign server is specified with\n        \u003ccode class=\"option\"\u003e--include-foreign-data\u003c/code\u003e.\n       \u003c/p\u003e\u003cp\u003e\n        The \u003ccode class=\"option\"\u003e-n\u003c/code\u003e and \u003ccode class=\"option\"\u003e-N\u003c/code\u003e switches have no effect when\n        \u003ccode class=\"option\"\u003e-t\u003c/code\u003e is used, because tables selected by \u003ccode class=\"option\"\u003e-t\u003c/code\u003e will\n        be dumped regardless of those switches, and non-table objects will not\n        be dumped.\n       \u003c/p\u003e\u003cdiv class=\"note\"\u003e\u003ch3 class=\"title\"\u003eNote\u003c/h3\u003e\u003cp\u003e\n         When \u003ccode class=\"option\"\u003e-t\u003c/code\u003e is specified, \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e\n         makes no attempt to dump any other database objects that the selected\n         table(s) might depend upon. Therefore, there is no guarantee\n         that the results of a specific-table dump can be successfully\n         restored by themselves into a clean database.\n        \u003c/p\u003e\u003c/div\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        Do not dump any tables matching \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e.  The pattern is\n        interpreted according to the same rules as for \u003ccode class=\"option\"\u003e-t\u003c/code\u003e.\n        \u003ccode class=\"option\"\u003e-T\u003c/code\u003e can be given more than once to exclude tables\n        matching any of several patterns.\n       \u003c/p\u003e\u003cp\u003e\n        When both \u003ccode class=\"option\"\u003e-t\u003c/code\u003e and \u003ccode class=\"option\"\u003e-T\u003c/code\u003e are given, the behavior\n        is to dump just the tables that match at least one \u003ccode class=\"option\"\u003e-t\u003c/code\u003e\n        switch but no \u003ccode class=\"option\"\u003e-T\u003c/code\u003e switches.  If \u003ccode class=\"option\"\u003e-T\u003c/code\u003e appears\n        without \u003ccode class=\"option\"\u003e-t\u003c/code\u003e, then tables matching \u003ccode class=\"option\"\u003e-T\u003c/code\u003e are\n        excluded from what is otherwise a normal dump.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        Specifies verbose mode.  This will cause\n        \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e to output detailed object\n        comments and start/stop times to the dump file, and progress\n        messages to standard error.\n        Repeating the option causes additional debug-level messages\n        to appear on standard error.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n       Print the \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e version and exit.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        Prevent dumping of access privileges (grant/revoke commands).\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        Specify the compression method and/or the compression level to use.\n        The compression method can be set to \u003ccode class=\"literal\"\u003egzip\u003c/code\u003e,\n        \u003ccode class=\"literal\"\u003elz4\u003c/code\u003e, \u003ccode class=\"literal\"\u003ezstd\u003c/code\u003e,\n        or \u003ccode class=\"literal\"\u003enone\u003c/code\u003e for no compression.\n        A compression detail string can optionally be specified.  If the\n        detail string is an integer, it specifies the compression level.\n        Otherwise, it should be a comma-separated list of items, each of the\n        form \u003ccode class=\"literal\"\u003ekeyword\u003c/code\u003e or \u003ccode class=\"literal\"\u003ekeyword=value\u003c/code\u003e.\n        Currently, the supported keywords are \u003ccode class=\"literal\"\u003elevel\u003c/code\u003e and\n        \u003ccode class=\"literal\"\u003elong\u003c/code\u003e.\n       \u003c/p\u003e\u003cp\u003e\n        If no compression level is specified, the default compression\n        level will be used. If only a level is specified without mentioning\n        an algorithm, \u003ccode class=\"literal\"\u003egzip\u003c/code\u003e compression will be used if\n        the level is greater than \u003ccode class=\"literal\"\u003e0\u003c/code\u003e, and no compression\n        will be used if the level is \u003ccode class=\"literal\"\u003e0\u003c/code\u003e.\n       \u003c/p\u003e\u003cp\u003e\n        For the custom and directory archive formats, this specifies compression of\n        individual table-data segments, and the default is to compress using\n        \u003ccode class=\"literal\"\u003egzip\u003c/code\u003e at a moderate level. For plain text output,\n        setting a nonzero compression level causes the entire output file to be compressed,\n        as though it had been fed through \u003cspan class=\"application\"\u003egzip\u003c/span\u003e,\n        \u003cspan class=\"application\"\u003elz4\u003c/span\u003e, or \u003cspan class=\"application\"\u003ezstd\u003c/span\u003e;\n        but the default is not to compress.\n        With zstd compression, \u003ccode class=\"literal\"\u003elong\u003c/code\u003e mode may improve the\n        compression ratio, at the cost of increased memory use.\n       \u003c/p\u003e\u003cp\u003e\n        The tar archive format currently does not support compression at all.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--binary-upgrade\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        This option is for use by in-place upgrade utilities.  Its use\n        for other purposes is not recommended or supported.  The\n        behavior of the option may change in future releases without\n        notice.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        Dump data as \u003ccode class=\"command\"\u003eINSERT\u003c/code\u003e commands with explicit\n        column names (\u003ccode class=\"literal\"\u003eINSERT INTO\n        \u003cem class=\"replaceable\"\u003e\u003ccode\u003etable\u003c/code\u003e\u003c/em\u003e\n        (\u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolumn\u003c/code\u003e\u003c/em\u003e, ...) VALUES\n        ...\u003c/code\u003e).  This will make restoration very slow; it is mainly\n        useful for making dumps that can be loaded into\n        non-\u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e databases.\n        Any error during restoring will cause only rows that are part of the\n        problematic \u003ccode class=\"command\"\u003eINSERT\u003c/code\u003e to be lost, rather than the\n        entire table contents.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--disable-dollar-quoting\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        This option disables the use of dollar quoting for function bodies,\n        and forces them to be quoted using SQL standard string syntax.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--disable-triggers\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        This option is relevant only when creating a dump that includes data\n        but does not include schema.\n        It instructs \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e to include commands\n        to temporarily disable triggers on the target tables while\n        the data is restored.  Use this if you have referential\n        integrity checks or other triggers on the tables that you\n        do not want to invoke during data restore.\n       \u003c/p\u003e\u003cp\u003e\n        Presently, the commands emitted for \u003ccode class=\"option\"\u003e--disable-triggers\u003c/code\u003e\n        must be done as superuser.  So, you should also specify\n        a superuser name with \u003ccode class=\"option\"\u003e-S\u003c/code\u003e, or preferably be careful to\n        start the resulting script as a superuser.\n       \u003c/p\u003e\u003cp\u003e\n        This option is ignored when emitting an archive (non-text) output\n        file.  For the archive formats, you can specify the option when you\n        call \u003ccode class=\"command\"\u003epg_restore\u003c/code\u003e.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--enable-row-security\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        This option is relevant only when dumping the contents of a table\n        which has row security.  By default, \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e will set\n        \u003ca class=\"xref\" href=\"/docs/18/runtime-config-client.html#GUC-ROW-SECURITY\"\u003erow_security\u003c/a\u003e to off, to ensure\n        that all data is dumped from the table.  If the user does not have\n        sufficient privileges to bypass row security, then an error is thrown.\n        This parameter instructs \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e to set\n        \u003ca class=\"xref\" href=\"/docs/18/runtime-config-client.html#GUC-ROW-SECURITY\"\u003erow_security\u003c/a\u003e to on instead, allowing the user\n        to dump the parts of the contents of the table that they have access to.\n       \u003c/p\u003e\u003cp\u003e\n        Note that if you use this option currently, you probably also want\n        the dump be in \u003ccode class=\"command\"\u003eINSERT\u003c/code\u003e format, as the\n        \u003ccode class=\"command\"\u003eCOPY FROM\u003c/code\u003e during restore does not support row security.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        Do not dump any extensions matching \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e.  The pattern is\n        interpreted according to the same rules as for \u003ccode class=\"option\"\u003e-e\u003c/code\u003e.\n        \u003ccode class=\"option\"\u003e--exclude-extension\u003c/code\u003e can be given more than once to exclude extensions\n        matching any of several patterns.\n       \u003c/p\u003e\u003cp\u003e\n        When both \u003ccode class=\"option\"\u003e-e\u003c/code\u003e and \u003ccode class=\"option\"\u003e--exclude-extension\u003c/code\u003e are given, the behavior\n        is to dump just the extensions that match at least one \u003ccode class=\"option\"\u003e-e\u003c/code\u003e\n        switch but no \u003ccode class=\"option\"\u003e--exclude-extension\u003c/code\u003e switches.  If \u003ccode class=\"option\"\u003e--exclude-extension\u003c/code\u003e\n        appears without \u003ccode class=\"option\"\u003e-e\u003c/code\u003e, then extensions matching \u003ccode class=\"option\"\u003e--exclude-extension\u003c/code\u003e are\n        excluded from what is otherwise a normal dump.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        This is the same as\n        the \u003ccode class=\"option\"\u003e-T\u003c/code\u003e/\u003ccode class=\"option\"\u003e--exclude-table\u003c/code\u003e option,\n        except that it also excludes any partitions or inheritance child\n        tables of the table(s) matching the\n        \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        Do not dump data for any tables matching \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e. The pattern is\n        interpreted according to the same rules as for \u003ccode class=\"option\"\u003e-t\u003c/code\u003e.\n        \u003ccode class=\"option\"\u003e--exclude-table-data\u003c/code\u003e can be given more than once to\n        exclude tables matching any of several patterns. This option is\n        useful when you need the definition of a particular table even\n        though you do not need the data in it.\n       \u003c/p\u003e\u003cp\u003e\n        To exclude data for all tables in the database, see \u003ccode class=\"option\"\u003e--schema-only\u003c/code\u003e\n        or \u003ccode class=\"option\"\u003e--statistics-only\u003c/code\u003e.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        This is the same as the \u003ccode class=\"option\"\u003e--exclude-table-data\u003c/code\u003e option,\n        except that it also excludes data of any partitions or inheritance\n        child tables of the table(s) matching the\n        \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        Use the specified value of \u003ccode class=\"option\"\u003eextra_float_digits\u003c/code\u003e when dumping\n        floating-point data, instead of the maximum available precision.\n        Routine dumps made for backup purposes should not use this option.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        Specify a filename from which to read patterns for objects to include\n        or exclude from the dump. The patterns are interpreted according to the\n        same rules as the corresponding options:\n        \u003ccode class=\"option\"\u003e-t\u003c/code\u003e/\u003ccode class=\"option\"\u003e--table\u003c/code\u003e,\n        \u003ccode class=\"option\"\u003e--table-and-children\u003c/code\u003e,\n        \u003ccode class=\"option\"\u003e-T\u003c/code\u003e/\u003ccode class=\"option\"\u003e--exclude-table\u003c/code\u003e, and\n        \u003ccode class=\"option\"\u003e--exclude-table-and-children\u003c/code\u003e for tables,\n        \u003ccode class=\"option\"\u003e-n\u003c/code\u003e/\u003ccode class=\"option\"\u003e--schema\u003c/code\u003e and\n        \u003ccode class=\"option\"\u003e-N\u003c/code\u003e/\u003ccode class=\"option\"\u003e--exclude-schema\u003c/code\u003e for schemas,\n        \u003ccode class=\"option\"\u003e--include-foreign-data\u003c/code\u003e for data on foreign servers,\n        \u003ccode class=\"option\"\u003e--exclude-table-data\u003c/code\u003e and\n        \u003ccode class=\"option\"\u003e--exclude-table-data-and-children\u003c/code\u003e for table data, and\n        \u003ccode class=\"option\"\u003e-e\u003c/code\u003e/\u003ccode class=\"option\"\u003e--extension\u003c/code\u003e and\n        \u003ccode class=\"option\"\u003e--exclude-extension\u003c/code\u003e for extensions.\n        To read from \u003ccode class=\"literal\"\u003eSTDIN\u003c/code\u003e, use \u003ccode class=\"filename\"\u003e-\u003c/code\u003e as the\n        filename.  The \u003ccode class=\"option\"\u003e--filter\u003c/code\u003e option can be specified in\n        conjunction with the above listed options for including or excluding\n        objects, and can also be specified more than once for multiple filter\n        files.\n       \u003c/p\u003e\u003cp\u003e\n        The file lists one object pattern per row, with the following format:\n\u003c/p\u003e\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\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n        The first keyword specifies whether the objects matched by the pattern\n        are to be included or excluded. The second keyword specifies the type\n        of object to be filtered using the pattern:\n        \u003c/p\u003e\u003cdiv class=\"itemizedlist\"\u003e\u003cul class=\"itemizedlist\"\u003e\u003cli class=\"listitem\"\u003e\u003cp\u003e\n\u003ccode class=\"literal\"\u003eextension\u003c/code\u003e: extensions. This works like the\n           \u003ccode class=\"option\"\u003e-e\u003c/code\u003e/\u003ccode class=\"option\"\u003e--extension\u003c/code\u003e or\n           \u003ccode class=\"option\"\u003e--exclude-extension\u003c/code\u003e option.\n          \u003c/p\u003e\u003c/li\u003e\u003cli class=\"listitem\"\u003e\u003cp\u003e\n\u003ccode class=\"literal\"\u003eforeign_data\u003c/code\u003e: data on foreign servers. This works like\n           the \u003ccode class=\"option\"\u003e--include-foreign-data\u003c/code\u003e option. This keyword can\n           only be used with the \u003ccode class=\"literal\"\u003einclude\u003c/code\u003e keyword.\n          \u003c/p\u003e\u003c/li\u003e\u003cli class=\"listitem\"\u003e\u003cp\u003e\n\u003ccode class=\"literal\"\u003etable\u003c/code\u003e: tables. This works like the\n           \u003ccode class=\"option\"\u003e-t\u003c/code\u003e/\u003ccode class=\"option\"\u003e--table\u003c/code\u003e or\n           \u003ccode class=\"option\"\u003e-T\u003c/code\u003e/\u003ccode class=\"option\"\u003e--exclude-table\u003c/code\u003e option.\n          \u003c/p\u003e\u003c/li\u003e\u003cli class=\"listitem\"\u003e\u003cp\u003e\n\u003ccode class=\"literal\"\u003etable_and_children\u003c/code\u003e: tables including any partitions\n           or inheritance child tables. This works like the\n           \u003ccode class=\"option\"\u003e--table-and-children\u003c/code\u003e or\n           \u003ccode class=\"option\"\u003e--exclude-table-and-children\u003c/code\u003e option.\n          \u003c/p\u003e\u003c/li\u003e\u003cli class=\"listitem\"\u003e\u003cp\u003e\n\u003ccode class=\"literal\"\u003etable_data\u003c/code\u003e: table data of any tables matching\n           \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e. This works like the\n           \u003ccode class=\"option\"\u003e--exclude-table-data\u003c/code\u003e option. This keyword can only\n           be used with the \u003ccode class=\"literal\"\u003eexclude\u003c/code\u003e keyword.\n          \u003c/p\u003e\u003c/li\u003e\u003cli class=\"listitem\"\u003e\u003cp\u003e\n\u003ccode class=\"literal\"\u003etable_data_and_children\u003c/code\u003e: table data of any tables\n           matching \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e as well as any partitions\n           or inheritance children of the table(s). This works like the\n           \u003ccode class=\"option\"\u003e--exclude-table-data-and-children\u003c/code\u003e option. This\n           keyword can only be used with the \u003ccode class=\"literal\"\u003eexclude\u003c/code\u003e keyword.\n          \u003c/p\u003e\u003c/li\u003e\u003cli class=\"listitem\"\u003e\u003cp\u003e\n\u003ccode class=\"literal\"\u003eschema\u003c/code\u003e: schemas. This works like the\n           \u003ccode class=\"option\"\u003e-n\u003c/code\u003e/\u003ccode class=\"option\"\u003e--schema\u003c/code\u003e or\n           \u003ccode class=\"option\"\u003e-N\u003c/code\u003e/\u003ccode class=\"option\"\u003e--exclude-schema\u003c/code\u003e option.\n          \u003c/p\u003e\u003c/li\u003e\u003c/ul\u003e\u003c/div\u003e\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n        Lines starting with \u003ccode class=\"literal\"\u003e#\u003c/code\u003e are considered comments and\n        ignored. Comments can be placed after an object pattern row as well.\n        Blank lines are also ignored. See \u003ca class=\"xref\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003ePatterns\u003c/a\u003e\n        for how to perform quoting in patterns.\n       \u003c/p\u003e\u003cp\u003e\n        Example files are listed below in the \u003ca class=\"xref\" href=\"/docs/18/app-pgdump.html#PG-DUMP-EXAMPLES\" title=\"Examples\"\u003eExamples\u003c/a\u003e\n        section.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--if-exists\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Use \u003ccode class=\"literal\"\u003eDROP ... IF EXISTS\u003c/code\u003e commands to drop objects\n        in \u003ccode class=\"option\"\u003e--clean\u003c/code\u003e mode.  This suppresses \u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003edoes not\n        exist\u003c/span\u003e”\u003c/span\u003e errors that might otherwise be reported.  This\n        option is not valid unless \u003ccode class=\"option\"\u003e--clean\u003c/code\u003e is also\n        specified.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        Dump the data for any foreign table with a foreign server\n        matching \u003cem class=\"replaceable\"\u003e\u003ccode\u003eforeignserver\u003c/code\u003e\u003c/em\u003e\n        pattern. Multiple foreign servers can be selected by writing multiple\n        \u003ccode class=\"option\"\u003e--include-foreign-data\u003c/code\u003e switches.\n        Also, the \u003cem class=\"replaceable\"\u003e\u003ccode\u003eforeignserver\u003c/code\u003e\u003c/em\u003e parameter is\n        interpreted as a pattern according to the same rules used by\n        \u003cspan class=\"application\"\u003epsql\u003c/span\u003e's \u003ccode class=\"literal\"\u003e\\d\u003c/code\u003e commands\n        (see \u003ca class=\"xref\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003ePatterns\u003c/a\u003e),\n        so multiple foreign servers can also be selected by writing wildcard characters\n        in the pattern.  When using wildcards, be careful to quote the pattern\n        if needed to prevent the shell from expanding the wildcards; see\n        \u003ca class=\"xref\" href=\"/docs/18/app-pgdump.html#PG-DUMP-EXAMPLES\" title=\"Examples\"\u003eExamples\u003c/a\u003e below.\n        The only exception is that an empty pattern is disallowed.\n       \u003c/p\u003e\u003cdiv class=\"note\"\u003e\u003ch3 class=\"title\"\u003eNote\u003c/h3\u003e\u003cp\u003e\n         Using wildcards in \u003ccode class=\"option\"\u003e--include-foreign-data\u003c/code\u003e may result\n         in access to unexpected foreign servers. Also, to use this option securely,\n         make sure that the named server must have a trusted owner.\n        \u003c/p\u003e\u003c/div\u003e\u003cdiv class=\"note\"\u003e\u003ch3 class=\"title\"\u003eNote\u003c/h3\u003e\u003cp\u003e\n         When \u003ccode class=\"option\"\u003e--include-foreign-data\u003c/code\u003e is specified,\n         \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e does not check that the foreign\n         table is writable.  Therefore, there is no guarantee that the\n         results of a foreign table dump can be successfully restored.\n        \u003c/p\u003e\u003c/div\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--inserts\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Dump data as \u003ccode class=\"command\"\u003eINSERT\u003c/code\u003e commands (rather\n        than \u003ccode class=\"command\"\u003eCOPY\u003c/code\u003e).  This will make restoration very slow;\n        it is mainly useful for making dumps that can be loaded into\n        non-\u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e databases.\n        Any error during restoring will cause only rows that are part of the\n        problematic \u003ccode class=\"command\"\u003eINSERT\u003c/code\u003e to be lost, rather than the\n        entire table contents.  Note that the restore might fail altogether if\n        you have rearranged column order.  The\n        \u003ccode class=\"option\"\u003e--column-inserts\u003c/code\u003e option is safe against column order\n        changes, though even slower.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--load-via-partition-root\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        When dumping data for a table partition, make\n        the \u003ccode class=\"command\"\u003eCOPY\u003c/code\u003e or \u003ccode class=\"command\"\u003eINSERT\u003c/code\u003e statements\n        target the root of the partitioning hierarchy that contains it, rather\n        than the partition itself.  This causes the appropriate partition to\n        be re-determined for each row when the data is loaded.  This may be\n        useful when restoring data on a server where rows do not always fall\n        into the same partitions as they did on the original server.  That\n        could happen, for example, if the partitioning column is of type text\n        and the two systems have different definitions of the collation used\n        to sort the partitioning column.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        Do not wait forever to acquire shared table locks at the beginning of\n        the dump. Instead fail if unable to lock a table within the specified\n        \u003cem class=\"replaceable\"\u003e\u003ccode\u003etimeout\u003c/code\u003e\u003c/em\u003e. The timeout may be\n        specified in any of the formats accepted by \u003ccode class=\"command\"\u003eSET\n        statement_timeout\u003c/code\u003e.  (Allowed formats vary depending on the server\n        version you are dumping from, but an integer number of milliseconds\n        is accepted by all versions.)\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-comments\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Do not dump \u003ccode class=\"command\"\u003eCOMMENT\u003c/code\u003e commands.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-data\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Do not dump data.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-policies\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Do not dump row security policies.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-publications\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Do not dump publications.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-schema\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Do not dump schema (data definitions).\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-security-labels\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Do not dump security labels.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-statistics\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Do not dump statistics. This is the default.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-subscriptions\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Do not dump subscriptions.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-sync\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        By default, \u003ccode class=\"command\"\u003epg_dump\u003c/code\u003e will wait for all files\n        to be written safely to disk.  This option causes\n        \u003ccode class=\"command\"\u003epg_dump\u003c/code\u003e to return without waiting, which is\n        faster, but means that a subsequent operating system crash can leave\n        the dump corrupt.  Generally, this option is useful for testing\n        but should not be used when dumping data from production installation.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-table-access-method\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Do not output commands to select table access methods.\n        With this option, all objects will be created with whichever\n        table access method is the default during restore.\n       \u003c/p\u003e\u003cp\u003e\n        This option is ignored when emitting an archive (non-text) output\n        file.  For the archive formats, you can specify the option when you\n        call \u003ccode class=\"command\"\u003epg_restore\u003c/code\u003e.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-tablespaces\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Do not output commands to select tablespaces.\n        With this option, all objects will be created in whichever\n        tablespace is the default during restore.\n       \u003c/p\u003e\u003cp\u003e\n        This option is ignored when emitting an archive (non-text) output\n        file.  For the archive formats, you can specify the option when you\n        call \u003ccode class=\"command\"\u003epg_restore\u003c/code\u003e.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-toast-compression\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Do not output commands to set TOAST compression\n        methods.\n        With this option, all columns will be restored with the default\n        compression setting.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-unlogged-table-data\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Do not dump the contents of unlogged tables and sequences.  This\n        option has no effect on whether or not the table and sequence\n        definitions (schema) are dumped; it only suppresses dumping the table\n        and sequence data. Data in unlogged tables and sequences\n        is always excluded when dumping from a standby server.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--on-conflict-do-nothing\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Add \u003ccode class=\"literal\"\u003eON CONFLICT DO NOTHING\u003c/code\u003e to\n        \u003ccode class=\"command\"\u003eINSERT\u003c/code\u003e commands.\n        This option is not valid unless \u003ccode class=\"option\"\u003e--inserts\u003c/code\u003e,\n        \u003ccode class=\"option\"\u003e--column-inserts\u003c/code\u003e or\n        \u003ccode class=\"option\"\u003e--rows-per-insert\u003c/code\u003e is also specified.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--quote-all-identifiers\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Force quoting of all identifiers.  This option is recommended when\n        dumping a database from a server whose \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e\n        major version is different from \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e's, or when\n        the output is intended to be loaded into a server of a different\n        major version.  By default, \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e quotes only\n        identifiers that are reserved words in its own major version.\n        This sometimes results in compatibility issues when dealing with\n        servers of other versions that may have slightly different sets\n        of reserved words.  Using \u003ccode class=\"option\"\u003e--quote-all-identifiers\u003c/code\u003e prevents\n        such issues, at the price of a harder-to-read dump script.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        Use the provided string as the \u003cspan class=\"application\"\u003epsql\u003c/span\u003e\n\u003ccode class=\"command\"\u003e\\restrict\u003c/code\u003e key in the dump output.  If no restrict\n        key is specified,\n        \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e will generate a random one as\n        needed.  Keys may contain only alphanumeric characters.\n       \u003c/p\u003e\u003cp\u003e\n        This option is primarily intended for testing purposes and other\n        scenarios that require repeatable output (e.g., comparing dump files).\n        It is not recommended for general use, as a malicious server with\n        advance knowledge of the key may be able to inject arbitrary code that\n        will be executed on the machine that runs\n        \u003cspan class=\"application\"\u003epsql\u003c/span\u003e with the dump output.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        Dump data as \u003ccode class=\"command\"\u003eINSERT\u003c/code\u003e commands (rather than\n        \u003ccode class=\"command\"\u003eCOPY\u003c/code\u003e).  Controls the maximum number of rows per\n        \u003ccode class=\"command\"\u003eINSERT\u003c/code\u003e command. The value specified must be a\n        number greater than zero.  Any error during restoring will cause only\n        rows that are part of the problematic \u003ccode class=\"command\"\u003eINSERT\u003c/code\u003e to be\n        lost, rather than the entire table contents.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n          Only dump the named section. The section name can be\n          \u003ccode class=\"option\"\u003epre-data\u003c/code\u003e, \u003ccode class=\"option\"\u003edata\u003c/code\u003e, or \u003ccode class=\"option\"\u003epost-data\u003c/code\u003e.\n          This option can be specified more than once to select multiple\n          sections. The default is to dump all sections.\n         \u003c/p\u003e\u003cp\u003e\n          The data section contains actual table data, large-object\n          contents, sequence values, and statistics for tables,\n          materialized views, and foreign tables.\n          Post-data items include definitions of indexes, triggers, rules,\n          statistics for indexes, and constraints other than validated check\n          and not-null constraints.\n          Pre-data items include all other data definition items.\n         \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--sequence-data\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Include sequence data in the dump.  This is the default behavior except\n        when \u003ccode class=\"option\"\u003e--no-data\u003c/code\u003e, \u003ccode class=\"option\"\u003e--schema-only\u003c/code\u003e, or\n        \u003ccode class=\"option\"\u003e--statistics-only\u003c/code\u003e is specified.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--serializable-deferrable\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Use a \u003ccode class=\"literal\"\u003eserializable\u003c/code\u003e transaction for the dump, to\n        ensure that the snapshot used is consistent with later database\n        states; but do this by waiting for a point in the transaction stream\n        at which no anomalies can be present, so that there isn't a risk of\n        the dump failing or causing other transactions to roll back with a\n        \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\n        for more information about transaction isolation and concurrency\n        control.\n       \u003c/p\u003e\u003cp\u003e\n        This option is not beneficial for a dump which is intended only for\n        disaster recovery.  It could be useful for a dump used to load a\n        copy of the database for reporting or other read-only load sharing\n        while the original database continues to be updated.  Without it the\n        dump may reflect a state which is not consistent with any serial\n        execution of the transactions eventually committed.  For example, if\n        batch processing techniques are used, a batch may show as closed in\n        the dump without all of the items which are in the batch appearing.\n       \u003c/p\u003e\u003cp\u003e\n        This option will make no difference if there are no read-write\n        transactions active when pg_dump is started.  If read-write\n        transactions are active, the start of the dump may be delayed for an\n        indeterminate length of time.  Once running, performance with or\n        without the switch is the same.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n          Use the specified synchronized snapshot when making a dump of the\n          database (see\n          \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\n          details).\n         \u003c/p\u003e\u003cp\u003e\n          This option is useful when needing to synchronize the dump with\n          a logical replication slot (see \u003ca class=\"xref\" href=\"/docs/18/logicaldecoding.html\" title=\"Chapter 47. Logical Decoding\"\u003eChapter 47\u003c/a\u003e)\n          or with a concurrent session.\n         \u003c/p\u003e\u003cp\u003e\n          In the case of a parallel dump, the snapshot name defined by this\n          option is used rather than taking a new snapshot.\n         \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--statistics\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Dump optimizer statistics.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--statistics-only\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Dump only the statistics, not the schema (data definitions) or data.\n        Optimizer statistics for tables, materialized views, foreign tables,\n        and indexes are dumped.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--strict-names\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Require that each\n        extension (\u003ccode class=\"option\"\u003e-e\u003c/code\u003e/\u003ccode class=\"option\"\u003e--extension\u003c/code\u003e),\n        schema (\u003ccode class=\"option\"\u003e-n\u003c/code\u003e/\u003ccode class=\"option\"\u003e--schema\u003c/code\u003e) and\n        table (\u003ccode class=\"option\"\u003e-t\u003c/code\u003e/\u003ccode class=\"option\"\u003e--table\u003c/code\u003e) pattern\n        match at least one extension/schema/table in the database to be dumped.\n        This also applies to filters used with \u003ccode class=\"option\"\u003e--filter\u003c/code\u003e.\n        Note that if none of the extension/schema/table patterns find\n        matches, \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e will generate an error\n        even without \u003ccode class=\"option\"\u003e--strict-names\u003c/code\u003e.\n       \u003c/p\u003e\u003cp\u003e\n        This option has no effect\n        on \u003ccode class=\"option\"\u003e--exclude-extension\u003c/code\u003e,\n        \u003ccode class=\"option\"\u003e-N\u003c/code\u003e/\u003ccode class=\"option\"\u003e--exclude-schema\u003c/code\u003e,\n        \u003ccode class=\"option\"\u003e-T\u003c/code\u003e/\u003ccode class=\"option\"\u003e--exclude-table\u003c/code\u003e,\n        or \u003ccode class=\"option\"\u003e--exclude-table-data\u003c/code\u003e.  An exclude pattern failing\n        to match any objects is not considered an error.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        When set to \u003ccode class=\"literal\"\u003efsync\u003c/code\u003e, which is the default,\n        \u003ccode class=\"command\"\u003epg_dump --format=directory\u003c/code\u003e will recursively open and\n        synchronize all files in the archive directory.\n       \u003c/p\u003e\u003cp\u003e\n        On Linux, \u003ccode class=\"literal\"\u003esyncfs\u003c/code\u003e may be used instead to ask the\n        operating system to synchronize the whole file system that contains the\n        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\n        for information about the caveats to be aware of when using\n        \u003ccode class=\"literal\"\u003esyncfs\u003c/code\u003e.\n       \u003c/p\u003e\u003cp\u003e\n        This option has no effect when \u003ccode class=\"option\"\u003e--no-sync\u003c/code\u003e is used or\n        \u003ccode class=\"option\"\u003e--format\u003c/code\u003e is not set to \u003ccode class=\"literal\"\u003edirectory\u003c/code\u003e.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        This is the same as\n        the \u003ccode class=\"option\"\u003e-t\u003c/code\u003e/\u003ccode class=\"option\"\u003e--table\u003c/code\u003e option,\n        except that it also includes any partitions or inheritance child\n        tables of the table(s) matching the\n        \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--use-set-session-authorization\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Output SQL-standard \u003ccode class=\"command\"\u003eSET SESSION AUTHORIZATION\u003c/code\u003e commands\n        instead of \u003ccode class=\"command\"\u003eALTER OWNER\u003c/code\u003e commands to determine object\n        ownership.  This makes the dump more standards-compatible, but\n        depending on the history of the objects in the dump, might not restore\n        properly.  Also, a dump using \u003ccode class=\"command\"\u003eSET SESSION AUTHORIZATION\u003c/code\u003e\n        will certainly require superuser privileges to restore correctly,\n        whereas \u003ccode class=\"command\"\u003eALTER OWNER\u003c/code\u003e requires lesser privileges.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n       Show help about \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e command line\n       arguments, and exit.\n       \u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n    The following command-line options control the database connection parameters.\n\n    \u003c/p\u003e\u003cdiv class=\"variablelist\"\u003e\u003cdl class=\"variablelist\"\u003e\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\u003cdd\u003e\u003cp\u003e\n       Specifies the name of the database to connect to. This is\n       equivalent to specifying \u003cem class=\"replaceable\"\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e as the first non-option\n       argument on the command line.  The \u003cem class=\"replaceable\"\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e\n       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.\n       If so, connection string parameters will override any conflicting\n       command line options.\n      \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        Specifies the host name of the machine on which the server is\n        running.  If the value begins with a slash, it is used as the\n        directory for the Unix domain socket. The default is taken\n        from the \u003ccode class=\"envar\"\u003ePGHOST\u003c/code\u003e environment variable, if set,\n        else a Unix domain socket connection is attempted.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        Specifies the TCP port or local Unix domain socket file\n        extension on which the server is listening for connections.\n        Defaults to the \u003ccode class=\"envar\"\u003ePGPORT\u003c/code\u003e environment variable, if\n        set, or a compiled-in default.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        User name to connect as.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        Never issue a password prompt.  If the server requires\n        password authentication and a password is not available by\n        other means such as a \u003ccode class=\"filename\"\u003e.pgpass\u003c/code\u003e file, the\n        connection attempt will fail.  This option can be useful in\n        batch jobs and scripts where no user is present to enter a\n        password.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        Force \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e to prompt for a\n        password before connecting to a database.\n       \u003c/p\u003e\u003cp\u003e\n        This option is never essential, since\n        \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e will automatically prompt\n        for a password if the server demands password authentication.\n        However, \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e will waste a\n        connection attempt finding out that the server wants a password.\n        In some cases it is worth typing \u003ccode class=\"option\"\u003e-W\u003c/code\u003e to avoid the extra\n        connection attempt.\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        Specifies a role name to be used to create the dump.\n        This option causes \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e to issue a\n        \u003ccode class=\"command\"\u003eSET ROLE\u003c/code\u003e \u003cem class=\"replaceable\"\u003e\u003ccode\u003erolename\u003c/code\u003e\u003c/em\u003e\n        command after connecting to the database. It is useful when the\n        authenticated user (specified by \u003ccode class=\"option\"\u003e-U\u003c/code\u003e) lacks privileges\n        needed by \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e, but can switch to a role with\n        the required rights.  Some installations have a policy against\n        logging in directly as a superuser, and use of this option allows\n        dumps to be made without violating the policy.\n       \u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e\u003cp\u003e\n\u003c/p\u003e\u003c/div\u003e\u003cdiv class=\"refsect1\" id=\"id-1.9.4.14.7\"\u003e\u003ch2\u003eEnvironment\u003c/h2\u003e\u003cdiv class=\"variablelist\"\u003e\u003cdl class=\"variablelist\"\u003e\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\u003cdd\u003e\u003cp\u003e\n      Default connection parameters.\n     \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003ePG_COLOR\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      Specifies whether to use color in diagnostic messages. Possible values\n      are \u003ccode class=\"literal\"\u003ealways\u003c/code\u003e, \u003ccode class=\"literal\"\u003eauto\u003c/code\u003e and\n      \u003ccode class=\"literal\"\u003enever\u003c/code\u003e.\n     \u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e\u003cp\u003e\n   This utility, like most other \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e utilities,\n   also uses the environment variables supported by \u003cspan class=\"application\"\u003elibpq\u003c/span\u003e\n   (see \u003ca class=\"xref\" href=\"/docs/18/libpq-envars.html\" title=\"32.15. Environment Variables\"\u003eSection 32.15\u003c/a\u003e).\n  \u003c/p\u003e\u003c/div\u003e\u003cdiv class=\"refsect1\" id=\"APP-PGDUMP-DIAGNOSTICS\"\u003e\u003ch2\u003eDiagnostics\u003c/h2\u003e\u003cp\u003e\n\u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e internally executes\n   \u003ccode class=\"command\"\u003eSELECT\u003c/code\u003e statements. If you have problems running\n   \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e, make sure you are able to\n   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\n   variables used by the \u003cspan class=\"application\"\u003elibpq\u003c/span\u003e front-end\n   library will apply.\n  \u003c/p\u003e\u003cp\u003e\n   The database activity of \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e is\n   normally collected by the cumulative statistics system.  If this is\n   undesirable, you can set parameter \u003ccode class=\"varname\"\u003etrack_counts\u003c/code\u003e\n   to false via \u003ccode class=\"envar\"\u003ePGOPTIONS\u003c/code\u003e or the \u003ccode class=\"literal\"\u003eALTER\n   USER\u003c/code\u003e command.\n  \u003c/p\u003e\u003c/div\u003e\u003cdiv class=\"refsect1\" id=\"PG-DUMP-NOTES\"\u003e\u003ch2\u003eNotes\u003c/h2\u003e\u003cp\u003e\n   If your database cluster has any local additions to the \u003ccode class=\"literal\"\u003etemplate1\u003c/code\u003e database,\n   be careful to restore the output of \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e into a\n   truly empty database; otherwise you are likely to get errors due to\n   duplicate definitions of the added objects.  To make an empty database\n   without any local additions, copy from \u003ccode class=\"literal\"\u003etemplate0\u003c/code\u003e not \u003ccode class=\"literal\"\u003etemplate1\u003c/code\u003e,\n   for example:\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003eCREATE DATABASE foo WITH TEMPLATE template0;\n\u003c/pre\u003e\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n   When a dump without schema is chosen and the option \u003ccode class=\"option\"\u003e--disable-triggers\u003c/code\u003e\n   is used, \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e emits commands\n   to disable triggers on user tables before inserting the data,\n   and then commands to re-enable them after the data has been\n   inserted.  If the restore is stopped in the middle, the system\n   catalogs might be left in the wrong state.\n  \u003c/p\u003e\u003cp\u003e\n   When \u003ccode class=\"option\"\u003e--statistics\u003c/code\u003e is specified,\n   \u003ccode class=\"command\"\u003epg_dump\u003c/code\u003e will include most optimizer statistics in the\n   resulting dump file.  This does not include all statistics, such as\n   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,\n   custom statistics added by an extension, or statistics collected by the\n   cumulative statistics system. Therefore, it may still be useful to\n   run \u003ccode class=\"command\"\u003eANALYZE\u003c/code\u003e after restoring from a dump file to ensure\n   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.\n  \u003c/p\u003e\u003cp\u003e\n   Because \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e is used to transfer data\n   to newer versions of \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e, the output of\n   \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e can be expected to load into\n   \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e server versions newer than\n   \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e's version.  \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e can also\n   dump from \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e servers older than its own version.\n   (Currently, servers back to version 9.2 are supported.)\n   However, \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e cannot dump from\n   \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e servers newer than its own major version;\n   it will refuse to even try, rather than risk making an invalid dump.\n   Also, it is not guaranteed that \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e's output can\n   be loaded into a server of an older major version — not even if the\n   dump was taken from a server of that version.  Loading a dump file\n   into an older server may require manual editing of the dump file\n   to remove syntax not understood by the older server.\n   Use of the \u003ccode class=\"option\"\u003e--quote-all-identifiers\u003c/code\u003e option is recommended\n   in cross-version cases, as it can prevent problems arising from varying\n   reserved-word lists in different \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e versions.\n  \u003c/p\u003e\u003cp\u003e\n   When dumping logical replication subscriptions,\n   \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e will generate \u003ccode class=\"command\"\u003eCREATE\n   SUBSCRIPTION\u003c/code\u003e commands that use the \u003ccode class=\"literal\"\u003econnect = false\u003c/code\u003e\n   option, so that restoring the subscription does not make remote connections\n   for creating a replication slot or for initial table copy.  That way, the\n   dump can be restored without requiring network access to the remote\n   servers.  It is then up to the user to reactivate the subscriptions in a\n   suitable way.  If the involved hosts have changed, the connection\n   information might have to be changed.  It might also be appropriate to\n   truncate the target tables before initiating a new full table copy.  If users\n   intend to copy initial data during refresh they must create the slot with\n   \u003ccode class=\"literal\"\u003etwo_phase = false\u003c/code\u003e.  After the initial sync, the\n   \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\n   option will be automatically enabled by the subscriber if the subscription\n   had been originally created with \u003ccode class=\"literal\"\u003etwo_phase = true\u003c/code\u003e option.\n  \u003c/p\u003e\u003cp\u003e\n   It is generally recommended to use the \u003ccode class=\"option\"\u003e-X\u003c/code\u003e\n   (\u003ccode class=\"option\"\u003e--no-psqlrc\u003c/code\u003e) option when restoring a database from a\n   plain-text \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e script to ensure a clean\n   restore process and prevent potential conflicts with\n   non-default \u003cspan class=\"application\"\u003epsql\u003c/span\u003e configurations.\n  \u003c/p\u003e\u003c/div\u003e\u003cdiv class=\"refsect1\" id=\"PG-DUMP-EXAMPLES\"\u003e\u003ch2\u003eExamples\u003c/h2\u003e\u003cp\u003e\n   To dump a database called \u003ccode class=\"literal\"\u003emydb\u003c/code\u003e into an SQL-script file:\n\u003c/p\u003e\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\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n   To reload such a script into a (freshly created) database named\n   \u003ccode class=\"literal\"\u003enewdb\u003c/code\u003e:\n\n\u003c/p\u003e\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\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n   To dump a database into a custom-format archive file:\n\n\u003c/p\u003e\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\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n   To dump a database into a directory-format archive:\n\n\u003c/p\u003e\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\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n   To dump a database into a directory-format archive in parallel with\n   5 worker jobs:\n\n\u003c/p\u003e\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\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n   To reload an archive file into a (freshly created) database named\n   \u003ccode class=\"literal\"\u003enewdb\u003c/code\u003e:\n\n\u003c/p\u003e\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\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n   To reload an archive file into the same database it was dumped from,\n   discarding the current contents of that database:\n\n\u003c/p\u003e\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\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n   To dump a single table named \u003ccode class=\"literal\"\u003emytab\u003c/code\u003e:\n\n\u003c/p\u003e\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\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n   To dump all tables whose names start with \u003ccode class=\"literal\"\u003eemp\u003c/code\u003e in the\n   \u003ccode class=\"literal\"\u003edetroit\u003c/code\u003e schema, except for the table named\n   \u003ccode class=\"literal\"\u003eemployee_log\u003c/code\u003e:\n\n\u003c/p\u003e\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\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n   To dump all schemas whose names start with \u003ccode class=\"literal\"\u003eeast\u003c/code\u003e or\n   \u003ccode class=\"literal\"\u003ewest\u003c/code\u003e and end in \u003ccode class=\"literal\"\u003egsm\u003c/code\u003e, excluding any schemas whose\n   names contain the word \u003ccode class=\"literal\"\u003etest\u003c/code\u003e:\n\n\u003c/p\u003e\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\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n   The same, using regular expression notation to consolidate the switches:\n\n\u003c/p\u003e\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\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n   To dump all database objects except for tables whose names begin with\n   \u003ccode class=\"literal\"\u003ets_\u003c/code\u003e:\n\n\u003c/p\u003e\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\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n   To specify an upper-case or mixed-case name in \u003ccode class=\"option\"\u003e-t\u003c/code\u003e and related\n   switches, you need to double-quote the name; else it will be folded to\n   lower case (see \u003ca class=\"xref\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003ePatterns\u003c/a\u003e).  But\n   double quotes are special to the shell, so in turn they must be quoted.\n   Thus, to dump a single table with a mixed-case name, you need something\n   like\n\n\u003c/p\u003e\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\u003cp\u003e\n   To dump all tables whose names start with \u003ccode class=\"literal\"\u003emytable\u003c/code\u003e, except\n   for table \u003ccode class=\"literal\"\u003emytable2\u003c/code\u003e, specify a filter file\n   \u003ccode class=\"filename\"\u003efilter.txt\u003c/code\u003e like:\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003einclude table mytable*\nexclude table mytable2\n\u003c/pre\u003e\u003cp\u003e\n\u003c/p\u003e\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\u003c/div\u003e\u003cdiv class=\"refsect1\" id=\"id-1.9.4.14.11\"\u003e\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\u003c/div\u003e\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. 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":"en","Fallback":false,"Versions":["10","11","12","13","14","15","16","17","18","19","20"],"Locales":["en","zh-Hans"],"Signatures":null,"Spellings":null,"SQLState":null,"Evidence":null}
