{"Entry":{"collection":"tool","key":"pg-dumpall","name":"pg_dumpall","aliases":["pg_dumpall"],"metadata":{"aliases":["pg_dumpall"],"category":"Client applications","content_hash":"82862a4657b3670d03315ff837489306acf50ddeec653ca599efef442a6126fb","derived_content_hash":"edab92929afb8483905cf25fd34dd394c0d13615a4ec25cf870df7f4466916ad","imported_at":"2026-09-30T00:40:34.259687+08:00","name":"pg_dumpall","name_zh":"","slug":"pg-dumpall","summary":"pg_dumpall — extract a PostgreSQL database cluster into a script file"}},"Definition":{"Collection":"tool","Key":"pg-dumpall","SourceDatabase":"center","Version":"18","SourceTable":"command_tool","SourceKey":"pg-dumpall","SourceRevision":"ee8d1a3612338fd9adf250730cb640fcc5233b5491337cc00a316a44e3a0b9f8","Facts":{"comparison_data":{"environment":[{"description":"Default connection parameters","name":"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.","names":["-a","--data-only"],"signature":"-a --data-only"},{"description":"Emit SQL commands to DROP all the dumped databases, roles, and tablespaces before recreating them. This option is useful when the restore is to overwrite an existing cluster. If any of the objects do not exist in the destination cluster, ignorable error messages will be reported during restore, unless --if-exists is also specified.","names":["-c","--clean"],"signature":"-c --clean"},{"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.)","names":["-E encoding","--encoding= encoding"],"signature":"-E encoding --encoding= encoding"},{"description":"Send output to the specified file. If this is omitted, the standard output is used.","names":["-f filename","--file= filename"],"signature":"-f filename --file= filename"},{"description":"Dump only global objects (roles and tablespaces), no databases.","names":["-g","--globals-only"],"signature":"-g --globals-only"},{"description":"Do not output commands to set ownership of objects to match the original database. By default, pg_dumpall issues ALTER OWNER or SET SESSION AUTHORIZATION statements to set ownership of created schema elements. 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 .","names":["-O","--no-owner"],"signature":"-O --no-owner"},{"description":"Dump only roles, no databases or tablespaces.","names":["-r","--roles-only"],"signature":"-r --roles-only"},{"description":"Dump only the object definitions (schema), not 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 tablespaces, no databases or roles.","names":["-t","--tablespaces-only"],"signature":"-t --tablespaces-only"},{"description":"Specifies verbose mode. This will cause pg_dumpall to output 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. The option is also passed down to pg_dump .","names":["-v","--verbose"],"signature":"-v --verbose"},{"description":"Print the pg_dumpall 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":"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.","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 with data and without schema. It instructs pg_dumpall 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.","names":["--disable-triggers"],"signature":"--disable-triggers"},{"description":"Do not dump databases whose name matches pattern . Multiple patterns can be excluded by writing multiple --exclude-database switches. The pattern parameter is interpreted as a pattern according to the same rules used by psql 's \\d commands (see Patterns ), so multiple databases can also be excluded by writing wildcard characters in the pattern. When using wildcards, be careful to quote the pattern if needed to prevent shell wildcard expansion.","names":["--exclude-database= pattern"],"signature":"--exclude-database= 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 databases excluded from the dump. The patterns are interpreted according to the same rules as --exclude-database . To read from STDIN , use - as the filename. The --filter option can be specified in conjunction with --exclude-database for excluding databases, and can also be specified more than once for multiple filter files. The file lists one database pattern per row, with the following format: exclude database PATTERN 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.","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 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. Note that the restore might fail altogether if you have rearranged column order. The --column-inserts option is safer, 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 .","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 passwords for roles. When restored, roles will have a null password, and password authentication will always fail until the password is set. Since password values aren't needed when this option is specified, the role information is read from the catalog view pg_roles instead of pg_authid . Therefore, this option also helps if access to pg_authid is restricted by some security policy.","names":["--no-role-passwords"],"signature":"--no-role-passwords"},{"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_dumpall will wait for all files to be written safely to disk. This option causes pg_dumpall 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.","names":["--no-table-access-method"],"signature":"--no-table-access-method"},{"description":"Do not output commands to create tablespaces nor select tablespaces for objects. With this option, all objects will be created in whichever tablespace is the default during 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. This option has no effect on whether or not the table definitions (schema) are dumped; it only suppresses dumping the table data.","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 or --column-inserts 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_dumpall 's, or when the output is intended to be loaded into a server of a different major version. By default, pg_dumpall 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_dumpall 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":"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":"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":"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.","names":["--use-set-session-authorization"],"signature":"--use-set-session-authorization"},{"description":"Show help about pg_dumpall command line arguments, and exit.","names":["-?","--help"],"signature":"-? --help"},{"description":"Specifies parameters used to connect to the server, as a connection string ; these will override any conflicting command line options. The option is called --dbname for consistency with other client applications, but because pg_dumpall needs to connect to many databases, the database name in the connection string will be ignored. Use the -l option to specify the name of the database used for the initial connection, which will dump global objects and discover what other databases should be dumped.","names":["-d connstr","--dbname= connstr"],"signature":"-d connstr --dbname= connstr"},{"description":"Specifies the host name of the machine on which the database 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 name of the database to connect to for dumping global objects and discovering what other databases should be dumped. If not specified, the postgres database will be used, and if that does not exist, template1 will be used.","names":["-l dbname","--database= dbname"],"signature":"-l dbname --database= dbname"},{"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_dumpall to prompt for a password before connecting to a database. This option is never essential, since pg_dumpall will automatically prompt for a password if the server demands password authentication. However, pg_dumpall 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. Note that the password prompt will occur again for each database to be dumped. Usually, it's better to set up a ~/.pgpass file than to rely on manual password entry.","names":["-W","--password"],"signature":"-W --password"},{"description":"Specifies a role name to be used to create the dump. This option causes pg_dumpall 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_dumpall , 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_dumpall [ connection-option ...] [ option ...]"]},"comparison_hash":"dd0edf9a9ef6de0e86b97b0a2b08127ecf99f382528014ef50f210767b2d4f6c","description":["pg_dumpall — extract a PostgreSQL database cluster into a script file"],"description_zh":"描述 pg_dumpall 是一个实用程序，用于写出（ “ 转储 ” ）一个集簇中的所有 PostgreSQL 数据库到一个脚本文件中。该脚本文件包含 SQL 命令，可作为 psql 的输入来恢复这些数据库。它通过对集簇中的每个数据库调用 pg_dump 来实现这一点。 pg_dumpall 还会转储所有数据库共有的全局对象，即数据库角色、表空间以及配置参数的权限授予。（ pg_dump 不会保存这些对象。） 由于 pg_dumpall 会读取所有数据库中的表，因此通常必须以数据库超级用户身份连接，才能生成完整的转储。另外，要执行保存的脚本，也需要具备超级用户权限，这样才能添加角色并创建数据库。 SQL 脚本将写入标准输出。使用 -f / --file 选项或 shell 操作符将其重定向到文件。 pg_dumpall 需要多次连接到 PostgreSQL 服务器（每个数据库一次）。如果使用密码认证，它每次都会提示输入密码。在这种情况下准备一个 ~/.pgpass 文件会比较方便。详见 第 32.16 节 。 警告 恢复转储会导致目标系统执行由源超级用户所选择的任意代码。部分转储和部分恢复也无法限制这一点。如果不信任源超级用户，则在恢复前必须检查转储出的 SQL 语句。注意，执行转储和恢复的客户端并不需要信任源超级用户或目标超级用户。 选项 以下命令行选项控制输出的内容和格式。 -a --data-only 只转储数据，不转储模式（数据定义）或统计信息。 -c --clean 在重新创建之前，输出用于 DROP 所有已转储数据库、角色和表空间的 SQL 命令。当恢复需要覆盖现有集簇时，此选项很有用。如果目标集簇中不存在某些对象，则恢复期间会报告可忽略的错误消息，除非还指定了 --if-exists 。 -E encoding --encoding= encoding 在指定的字符集编码中创建转储。默认情况下，转储将以数据库编码创建。（获得相同结果的另一种方法是将 PGCLIENTENCODING 环境变量设置为所需的转储编码。） -f filename --file= ","description_zh_html":"\u003cp\u003e命令行工具 pg_dumpall [ connection-option ...] [ option ...]。\u003c/p\u003e\u003ch3\u003e同版本中文手册节选\u003c/h3\u003e\u003cdiv class=\"refsect1\"\u003e\u003ch2\u003e描述\u003c/h2\u003e\u003cp\u003e\n\u003cspan class=\"application\"\u003epg_dumpall\u003c/span\u003e 是一个实用程序，用于写出（\u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003e转储\u003c/span\u003e”\u003c/span\u003e）一个集簇中的所有 \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e 数据库到一个脚本文件中。该脚本文件包含 \u003cacronym class=\"acronym\"\u003eSQL\u003c/acronym\u003e 命令，可作为 \u003ca class=\"xref\" href=\"/zh/docs/18/app-psql.html\"\u003e\u003cspan class=\"refentrytitle\"\u003e\u003cspan class=\"application\"\u003epsql\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e 的输入来恢复这些数据库。它通过对集簇中的每个数据库调用 \u003ca class=\"xref\" href=\"/zh/docs/18/app-pgdump.html\"\u003e\u003cspan class=\"refentrytitle\"\u003e\u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e 来实现这一点。\u003cspan class=\"application\"\u003epg_dumpall\u003c/span\u003e 还会转储所有数据库共有的全局对象，即数据库角色、表空间以及配置参数的权限授予。（\u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e 不会保存这些对象。）\n  \u003c/p\u003e\u003cp\u003e\n   由于 \u003cspan class=\"application\"\u003epg_dumpall\u003c/span\u003e 会读取所有数据库中的表，因此通常必须以数据库超级用户身份连接，才能生成完整的转储。另外，要执行保存的脚本，也需要具备超级用户权限，这样才能添加角色并创建数据库。\n  \u003c/p\u003e\u003cp\u003e\n   SQL 脚本将写入标准输出。使用 \u003ccode class=\"option\"\u003e-f\u003c/code\u003e/\u003ccode class=\"option\"\u003e--file\u003c/code\u003e 选项或 shell 操作符将其重定向到文件。\n  \u003c/p\u003e\u003cp\u003e\n\u003cspan class=\"application\"\u003epg_dumpall\u003c/span\u003e 需要多次连接到 \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e 服务器（每个数据库一次）。如果使用密码认证，它每次都会提示输入密码。在这种情况下准备一个 \u003ccode class=\"filename\"\u003e~/.pgpass\u003c/code\u003e 文件会比较方便。详见\u003ca class=\"xref\" href=\"/zh/docs/18/libpq-pgpass.html\"\u003e第 32.16 节\u003c/a\u003e。\n  \u003c/p\u003e\u003cdiv class=\"warning\"\u003e\u003ch3 class=\"title\"\u003e警告\u003c/h3\u003e\u003cp\u003e\n    恢复转储会导致目标系统执行由源超级用户所选择的任意代码。部分转储和部分恢复也无法限制这一点。如果不信任源超级用户，则在恢复前必须检查转储出的 SQL 语句。注意，执行转储和恢复的客户端并不需要信任源超级用户或目标超级用户。\n   \u003c/p\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv class=\"refsect1\"\u003e\u003ch2\u003e选项\u003c/h2\u003e\u003cp\u003e\n    以下命令行选项控制输出的内容和格式。\n\n    \u003c/p\u003e\u003cdiv class=\"variablelist\"\u003e\u003cdl class=\"variablelist\"\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        只转储数据，不转储模式（数据定义）或统计信息。\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        在重新创建之前，输出用于 \u003ccode class=\"command\"\u003eDROP\u003c/code\u003e 所有已转储数据库、角色和表空间的 SQL 命令。当恢复需要覆盖现有集簇时，此选项很有用。如果目标集簇中不存在某些对象，则恢复期间会报告可忽略的错误消息，除非还指定了 \u003ccode class=\"option\"\u003e--if-exists\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\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 环境变量设置为所需的转储编码。）\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-f \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\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\u003efilename\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\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-g\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--globals-only\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        只转储全局对象（角色和表空间），不转储数据库。\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        不要输出用于将对象所有权设置为与原始数据库一致的命令。默认情况下，\u003cspan class=\"application\"\u003epg_dumpall\u003c/span\u003e 会发出 \u003ccode class=\"command\"\u003eALTER OWNER\u003c/code\u003e 或 \u003ccode class=\"command\"\u003eSET SESSION AUTHORIZATION\u003c/code\u003e 语句，以设置已创建模式元素的所有权。除非该脚本由超级用户（或拥有脚本中全部对象的同一用户）启动，否则这些语句在运行时会失败。若要创建一个可由任意用户恢复、并让该用户获得所有对象所有权的脚本，请指定 \u003ccode class=\"option\"\u003e-O\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--roles-only\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        只转储角色，不转储数据库或表空间。\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        只转储对象定义（模式），不转储数据。\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        指定在禁用触发器时要使用的超级用户名。这只在使用\n        \u003ccode class=\"option\"\u003e--disable-triggers\u003c/code\u003e 时相关。（通常最好省略它，而是以超级用户身份运行生成的脚本。）\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-t\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--tablespaces-only\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        只转储表空间，不转储数据库或角色。\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        指定详细模式。这会让 \u003cspan class=\"application\"\u003epg_dumpall\u003c/span\u003e 把开始/停止时间写入转储文件，并将进度消息输出到标准错误。重复指定该选项会使更多调试级别的消息出现在标准错误中。该选项也会传递给 \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e。\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       打印 \u003cspan class=\"application\"\u003epg_dumpall\u003c/span\u003e 的版本并退出。\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        不转储访问权限（GRANT/REVOKE 命令）。\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        此选项供就地升级实用程序使用。不建议也不支持将其用于其他目的。该选项的行为可能在未来的版本中更改而不另行通知。\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        将数据转储为带有显式列名的 \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 数据库的转储。\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        此选项禁用对函数体的美元引用，并强制用 SQL 标准字符串语法对它们加引号。\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        此选项只在创建包含数据但不包含模式的转储时才相关。它指示 \u003cspan class=\"application\"\u003epg_dumpall\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\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--exclude-database=\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--exclude-database\u003c/code\u003e 开关，以排除匹配所给模式中任意一个的数据库。\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e 参数按照 \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\"\u003e模式\u003c/a\u003e），因此也可以通过在模式中使用通配符来排除多个数据库。使用通配符时，如有需要请务必为模式加引号，以防止 shell 展开通配符。\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        在转储浮点数据时，使用指定的 extra_float_digits 值，而不是最大可用精度。出于备份目的的常规转储不应使用此选项。\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        指定一个文件名，从中读取要从转储中排除的数据库名称的匹配模式。这些模式按照与 \u003ccode class=\"option\"\u003e--exclude-database\u003c/code\u003e 相同的规则解释。要从 \u003ccode class=\"literal\"\u003eSTDIN\u003c/code\u003e 读取，请使用\u003ccode class=\"filename\"\u003e-\u003c/code\u003e作为文件名。\u003ccode class=\"option\"\u003e--filter\u003c/code\u003e 可与 \u003ccode class=\"option\"\u003e--exclude-database\u003c/code\u003e 结合使用以排除数据库，也可以指定多次以读取多个过滤文件。\n       \u003c/p\u003e\u003cp\u003e\n        该文件每行列出一个数据库名匹配模式，格式如下：\n\u003c/p\u003e\u003cpre class=\"synopsis\"\u003eexclude database \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        以 \u003ccode class=\"literal\"\u003e#\u003c/code\u003e 开头的行被视为注释并忽略。注释也可以放在对象匹配模式行之后。空白行同样会被忽略。有关如何在匹配模式中加引号，请参见\u003ca class=\"xref\" href=\"/zh/docs/18/app-psql.html#APP-PSQL-PATTERNS\"\u003e模式\u003c/a\u003e。\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        使用 \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\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 命令（而不是 \u003ccode class=\"command\"\u003eCOPY\u003c/code\u003e）。这会使恢复非常缓慢；它主要用于生成可以装入非 \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e 数据库的转储。注意，如果重新安排了列顺序，恢复可能会彻底失败。\u003ccode class=\"option\"\u003e--column-inserts\u003c/code\u003e 选项可以避免列顺序变化带来的问题，但速度更慢。\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        当为表分区转储数据时，让 \u003ccode class=\"command\"\u003eCOPY\u003c/code\u003e 或 \u003ccode class=\"command\"\u003eINSERT\u003c/code\u003e 语句以包含该分区的分区层次结构根为目标，而不是以该分区本身为目标。这会导致在加载数据时为每一行重新确定适当的分区。当在另一台服务器上恢复数据，而行并不总是落在与原始服务器相同的分区中时，这可能很有用。例如，如果分区列是 text 类型，而两个系统对用于排序该分区列的排序规则定义不同，就可能发生这种情况。\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        在转储开始时，不要无限等待获取共享表锁。如果无法在指定的 \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\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\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\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\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\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-role-passwords\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        不要转储角色密码。恢复后，角色的密码值将为 null，在设置密码之前，密码认证始终会失败。由于指定此选项时不需要密码值，角色信息将从目录视图 \u003ccode class=\"structname\"\u003epg_roles\u003c/code\u003e 而不是 \u003ccode class=\"structname\"\u003epg_authid\u003c/code\u003e 读取。因此，如果某些安全策略限制了对 \u003ccode class=\"structname\"\u003epg_authid\u003c/code\u003e 的访问，此选项也会有帮助。\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        不要转储模式（数据定义）。\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        不要转储安全标签。\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        不要转储统计信息。这是默认行为。\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        不要转储订阅。\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        默认情况下，\u003ccode class=\"command\"\u003epg_dumpall\u003c/code\u003e 会等待所有文件都被安全写入磁盘。该选项会使 \u003ccode class=\"command\"\u003epg_dumpall\u003c/code\u003e 立即返回而不等待，这样更快，但意味着随后如果操作系统崩溃，转储可能会损坏。通常，此选项适用于测试，但不应在从生产安装转储数据时使用。\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        不输出用于选择表访问方法的命令。使用此选项时，所有对象在恢复时都会使用当时默认的表访问方法创建。\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        不输出创建表空间的命令，也不输出用于为对象选择表空间的命令。使用此选项时，所有对象在恢复时都会创建在当时默认的表空间中。\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        不输出用于设置 \u003cacronym class=\"acronym\"\u003eTOAST\u003c/acronym\u003e 压缩方法的命令。使用此选项时，所有列都会以默认压缩设置恢复。\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        不要转储不记录 WAL 的表的内容。此选项不影响是否转储表定义（模式）；它只会抑制转储表数据。\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        在 \u003ccode class=\"command\"\u003eINSERT\u003c/code\u003e 命令中添加 \u003ccode class=\"literal\"\u003eON CONFLICT DO NOTHING\u003c/code\u003e。除非同时指定了 \u003ccode class=\"option\"\u003e--inserts\u003c/code\u003e 或 \u003ccode class=\"option\"\u003e--column-inserts\u003c/code\u003e，否则此选项无效。\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        强制为所有标识符加引号。当从其 \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e 主版本与 \u003cspan class=\"application\"\u003epg_dumpall\u003c/span\u003e 不同的服务器转储数据库时，或者当输出打算装入另一主版本服务器中时，建议使用此选项。默认情况下，\u003cspan class=\"application\"\u003epg_dumpall\u003c/span\u003e 只会给在其自身主版本中属于保留字的标识符加引号。处理其他版本服务器时，这有时会带来兼容性问题，因为它们的保留字集合可能略有不同。使用 \u003ccode class=\"option\"\u003e--quote-all-identifiers\u003c/code\u003e 可以避免这类问题，但代价是转储脚本更难阅读。\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        在转储输出中，把给定字符串用作 \u003cspan class=\"application\"\u003epsql\u003c/span\u003e 的\u003ccode class=\"command\"\u003e\\restrict\u003c/code\u003e 键。若未指定限制键，\u003cspan class=\"application\"\u003epg_dumpall\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\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 命令（而不是 \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\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\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\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\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       \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       显示关于 \u003cspan class=\"application\"\u003epg_dumpall\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\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-d \u003cem class=\"replaceable\"\u003e\u003ccode\u003econnstr\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\u003econnstr\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        以\u003ca class=\"link\" href=\"/zh/docs/18/libpq-connect.html#LIBPQ-CONNSTRING\"\u003e连接字符串\u003c/a\u003e形式指定用于连接服务器的参数；这些参数将覆盖任何冲突的命令行选项。\n       \u003c/p\u003e\u003cp\u003e\n        该选项名为 \u003ccode class=\"literal\"\u003e--dbname\u003c/code\u003e，是为了与其他客户端应用程序保持一致；但由于 \u003cspan class=\"application\"\u003epg_dumpall\u003c/span\u003e 需要连接多个数据库，连接字符串中的数据库名将被忽略。请使用 \u003ccode class=\"literal\"\u003e-l\u003c/code\u003e 选项指定初始连接所用的数据库名，该连接将用于转储全局对象并发现还应转储哪些数据库。\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        指定运行数据库服务器的机器的主机名。如果该值以斜杠开头，则将其用作 Unix 域套接字的目录。默认值取自 \u003ccode class=\"envar\"\u003ePGHOST\u003c/code\u003e 环境变量（如果已设置）；否则会尝试使用 Unix 域套接字连接。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-l \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--database=\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         指定用于转储全局对象并发现还应转储哪些数据库的连接数据库名。如果未指定，则使用 \u003ccode class=\"literal\"\u003epostgres\u003c/code\u003e 数据库；如果该数据库不存在，则使用 \u003ccode class=\"literal\"\u003etemplate1\u003c/code\u003e。\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        指定服务器正在监听连接的 TCP 端口，或本地 Unix 域套接字文件扩展名。默认值取自 \u003ccode class=\"envar\"\u003ePGPORT\u003c/code\u003e 环境变量（如果已设置），否则使用编译时默认值。\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        用于连接的用户名。\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        绝不发出密码提示。如果服务器要求密码认证，而又无法通过\n        \u003ccode class=\"filename\"\u003e.pgpass\u003c/code\u003e 文件等其他方式获得密码，则连接尝试将失败。在没有用户在场输入密码的批处理作业和脚本中，此选项很有用。\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        强制 \u003cspan class=\"application\"\u003epg_dumpall\u003c/span\u003e 在连接数据库之前提示输入密码。\n       \u003c/p\u003e\u003cp\u003e\n        此选项从来都不是必需的，因为如果服务器要求密码认证，\u003cspan class=\"application\"\u003epg_dumpall\u003c/span\u003e 会自动提示输入密码。不过，\u003cspan class=\"application\"\u003epg_dumpall\u003c/span\u003e 会浪费一次连接尝试来发现服务器需要密码。在某些情况下，键入 \u003ccode class=\"option\"\u003e-W\u003c/code\u003e 以避免这次额外的连接尝试是值得的。\n       \u003c/p\u003e\u003cp\u003e\n        注意，对每个要转储的数据库都会再次提示输入密码。通常，最好设置一个 \u003ccode class=\"filename\"\u003e~/.pgpass\u003c/code\u003e 文件，而不是依赖手工输入密码。\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        指定一个角色名，用于创建转储。此选项会使 \u003cspan class=\"application\"\u003epg_dumpall\u003c/span\u003e 在连接数据库后发出 \u003ccode class=\"command\"\u003eSET ROLE\u003c/code\u003e \u003cem class=\"replaceable\"\u003e\u003ccode\u003erolename\u003c/code\u003e\u003c/em\u003e 命令。当已认证用户（由 \u003ccode class=\"option\"\u003e-U\u003c/code\u003e 指定）缺少 \u003cspan class=\"application\"\u003epg_dumpall\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\u003cp\u003e\u003ca href=\"/zh/docs/18/app-pg-dumpall.html\"\u003e查看完整中文手册与上下文\u003c/a\u003e。\u003c/p\u003e","environment":[{"description":"Default connection parameters","name":"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_dumpall"},{"label":"Executable version","value":"18.6"},{"label":"Reference inventory","value":"Client applications"},{"label":"Option definition groups","value":"55"}],"facts_zh":[{"label":"手册中的可执行程序","value":"pg_dumpall"},{"label":"程序版本","value":"18.6"},{"label":"参考清单","value":"客户端程序"},{"label":"选项定义组","value":"55"}],"manual_html":"\u003cdiv\u003e\u003cdiv class=\"refentry\" id=\"APP-PG-DUMPALL\"\u003e\n\u003cdiv class=\"titlepage\"\u003e\u003c/div\u003e\n\u003cdiv class=\"refnamediv\"\u003e\n\u003ch2\u003e\u003cspan class=\"refentrytitle\"\u003e\u003cspan class=\"application\"\u003epg_dumpall\u003c/span\u003e\u003c/span\u003e\u003c/h2\u003e\n\u003cp\u003epg_dumpall — extract a \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e database cluster into a script file\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsynopsisdiv\"\u003e\n\u003ch2\u003eSynopsis\u003c/h2\u003e\n\u003cdiv class=\"cmdsynopsis\"\u003e\n\u003cp id=\"id-1.9.4.15.4.1\"\u003e\u003ccode class=\"command\"\u003epg_dumpall\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...]\u003c/p\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"APP-PG-DUMPALL-DESCRIPTION\"\u003e\n\u003ch2\u003eDescription\u003c/h2\u003e\n\u003cp\u003e\u003cspan class=\"application\"\u003epg_dumpall\u003c/span\u003e is a utility for writing out (\u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003edumping\u003c/span\u003e”\u003c/span\u003e) all \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e databases of a cluster into one script file. The script file contains SQL commands that can be used as input 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 to restore the databases. It does this by calling \u003ca class=\"xref\" href=\"/docs/18/app-pgdump.html\" title=\"pg_dump\"\u003e\u003cspan class=\"refentrytitle\"\u003e\u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e for each database in the cluster. \u003cspan class=\"application\"\u003epg_dumpall\u003c/span\u003e also dumps global objects that are common to all databases, namely database roles, tablespaces, and privilege grants for configuration parameters. (\u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e does not save these objects.)\u003c/p\u003e\n\u003cp\u003eSince \u003cspan class=\"application\"\u003epg_dumpall\u003c/span\u003e reads tables from all databases you will most likely have to connect as a database superuser in order to produce a complete dump. Also you will need superuser privileges to execute the saved script in order to be allowed to add roles and create databases.\u003c/p\u003e\n\u003cp\u003eThe SQL script will be written to the standard output. Use the \u003ccode class=\"option\"\u003e-f\u003c/code\u003e/\u003ccode class=\"option\"\u003e--file\u003c/code\u003e option or shell operators to redirect it into a file.\u003c/p\u003e\n\u003cp\u003e\u003cspan class=\"application\"\u003epg_dumpall\u003c/span\u003e needs to connect several times to the \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e server (once per database). If you use password authentication it will ask for a password each time. It is convenient to have a \u003ccode class=\"filename\"\u003e~/.pgpass\u003c/code\u003e file in such cases. See \u003ca class=\"xref\" href=\"/docs/18/libpq-pgpass.html\" title=\"32.16. The Password File\"\u003eSection 32.16\u003c/a\u003e for more information.\u003c/p\u003e\n\u003cdiv class=\"warning\"\u003e\n\u003ch3 class=\"title\"\u003eWarning\u003c/h3\u003e\n\u003cp\u003eRestoring a dump causes the destination to execute arbitrary code of the source superusers' choice. Partial dumps and partial restores do not limit that. If the source superusers are not trusted, the dumped SQL statements must be inspected before restoring. Note that the client running the dump and restore need not trust the source or destination superusers.\u003c/p\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"id-1.9.4.15.6\"\u003e\n\u003ch2\u003eOptions\u003c/h2\u003e\n\u003cp\u003eThe following command-line options control the content and format of the output.\u003c/p\u003e\n\u003cdiv class=\"variablelist\"\u003e\n\u003cdl class=\"variablelist\"\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-a\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--data-only\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDump only the data, not the schema (data definitions) or statistics.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-c\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--clean\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eEmit SQL commands to \u003ccode class=\"command\"\u003eDROP\u003c/code\u003e all the dumped databases, roles, and tablespaces before recreating them. This option is useful when the restore is to overwrite an existing cluster. If any of the objects do not exist in the destination cluster, ignorable error messages will be reported during restore, unless \u003ccode class=\"option\"\u003e--if-exists\u003c/code\u003e is also specified.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-E \u003cem class=\"replaceable\"\u003e\u003ccode\u003eencoding\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--encoding=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eencoding\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eCreate the dump in the specified character set encoding. By default, the dump is created in the database encoding. (Another way to get the same result is to set the \u003ccode class=\"envar\"\u003ePGCLIENTENCODING\u003c/code\u003e environment variable to the desired dump encoding.)\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-f \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\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\u003efilename\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSend output to the specified file. If this is omitted, the standard output is used.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-g\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--globals-only\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDump only global objects (roles and tablespaces), no databases.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-O\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-owner\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not output commands to set ownership of objects to match the original database. By default, \u003cspan class=\"application\"\u003epg_dumpall\u003c/span\u003e issues \u003ccode class=\"command\"\u003eALTER OWNER\u003c/code\u003e or \u003ccode class=\"command\"\u003eSET SESSION AUTHORIZATION\u003c/code\u003e statements to set ownership of created schema elements. These statements will fail when the script is run unless it is started by a superuser (or the same user that owns all of the objects in the script). To make a script that can be restored by any user, but will give that user ownership of all the objects, specify \u003ccode class=\"option\"\u003e-O\u003c/code\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-r\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--roles-only\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDump only roles, no databases or tablespaces.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-s\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--schema-only\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDump only the object definitions (schema), not data.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-S \u003cem class=\"replaceable\"\u003e\u003ccode\u003eusername\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--superuser=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eusername\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecify the superuser user name to use when disabling triggers. This is relevant only if \u003ccode class=\"option\"\u003e--disable-triggers\u003c/code\u003e is used. (Usually, it's better to leave this out, and instead start the resulting script as superuser.)\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-t\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--tablespaces-only\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDump only tablespaces, no databases or roles.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-v\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--verbose\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies verbose mode. This will cause \u003cspan class=\"application\"\u003epg_dumpall\u003c/span\u003e to output 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. The option is also passed down to \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-V\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--version\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003ePrint the \u003cspan class=\"application\"\u003epg_dumpall\u003c/span\u003e version and exit.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-x\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-privileges\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-acl\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003ePrevent dumping of access privileges (grant/revoke commands).\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--binary-upgrade\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThis option is for use by in-place upgrade utilities. Its use for other purposes is not recommended or supported. The behavior of the option may change in future releases without notice.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--column-inserts\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--attribute-inserts\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDump data as \u003ccode class=\"command\"\u003eINSERT\u003c/code\u003e commands with explicit column names (\u003ccode class=\"literal\"\u003eINSERT INTO \u003cem class=\"replaceable\"\u003e\u003ccode\u003etable\u003c/code\u003e\u003c/em\u003e (\u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolumn\u003c/code\u003e\u003c/em\u003e, ...) VALUES ...\u003c/code\u003e). This will make restoration very slow; it is mainly useful for making dumps that can be loaded into non-\u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e databases.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--disable-dollar-quoting\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThis option disables the use of dollar quoting for function bodies, and forces them to be quoted using SQL standard string syntax.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--disable-triggers\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThis option is relevant only when creating a dump with data and without schema. It instructs \u003cspan class=\"application\"\u003epg_dumpall\u003c/span\u003e to include commands to temporarily disable triggers on the target tables while the data is restored. Use this if you have referential integrity checks or other triggers on the tables that you do not want to invoke during data restore.\u003c/p\u003e\n\u003cp\u003ePresently, the commands emitted for \u003ccode class=\"option\"\u003e--disable-triggers\u003c/code\u003e must be done as superuser. So, you should also specify a superuser name with \u003ccode class=\"option\"\u003e-S\u003c/code\u003e, or preferably be careful to start the resulting script as a superuser.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--exclude-database=\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not dump databases whose name matches \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e. Multiple patterns can be excluded by writing multiple \u003ccode class=\"option\"\u003e--exclude-database\u003c/code\u003e switches. The \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e parameter is interpreted as a pattern according to the same rules used by \u003cspan class=\"application\"\u003epsql\u003c/span\u003e's \u003ccode class=\"literal\"\u003e\\d\u003c/code\u003e commands (see \u003ca class=\"xref\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003ePatterns\u003c/a\u003e), so multiple databases can also be excluded by writing wildcard characters in the pattern. When using wildcards, be careful to quote the pattern if needed to prevent shell wildcard expansion.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--extra-float-digits=\u003cem class=\"replaceable\"\u003e\u003ccode\u003endigits\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eUse the specified value of 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.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--filter=\u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecify a filename from which to read patterns for databases excluded from the dump. The patterns are interpreted according to the same rules as \u003ccode class=\"option\"\u003e--exclude-database\u003c/code\u003e. To read from \u003ccode class=\"literal\"\u003eSTDIN\u003c/code\u003e, use \u003ccode class=\"filename\"\u003e-\u003c/code\u003e as the filename. The \u003ccode class=\"option\"\u003e--filter\u003c/code\u003e option can be specified in conjunction with \u003ccode class=\"option\"\u003e--exclude-database\u003c/code\u003e for excluding databases, and can also be specified more than once for multiple filter files.\u003c/p\u003e\n\u003cp\u003eThe file lists one database pattern per row, with the following format:\u003c/p\u003e\n\u003cpre class=\"synopsis\"\u003eexclude database \u003cem class=\"replaceable\"\u003e\u003ccode\u003ePATTERN\u003c/code\u003e\u003c/em\u003e\n\u003c/pre\u003e\n\u003cp\u003eLines starting with \u003ccode class=\"literal\"\u003e#\u003c/code\u003e are considered comments and ignored. Comments can be placed after an object pattern row as well. Blank lines are also ignored. See \u003ca class=\"xref\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003ePatterns\u003c/a\u003e for how to perform quoting in patterns.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--if-exists\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eUse \u003ccode class=\"literal\"\u003eDROP ... IF EXISTS\u003c/code\u003e commands to drop objects in \u003ccode class=\"option\"\u003e--clean\u003c/code\u003e mode. This suppresses \u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003edoes not exist\u003c/span\u003e”\u003c/span\u003e errors that might otherwise be reported. This option is not valid unless \u003ccode class=\"option\"\u003e--clean\u003c/code\u003e is also specified.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--inserts\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDump data as \u003ccode class=\"command\"\u003eINSERT\u003c/code\u003e commands (rather than \u003ccode class=\"command\"\u003eCOPY\u003c/code\u003e). This will make restoration very slow; it is mainly useful for making dumps that can be loaded into non-\u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e databases. Note that the restore might fail altogether if you have rearranged column order. The \u003ccode class=\"option\"\u003e--column-inserts\u003c/code\u003e option is safer, though even slower.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--load-via-partition-root\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eWhen dumping data for a table partition, make the \u003ccode class=\"command\"\u003eCOPY\u003c/code\u003e or \u003ccode class=\"command\"\u003eINSERT\u003c/code\u003e statements target the root of the partitioning hierarchy that contains it, rather than the partition itself. This causes the appropriate partition to be re-determined for each row when the data is loaded. This may be useful when restoring data on a server where rows do not always fall into the same partitions as they did on the original server. That could happen, for example, if the partitioning column is of type text and the two systems have different definitions of the collation used to sort the partitioning column.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--lock-wait-timeout=\u003cem class=\"replaceable\"\u003e\u003ccode\u003etimeout\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not wait forever to acquire shared table locks at the beginning of the dump. Instead, fail if unable to lock a table within the specified \u003cem class=\"replaceable\"\u003e\u003ccode\u003etimeout\u003c/code\u003e\u003c/em\u003e. The timeout may be specified in any of the formats accepted by \u003ccode class=\"command\"\u003eSET statement_timeout\u003c/code\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-comments\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not dump \u003ccode class=\"command\"\u003eCOMMENT\u003c/code\u003e commands.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-data\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not dump data.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-policies\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not dump row security policies.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-publications\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not dump publications.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-role-passwords\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not dump passwords for roles. When restored, roles will have a null password, and password authentication will always fail until the password is set. Since password values aren't needed when this option is specified, the role information is read from the catalog view \u003ccode class=\"structname\"\u003epg_roles\u003c/code\u003e instead of \u003ccode class=\"structname\"\u003epg_authid\u003c/code\u003e. Therefore, this option also helps if access to \u003ccode class=\"structname\"\u003epg_authid\u003c/code\u003e is restricted by some security policy.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-schema\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not dump schema (data definitions).\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-security-labels\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not dump security labels.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-statistics\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not dump statistics. This is the default.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-subscriptions\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not dump subscriptions.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-sync\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eBy default, \u003ccode class=\"command\"\u003epg_dumpall\u003c/code\u003e will wait for all files to be written safely to disk. This option causes \u003ccode class=\"command\"\u003epg_dumpall\u003c/code\u003e to return without waiting, which is faster, but means that a subsequent operating system crash can leave the dump corrupt. Generally, this option is useful for testing but should not be used when dumping data from production installation.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-table-access-method\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not output commands to select table access methods. With this option, all objects will be created with whichever table access method is the default during restore.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-tablespaces\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not output commands to create tablespaces nor select tablespaces for objects. With this option, all objects will be created in whichever tablespace is the default during restore.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-toast-compression\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not output commands to set TOAST compression methods. With this option, all columns will be restored with the default compression setting.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-unlogged-table-data\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not dump the contents of unlogged tables. This option has no effect on whether or not the table definitions (schema) are dumped; it only suppresses dumping the table data.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--on-conflict-do-nothing\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eAdd \u003ccode class=\"literal\"\u003eON CONFLICT DO NOTHING\u003c/code\u003e to \u003ccode class=\"command\"\u003eINSERT\u003c/code\u003e commands. This option is not valid unless \u003ccode class=\"option\"\u003e--inserts\u003c/code\u003e or \u003ccode class=\"option\"\u003e--column-inserts\u003c/code\u003e is also specified.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--quote-all-identifiers\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eForce quoting of all identifiers. This option is recommended when dumping a database from a server whose \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e major version is different from \u003cspan class=\"application\"\u003epg_dumpall\u003c/span\u003e's, or when the output is intended to be loaded into a server of a different major version. By default, \u003cspan class=\"application\"\u003epg_dumpall\u003c/span\u003e quotes only identifiers that are reserved words in its own major version. This sometimes results in compatibility issues when dealing with servers of other versions that may have slightly different sets of reserved words. Using \u003ccode class=\"option\"\u003e--quote-all-identifiers\u003c/code\u003e prevents such issues, at the price of a harder-to-read dump script.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--restrict-key=\u003cem class=\"replaceable\"\u003e\u003ccode\u003erestrict_key\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eUse the provided string as the \u003cspan class=\"application\"\u003epsql\u003c/span\u003e \u003ccode class=\"command\"\u003e\\restrict\u003c/code\u003e key in the dump output. If no restrict key is specified, \u003cspan class=\"application\"\u003epg_dumpall\u003c/span\u003e will generate a random one as needed. Keys may contain only alphanumeric characters.\u003c/p\u003e\n\u003cp\u003eThis option is primarily intended for testing purposes and other scenarios that require repeatable output (e.g., comparing dump files). It is not recommended for general use, as a malicious server with advance knowledge of the key may be able to inject arbitrary code that will be executed on the machine that runs \u003cspan class=\"application\"\u003epsql\u003c/span\u003e with the dump output.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--rows-per-insert=\u003cem class=\"replaceable\"\u003e\u003ccode\u003enrows\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDump data as \u003ccode class=\"command\"\u003eINSERT\u003c/code\u003e commands (rather than \u003ccode class=\"command\"\u003eCOPY\u003c/code\u003e). Controls the maximum number of rows per \u003ccode class=\"command\"\u003eINSERT\u003c/code\u003e command. The value specified must be a number greater than zero. Any error during restoring will cause only rows that are part of the problematic \u003ccode class=\"command\"\u003eINSERT\u003c/code\u003e to be lost, rather than the entire table contents.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--statistics\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDump optimizer statistics.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--statistics-only\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDump only the statistics, not the schema (data definitions) or data. Optimizer statistics for tables, materialized views, foreign tables, and indexes are dumped.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--sequence-data\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eInclude sequence data in the dump. This is the default behavior except when \u003ccode class=\"option\"\u003e--no-data\u003c/code\u003e, \u003ccode class=\"option\"\u003e--schema-only\u003c/code\u003e, or \u003ccode class=\"option\"\u003e--statistics-only\u003c/code\u003e is specified.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--use-set-session-authorization\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eOutput SQL-standard \u003ccode class=\"command\"\u003eSET SESSION AUTHORIZATION\u003c/code\u003e commands instead of \u003ccode class=\"command\"\u003eALTER OWNER\u003c/code\u003e commands to determine object ownership. This makes the dump more standards compatible, but depending on the history of the objects in the dump, might not restore properly.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-?\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--help\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eShow help about \u003cspan class=\"application\"\u003epg_dumpall\u003c/span\u003e command line arguments, and exit.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003cp\u003eThe following command-line options control the database connection parameters.\u003c/p\u003e\n\u003cdiv class=\"variablelist\"\u003e\n\u003cdl class=\"variablelist\"\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-d \u003cem class=\"replaceable\"\u003e\u003ccode\u003econnstr\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\u003econnstr\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies parameters used to connect to the server, as a \u003ca class=\"link\" href=\"/docs/18/libpq-connect.html#LIBPQ-CONNSTRING\" title=\"32.1.1. Connection Strings\"\u003econnection string\u003c/a\u003e; these will override any conflicting command line options.\u003c/p\u003e\n\u003cp\u003eThe option is called \u003ccode class=\"literal\"\u003e--dbname\u003c/code\u003e for consistency with other client applications, but because \u003cspan class=\"application\"\u003epg_dumpall\u003c/span\u003e needs to connect to many databases, the database name in the connection string will be ignored. Use the \u003ccode class=\"literal\"\u003e-l\u003c/code\u003e option to specify the name of the database used for the initial connection, which will dump global objects and discover what other databases should be dumped.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-h \u003cem class=\"replaceable\"\u003e\u003ccode\u003ehost\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--host=\u003cem class=\"replaceable\"\u003e\u003ccode\u003ehost\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the host name of the machine on which the database server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket. The default is taken from the \u003ccode class=\"envar\"\u003ePGHOST\u003c/code\u003e environment variable, if set, else a Unix domain socket connection is attempted.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-l \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--database=\u003cem class=\"replaceable\"\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the name of the database to connect to for dumping global objects and discovering what other databases should be dumped. If not specified, the \u003ccode class=\"literal\"\u003epostgres\u003c/code\u003e database will be used, and if that does not exist, \u003ccode class=\"literal\"\u003etemplate1\u003c/code\u003e will be used.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-p \u003cem class=\"replaceable\"\u003e\u003ccode\u003eport\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--port=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eport\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the \u003ccode class=\"envar\"\u003ePGPORT\u003c/code\u003e environment variable, if set, or a compiled-in default.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-U \u003cem class=\"replaceable\"\u003e\u003ccode\u003eusername\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--username=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eusername\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eUser name to connect as.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-w\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-password\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eNever issue a password prompt. If the server requires password authentication and a password is not available by other means such as a \u003ccode class=\"filename\"\u003e.pgpass\u003c/code\u003e file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-W\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--password\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eForce \u003cspan class=\"application\"\u003epg_dumpall\u003c/span\u003e to prompt for a password before connecting to a database.\u003c/p\u003e\n\u003cp\u003eThis option is never essential, since \u003cspan class=\"application\"\u003epg_dumpall\u003c/span\u003e will automatically prompt for a password if the server demands password authentication. However, \u003cspan class=\"application\"\u003epg_dumpall\u003c/span\u003e will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing \u003ccode class=\"option\"\u003e-W\u003c/code\u003e to avoid the extra connection attempt.\u003c/p\u003e\n\u003cp\u003eNote that the password prompt will occur again for each database to be dumped. Usually, it's better to set up a \u003ccode class=\"filename\"\u003e~/.pgpass\u003c/code\u003e file than to rely on manual password entry.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--role=\u003cem class=\"replaceable\"\u003e\u003ccode\u003erolename\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies a role name to be used to create the dump. This option causes \u003cspan class=\"application\"\u003epg_dumpall\u003c/span\u003e to issue a \u003ccode class=\"command\"\u003eSET ROLE\u003c/code\u003e \u003cem class=\"replaceable\"\u003e\u003ccode\u003erolename\u003c/code\u003e\u003c/em\u003e command after connecting to the database. It is useful when the authenticated user (specified by \u003ccode class=\"option\"\u003e-U\u003c/code\u003e) lacks privileges needed by \u003cspan class=\"application\"\u003epg_dumpall\u003c/span\u003e, but can switch to a role with the required rights. Some installations have a policy against logging in directly as a superuser, and use of this option allows dumps to be made without violating the policy.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"id-1.9.4.15.7\"\u003e\n\u003ch2\u003eEnvironment\u003c/h2\u003e\n\u003cdiv class=\"variablelist\"\u003e\n\u003cdl class=\"variablelist\"\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003ePGHOST\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003ePGOPTIONS\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003ePGPORT\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003ePGUSER\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDefault connection parameters\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003ePG_COLOR\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies whether to use color in diagnostic messages. Possible values are \u003ccode class=\"literal\"\u003ealways\u003c/code\u003e, \u003ccode class=\"literal\"\u003eauto\u003c/code\u003e and \u003ccode class=\"literal\"\u003enever\u003c/code\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003cp\u003eThis utility, like most other \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e utilities, also uses the environment variables supported by \u003cspan class=\"application\"\u003elibpq\u003c/span\u003e (see \u003ca class=\"xref\" href=\"/docs/18/libpq-envars.html\" title=\"32.15. Environment Variables\"\u003eSection 32.15\u003c/a\u003e).\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"id-1.9.4.15.8\"\u003e\n\u003ch2\u003eNotes\u003c/h2\u003e\n\u003cp\u003eSince \u003cspan class=\"application\"\u003epg_dumpall\u003c/span\u003e calls \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e internally, some diagnostic messages will refer to \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e.\u003c/p\u003e\n\u003cp\u003eThe \u003ccode class=\"option\"\u003e--clean\u003c/code\u003e option can be useful even when your intention is to restore the dump script into a fresh cluster. Use of \u003ccode class=\"option\"\u003e--clean\u003c/code\u003e authorizes the script to drop and re-create the built-in \u003ccode class=\"literal\"\u003epostgres\u003c/code\u003e and \u003ccode class=\"literal\"\u003etemplate1\u003c/code\u003e databases, ensuring that those databases will retain the same properties (for instance, locale and encoding) that they had in the source cluster. Without the option, those databases will retain their existing database-level properties, as well as any pre-existing contents.\u003c/p\u003e\n\u003cp\u003eWhen \u003ccode class=\"option\"\u003e--statistics\u003c/code\u003e is specified, \u003ccode class=\"command\"\u003epg_dumpall\u003c/code\u003e will include most optimizer statistics in the resulting dump file. This does not include all statistics, such as those created explicitly with \u003ca class=\"xref\" href=\"/docs/18/sql-createstatistics.html\" title=\"CREATE STATISTICS\"\u003e\u003cspan class=\"refentrytitle\"\u003eCREATE STATISTICS\u003c/span\u003e\u003c/a\u003e, custom statistics added by an extension, or statistics collected by the cumulative statistics system. Therefore, it may still be useful to run \u003ccode class=\"command\"\u003eANALYZE\u003c/code\u003e on each database after restoring from a dump file to ensure optimal performance. You can also run \u003ccode class=\"command\"\u003evacuumdb -a -z\u003c/code\u003e to analyze all databases.\u003c/p\u003e\n\u003cp\u003eThe dump script should not be expected to run completely without errors. In particular, because the script will issue \u003ccode class=\"command\"\u003eCREATE ROLE\u003c/code\u003e for every role existing in the source cluster, it is certain to get a \u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003erole already exists\u003c/span\u003e”\u003c/span\u003e error for the bootstrap superuser, unless the destination cluster was initialized with a different bootstrap superuser name. This error is harmless and should be ignored. Use of the \u003ccode class=\"option\"\u003e--clean\u003c/code\u003e option is likely to produce additional harmless error messages about non-existent objects, although you can minimize those by adding \u003ccode class=\"option\"\u003e--if-exists\u003c/code\u003e.\u003c/p\u003e\n\u003cp\u003e\u003cspan class=\"application\"\u003epg_dumpall\u003c/span\u003e requires all needed tablespace directories to exist before the restore; otherwise, database creation will fail for databases in non-default locations.\u003c/p\u003e\n\u003cp\u003eIt is generally recommended to use the \u003ccode class=\"option\"\u003e-X\u003c/code\u003e (\u003ccode class=\"option\"\u003e--no-psqlrc\u003c/code\u003e) option when restoring a database from a \u003cspan class=\"application\"\u003epg_dumpall\u003c/span\u003e script to ensure a clean restore process and prevent potential conflicts with non-default \u003cspan class=\"application\"\u003epsql\u003c/span\u003e configurations. Additionally, because the \u003cspan class=\"application\"\u003epg_dumpall\u003c/span\u003e script may include \u003cspan class=\"application\"\u003epsql\u003c/span\u003e meta-commands, it may be incompatible with clients other than \u003cspan class=\"application\"\u003epsql\u003c/span\u003e.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"APP-PG-DUMPALL-EX\"\u003e\n\u003ch2\u003eExamples\u003c/h2\u003e\n\u003cp\u003eTo dump all databases:\u003c/p\u003e\n\u003cpre class=\"screen\"\u003e\u003ccode class=\"prompt\"\u003e$\u003c/code\u003e \u003cstrong class=\"userinput\"\u003e\u003ccode\u003epg_dumpall \u0026gt; db.out\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\n\u003cp\u003eTo restore database(s) from this file, you can use:\u003c/p\u003e\n\u003cpre class=\"screen\"\u003e\u003ccode class=\"prompt\"\u003e$\u003c/code\u003e \u003cstrong class=\"userinput\"\u003e\u003ccode\u003epsql -X -f db.out -d postgres\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\n\u003cp\u003eIt is not important which database you connect to here since the script file created by \u003cspan class=\"application\"\u003epg_dumpall\u003c/span\u003e will contain the appropriate commands to create and connect to the saved databases. An exception is that if you specified \u003ccode class=\"option\"\u003e--clean\u003c/code\u003e, you must connect to the \u003ccode class=\"literal\"\u003epostgres\u003c/code\u003e database initially; the script will attempt to drop other databases immediately, and that will fail for the database you are connected to.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"id-1.9.4.15.10\"\u003e\n\u003ch2\u003eSee Also\u003c/h2\u003e\n\u003cp\u003eCheck \u003ca class=\"xref\" href=\"/docs/18/app-pgdump.html\" title=\"pg_dump\"\u003e\u003cspan class=\"refentrytitle\"\u003e\u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e for details on possible error conditions.\u003c/p\u003e\n\u003c/div\u003e\n\u003c/div\u003e\u003c/div\u003e","manual_path":"app-pg-dumpall.html","options":[{"description":"Dump only the data, not the schema (data definitions) or statistics.","names":["-a","--data-only"],"signature":"-a --data-only","source_url":"/docs/18/app-pg-dumpall.html","summary":"Dump only the data, not the schema (data definitions) or statistics."},{"description":"Emit SQL commands to DROP all the dumped databases, roles, and tablespaces before recreating them. This option is useful when the restore is to overwrite an existing cluster. If any of the objects do not exist in the destination cluster, ignorable error messages will be reported during restore, unless --if-exists is also specified.","names":["-c","--clean"],"signature":"-c --clean","source_url":"/docs/18/app-pg-dumpall.html","summary":"Emit SQL commands to DROP all the dumped databases, roles, and tablespaces before recreating them. This option is useful when the restore is to overwrite an existing cluster. If any of the objects do not exist in the destination cluster, ignorable error messages will be reported during restore, unless --if-exists is also specified."},{"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.)","names":["-E encoding","--encoding= encoding"],"signature":"-E encoding --encoding= encoding","source_url":"/docs/18/app-pg-dumpall.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.)"},{"description":"Send output to the specified file. If this is omitted, the standard output is used.","names":["-f filename","--file= filename"],"signature":"-f filename --file= filename","source_url":"/docs/18/app-pg-dumpall.html","summary":"Send output to the specified file. If this is omitted, the standard output is used."},{"description":"Dump only global objects (roles and tablespaces), no databases.","names":["-g","--globals-only"],"signature":"-g --globals-only","source_url":"/docs/18/app-pg-dumpall.html","summary":"Dump only global objects (roles and tablespaces), no databases."},{"description":"Do not output commands to set ownership of objects to match the original database. By default, pg_dumpall issues ALTER OWNER or SET SESSION AUTHORIZATION statements to set ownership of created schema elements. 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 .","names":["-O","--no-owner"],"signature":"-O --no-owner","source_url":"/docs/18/app-pg-dumpall.html","summary":"Do not output commands to set ownership of objects to match the original database. By default, pg_dumpall issues ALTER OWNER or SET SESSION AUTHORIZATION statements to set ownership of created schema elements. 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":"Dump only roles, no databases or tablespaces.","names":["-r","--roles-only"],"signature":"-r --roles-only","source_url":"/docs/18/app-pg-dumpall.html","summary":"Dump only roles, no databases or tablespaces."},{"description":"Dump only the object definitions (schema), not data.","names":["-s","--schema-only"],"signature":"-s --schema-only","source_url":"/docs/18/app-pg-dumpall.html","summary":"Dump only the object definitions (schema), not data."},{"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-pg-dumpall.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 tablespaces, no databases or roles.","names":["-t","--tablespaces-only"],"signature":"-t --tablespaces-only","source_url":"/docs/18/app-pg-dumpall.html","summary":"Dump only tablespaces, no databases or roles."},{"description":"Specifies verbose mode. This will cause pg_dumpall to output 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. The option is also passed down to pg_dump .","names":["-v","--verbose"],"signature":"-v --verbose","source_url":"/docs/18/app-pg-dumpall.html","summary":"Specifies verbose mode. This will cause pg_dumpall to output 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. The option is also passed down to pg_dump ."},{"description":"Print the pg_dumpall version and exit.","names":["-V","--version"],"signature":"-V --version","source_url":"/docs/18/app-pg-dumpall.html","summary":"Print the pg_dumpall 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-pg-dumpall.html","summary":"Prevent dumping of access privileges (grant/revoke commands)."},{"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-pg-dumpall.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.","names":["--column-inserts","--attribute-inserts"],"signature":"--column-inserts --attribute-inserts","source_url":"/docs/18/app-pg-dumpall.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."},{"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-pg-dumpall.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 with data and without schema. It instructs pg_dumpall 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.","names":["--disable-triggers"],"signature":"--disable-triggers","source_url":"/docs/18/app-pg-dumpall.html","summary":"This option is relevant only when creating a dump with data and without schema. It instructs pg_dumpall 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":"Do not dump databases whose name matches pattern . Multiple patterns can be excluded by writing multiple --exclude-database switches. The pattern parameter is interpreted as a pattern according to the same rules used by psql 's \\d commands (see Patterns ), so multiple databases can also be excluded by writing wildcard characters in the pattern. When using wildcards, be careful to quote the pattern if needed to prevent shell wildcard expansion.","names":["--exclude-database= pattern"],"signature":"--exclude-database= pattern","source_url":"/docs/18/app-pg-dumpall.html","summary":"Do not dump databases whose name matches pattern . Multiple patterns can be excluded by writing multiple --exclude-database switches. The pattern parameter is interpreted as a pattern according to the same rules used by psql 's \\d commands (see Patterns ), so multiple databases can also be excluded by writing wildcard characters in the pattern. When using wildcards, be careful to quote the pattern if needed to prevent shell wildcard expansion."},{"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-pg-dumpall.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 databases excluded from the dump. The patterns are interpreted according to the same rules as --exclude-database . To read from STDIN , use - as the filename. The --filter option can be specified in conjunction with --exclude-database for excluding databases, and can also be specified more than once for multiple filter files. The file lists one database pattern per row, with the following format: exclude database PATTERN 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.","names":["--filter= filename"],"signature":"--filter= filename","source_url":"/docs/18/app-pg-dumpall.html","summary":"Specify a filename from which to read patterns for databases excluded from the dump. The patterns are interpreted according to the same rules as --exclude-database . To read from STDIN , use - as the filename. The --filter option can be specified in conjunction with --exclude-database for excluding databases, 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-pg-dumpall.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 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. Note that the restore might fail altogether if you have rearranged column order. The --column-inserts option is safer, though even slower.","names":["--inserts"],"signature":"--inserts","source_url":"/docs/18/app-pg-dumpall.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. Note that the restore might fail altogether if you have rearranged column order. The --column-inserts option is safer, 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-pg-dumpall.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 .","names":["--lock-wait-timeout= timeout"],"signature":"--lock-wait-timeout= timeout","source_url":"/docs/18/app-pg-dumpall.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 ."},{"description":"Do not dump COMMENT commands.","names":["--no-comments"],"signature":"--no-comments","source_url":"/docs/18/app-pg-dumpall.html","summary":"Do not dump COMMENT commands."},{"description":"Do not dump data.","names":["--no-data"],"signature":"--no-data","source_url":"/docs/18/app-pg-dumpall.html","summary":"Do not dump data."},{"description":"Do not dump row security policies.","names":["--no-policies"],"signature":"--no-policies","source_url":"/docs/18/app-pg-dumpall.html","summary":"Do not dump row security policies."},{"description":"Do not dump publications.","names":["--no-publications"],"signature":"--no-publications","source_url":"/docs/18/app-pg-dumpall.html","summary":"Do not dump publications."},{"description":"Do not dump passwords for roles. When restored, roles will have a null password, and password authentication will always fail until the password is set. Since password values aren't needed when this option is specified, the role information is read from the catalog view pg_roles instead of pg_authid . Therefore, this option also helps if access to pg_authid is restricted by some security policy.","names":["--no-role-passwords"],"signature":"--no-role-passwords","source_url":"/docs/18/app-pg-dumpall.html","summary":"Do not dump passwords for roles. When restored, roles will have a null password, and password authentication will always fail until the password is set. Since password values aren't needed when this option is specified, the role information is read from the catalog view pg_roles instead of pg_authid . Therefore, this option also helps if access to pg_authid is restricted by some security policy."},{"description":"Do not dump schema (data definitions).","names":["--no-schema"],"signature":"--no-schema","source_url":"/docs/18/app-pg-dumpall.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-pg-dumpall.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-pg-dumpall.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-pg-dumpall.html","summary":"Do not dump subscriptions."},{"description":"By default, pg_dumpall will wait for all files to be written safely to disk. This option causes pg_dumpall 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-pg-dumpall.html","summary":"By default, pg_dumpall will wait for all files to be written safely to disk. This option causes pg_dumpall 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.","names":["--no-table-access-method"],"signature":"--no-table-access-method","source_url":"/docs/18/app-pg-dumpall.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 create tablespaces nor select tablespaces for objects. With this option, all objects will be created in whichever tablespace is the default during restore.","names":["--no-tablespaces"],"signature":"--no-tablespaces","source_url":"/docs/18/app-pg-dumpall.html","summary":"Do not output commands to create tablespaces nor select tablespaces for objects. 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-pg-dumpall.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. This option has no effect on whether or not the table definitions (schema) are dumped; it only suppresses dumping the table data.","names":["--no-unlogged-table-data"],"signature":"--no-unlogged-table-data","source_url":"/docs/18/app-pg-dumpall.html","summary":"Do not dump the contents of unlogged tables. This option has no effect on whether or not the table definitions (schema) are dumped; it only suppresses dumping the table data."},{"description":"Add ON CONFLICT DO NOTHING to INSERT commands. This option is not valid unless --inserts or --column-inserts is also specified.","names":["--on-conflict-do-nothing"],"signature":"--on-conflict-do-nothing","source_url":"/docs/18/app-pg-dumpall.html","summary":"Add ON CONFLICT DO NOTHING to INSERT commands. This option is not valid unless --inserts or --column-inserts 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_dumpall 's, or when the output is intended to be loaded into a server of a different major version. By default, pg_dumpall 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-pg-dumpall.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_dumpall 's, or when the output is intended to be loaded into a server of a different major version. By default, pg_dumpall 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_dumpall 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-pg-dumpall.html","summary":"Use the provided string as the psql \\restrict key in the dump output. If no restrict key is specified, pg_dumpall 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-pg-dumpall.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":"Dump optimizer statistics.","names":["--statistics"],"signature":"--statistics","source_url":"/docs/18/app-pg-dumpall.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-pg-dumpall.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":"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-pg-dumpall.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":"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.","names":["--use-set-session-authorization"],"signature":"--use-set-session-authorization","source_url":"/docs/18/app-pg-dumpall.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."},{"description":"Show help about pg_dumpall command line arguments, and exit.","names":["-?","--help"],"signature":"-? --help","source_url":"/docs/18/app-pg-dumpall.html","summary":"Show help about pg_dumpall command line arguments, and exit."},{"description":"Specifies parameters used to connect to the server, as a connection string ; these will override any conflicting command line options. The option is called --dbname for consistency with other client applications, but because pg_dumpall needs to connect to many databases, the database name in the connection string will be ignored. Use the -l option to specify the name of the database used for the initial connection, which will dump global objects and discover what other databases should be dumped.","names":["-d connstr","--dbname= connstr"],"signature":"-d connstr --dbname= connstr","source_url":"/docs/18/app-pg-dumpall.html","summary":"Specifies parameters used to connect to the server, as a connection string ; these will override any conflicting command line options."},{"description":"Specifies the host name of the machine on which the database 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-pg-dumpall.html","summary":"Specifies the host name of the machine on which the database 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 name of the database to connect to for dumping global objects and discovering what other databases should be dumped. If not specified, the postgres database will be used, and if that does not exist, template1 will be used.","names":["-l dbname","--database= dbname"],"signature":"-l dbname --database= dbname","source_url":"/docs/18/app-pg-dumpall.html","summary":"Specifies the name of the database to connect to for dumping global objects and discovering what other databases should be dumped. If not specified, the postgres database will be used, and if that does not exist, template1 will be used."},{"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-pg-dumpall.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-pg-dumpall.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-pg-dumpall.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_dumpall to prompt for a password before connecting to a database. This option is never essential, since pg_dumpall will automatically prompt for a password if the server demands password authentication. However, pg_dumpall 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. Note that the password prompt will occur again for each database to be dumped. Usually, it's better to set up a ~/.pgpass file than to rely on manual password entry.","names":["-W","--password"],"signature":"-W --password","source_url":"/docs/18/app-pg-dumpall.html","summary":"Force pg_dumpall 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_dumpall 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_dumpall , 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-pg-dumpall.html","summary":"Specifies a role name to be used to create the dump. This option causes pg_dumpall 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_dumpall , but can switch to a role with the required rights. Some installations have a policy against logging in directly as a superuser, and use of this option allows dumps to be made without violating the policy."}],"related":[{"label":"libpq connection parameters","url":"/wiki/conn/?v=18"}],"release":{"channel":"stable","evidence_kind":"English manual and source declarations","label":"18.6","major":"18","manifest":{"index":"index.html","major":"18","pages":1148,"pdf":{"A4":{"built_at":"2026-09-26","bytes":15865106,"pages":3154,"sha256":"19512c405da53f9f7fcf0abba359223aa65f021be025bf3411381918f92e3190","url":"/files/documentation/pdf/18/postgresql-18-A4.pdf"},"US":{"built_at":"2026-09-26","bytes":15748059,"pages":3328,"sha256":"facbe6c229e598b872d3d98bef53308f46e06746006fa4590de9a7de9dd46319","url":"/files/documentation/pdf/18/postgresql-18-US.pdf"}},"release":"18.6","source_mode":"en SGML built with pinned official archive","source_sha256":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f","source_url":"https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2","svg_assets":3,"tree":"18"},"ref":"https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2","revision":"ee8d1a3612338fd9adf250730cb640fcc5233b5491337cc00a316a44e3a0b9f8","source_sha256":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f"},"sections":[],"sections_zh":[],"signature":"pg_dumpall [ connection-option ...] [ option ...]","sources":[{"anchor":"","file":"app-pg-dumpall.html","label":"18.6 English manual · app-pg-dumpall.html","sha256":"5f64e2921cefa4823764e46860b95e0f5f7568192670220a0bac10314c740683","url":"/docs/18/app-pg-dumpall.html"},{"anchor":"","file":"reference-client.html","label":"Client applications inventory","sha256":"68f726af77272fe73a827be2b7b5958d0f2239a6f8ed44264e9d42496bfa4fd0","url":"/docs/18/reference-client.html"}],"synopsis":["pg_dumpall [ connection-option ...] [ option ...]"],"tables":[{"columns":[{"key":"signature","label":"Option and arguments"},{"key":"summary","label":"Description"}],"key":"options","rows":[{"signature":{"text":"-a --data-only","url":"/docs/18/app-pg-dumpall.html"},"summary":"Dump only the data, not the schema (data definitions) or statistics."},{"signature":{"text":"-c --clean","url":"/docs/18/app-pg-dumpall.html"},"summary":"Emit SQL commands to DROP all the dumped databases, roles, and tablespaces before recreating them. This option is useful when the restore is to overwrite an existing cluster. If any of the objects do not exist in the destination cluster, ignorable error messages will be reported during restore, unless --if-exists is also specified."},{"signature":{"text":"-E encoding --encoding= encoding","url":"/docs/18/app-pg-dumpall.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.)"},{"signature":{"text":"-f filename --file= filename","url":"/docs/18/app-pg-dumpall.html"},"summary":"Send output to the specified file. If this is omitted, the standard output is used."},{"signature":{"text":"-g --globals-only","url":"/docs/18/app-pg-dumpall.html"},"summary":"Dump only global objects (roles and tablespaces), no databases."},{"signature":{"text":"-O --no-owner","url":"/docs/18/app-pg-dumpall.html"},"summary":"Do not output commands to set ownership of objects to match the original database. By default, pg_dumpall issues ALTER OWNER or SET SESSION AUTHORIZATION statements to set ownership of created schema elements. 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 --roles-only","url":"/docs/18/app-pg-dumpall.html"},"summary":"Dump only roles, no databases or tablespaces."},{"signature":{"text":"-s --schema-only","url":"/docs/18/app-pg-dumpall.html"},"summary":"Dump only the object definitions (schema), not data."},{"signature":{"text":"-S username --superuser= username","url":"/docs/18/app-pg-dumpall.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 --tablespaces-only","url":"/docs/18/app-pg-dumpall.html"},"summary":"Dump only tablespaces, no databases or roles."},{"signature":{"text":"-v --verbose","url":"/docs/18/app-pg-dumpall.html"},"summary":"Specifies verbose mode. This will cause pg_dumpall to output 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. The option is also passed down to pg_dump ."},{"signature":{"text":"-V --version","url":"/docs/18/app-pg-dumpall.html"},"summary":"Print the pg_dumpall version and exit."},{"signature":{"text":"-x --no-privileges --no-acl","url":"/docs/18/app-pg-dumpall.html"},"summary":"Prevent dumping of access privileges (grant/revoke commands)."},{"signature":{"text":"--binary-upgrade","url":"/docs/18/app-pg-dumpall.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-pg-dumpall.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."},{"signature":{"text":"--disable-dollar-quoting","url":"/docs/18/app-pg-dumpall.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-pg-dumpall.html"},"summary":"This option is relevant only when creating a dump with data and without schema. It instructs pg_dumpall 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":"--exclude-database= pattern","url":"/docs/18/app-pg-dumpall.html"},"summary":"Do not dump databases whose name matches pattern . Multiple patterns can be excluded by writing multiple --exclude-database switches. The pattern parameter is interpreted as a pattern according to the same rules used by psql 's \\d commands (see Patterns ), so multiple databases can also be excluded by writing wildcard characters in the pattern. When using wildcards, be careful to quote the pattern if needed to prevent shell wildcard expansion."},{"signature":{"text":"--extra-float-digits= ndigits","url":"/docs/18/app-pg-dumpall.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-pg-dumpall.html"},"summary":"Specify a filename from which to read patterns for databases excluded from the dump. The patterns are interpreted according to the same rules as --exclude-database . To read from STDIN , use - as the filename. The --filter option can be specified in conjunction with --exclude-database for excluding databases, and can also be specified more than once for multiple filter files."},{"signature":{"text":"--if-exists","url":"/docs/18/app-pg-dumpall.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":"--inserts","url":"/docs/18/app-pg-dumpall.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. Note that the restore might fail altogether if you have rearranged column order. The --column-inserts option is safer, though even slower."},{"signature":{"text":"--load-via-partition-root","url":"/docs/18/app-pg-dumpall.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-pg-dumpall.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 ."},{"signature":{"text":"--no-comments","url":"/docs/18/app-pg-dumpall.html"},"summary":"Do not dump COMMENT commands."},{"signature":{"text":"--no-data","url":"/docs/18/app-pg-dumpall.html"},"summary":"Do not dump data."},{"signature":{"text":"--no-policies","url":"/docs/18/app-pg-dumpall.html"},"summary":"Do not dump row security policies."},{"signature":{"text":"--no-publications","url":"/docs/18/app-pg-dumpall.html"},"summary":"Do not dump publications."},{"signature":{"text":"--no-role-passwords","url":"/docs/18/app-pg-dumpall.html"},"summary":"Do not dump passwords for roles. When restored, roles will have a null password, and password authentication will always fail until the password is set. Since password values aren't needed when this option is specified, the role information is read from the catalog view pg_roles instead of pg_authid . Therefore, this option also helps if access to pg_authid is restricted by some security policy."},{"signature":{"text":"--no-schema","url":"/docs/18/app-pg-dumpall.html"},"summary":"Do not dump schema (data definitions)."},{"signature":{"text":"--no-security-labels","url":"/docs/18/app-pg-dumpall.html"},"summary":"Do not dump security labels."},{"signature":{"text":"--no-statistics","url":"/docs/18/app-pg-dumpall.html"},"summary":"Do not dump statistics. This is the default."},{"signature":{"text":"--no-subscriptions","url":"/docs/18/app-pg-dumpall.html"},"summary":"Do not dump subscriptions."},{"signature":{"text":"--no-sync","url":"/docs/18/app-pg-dumpall.html"},"summary":"By default, pg_dumpall will wait for all files to be written safely to disk. This option causes pg_dumpall 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-pg-dumpall.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-pg-dumpall.html"},"summary":"Do not output commands to create tablespaces nor select tablespaces for objects. 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-pg-dumpall.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-pg-dumpall.html"},"summary":"Do not dump the contents of unlogged tables. This option has no effect on whether or not the table definitions (schema) are dumped; it only suppresses dumping the table data."},{"signature":{"text":"--on-conflict-do-nothing","url":"/docs/18/app-pg-dumpall.html"},"summary":"Add ON CONFLICT DO NOTHING to INSERT commands. This option is not valid unless --inserts or --column-inserts is also specified."},{"signature":{"text":"--quote-all-identifiers","url":"/docs/18/app-pg-dumpall.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_dumpall 's, or when the output is intended to be loaded into a server of a different major version. By default, pg_dumpall 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-pg-dumpall.html"},"summary":"Use the provided string as the psql \\restrict key in the dump output. If no restrict key is specified, pg_dumpall will generate a random one as needed. Keys may contain only alphanumeric characters."},{"signature":{"text":"--rows-per-insert= nrows","url":"/docs/18/app-pg-dumpall.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":"--statistics","url":"/docs/18/app-pg-dumpall.html"},"summary":"Dump optimizer statistics."},{"signature":{"text":"--statistics-only","url":"/docs/18/app-pg-dumpall.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":"--sequence-data","url":"/docs/18/app-pg-dumpall.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":"--use-set-session-authorization","url":"/docs/18/app-pg-dumpall.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."},{"signature":{"text":"-? --help","url":"/docs/18/app-pg-dumpall.html"},"summary":"Show help about pg_dumpall command line arguments, and exit."},{"signature":{"text":"-d connstr --dbname= connstr","url":"/docs/18/app-pg-dumpall.html"},"summary":"Specifies parameters used to connect to the server, as a connection string ; these will override any conflicting command line options."},{"signature":{"text":"-h host --host= host","url":"/docs/18/app-pg-dumpall.html"},"summary":"Specifies the host name of the machine on which the database 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":"-l dbname --database= dbname","url":"/docs/18/app-pg-dumpall.html"},"summary":"Specifies the name of the database to connect to for dumping global objects and discovering what other databases should be dumped. If not specified, the postgres database will be used, and if that does not exist, template1 will be used."},{"signature":{"text":"-p port --port= port","url":"/docs/18/app-pg-dumpall.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-pg-dumpall.html"},"summary":"User name to connect as."},{"signature":{"text":"-w --no-password","url":"/docs/18/app-pg-dumpall.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-pg-dumpall.html"},"summary":"Force pg_dumpall to prompt for a password before connecting to a database."},{"signature":{"text":"--role= rolename","url":"/docs/18/app-pg-dumpall.html"},"summary":"Specifies a role name to be used to create the dump. This option causes pg_dumpall 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_dumpall , 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":"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-pg-dumpall.html"},"summary":"只转储数据，不转储模式（数据定义）或统计信息。"},{"signature":{"text":"-c --clean","url":"/docs/18/app-pg-dumpall.html"},"summary":"在重新创建之前，输出用于 DROP 所有已转储数据库、角色和表空间的 SQL 命令。当恢复需要覆盖现有集簇时，此选项很有用。如果目标集簇中不存在某些对象，则恢复期间会报告可忽略的错误消息，除非还指定了 --if-exists 。"},{"signature":{"text":"-E encoding --encoding= encoding","url":"/docs/18/app-pg-dumpall.html"},"summary":"在指定的字符集编码中创建转储。默认情况下，转储将以数据库编码创建。（获得相同结果的另一种方法是将 PGCLIENTENCODING 环境变量设置为所需的转储编码。）"},{"signature":{"text":"-f filename --file= filename","url":"/docs/18/app-pg-dumpall.html"},"summary":"将输出发送到指定文件。如果省略此选项，则使用标准输出。"},{"signature":{"text":"-g --globals-only","url":"/docs/18/app-pg-dumpall.html"},"summary":"只转储全局对象（角色和表空间），不转储数据库。"},{"signature":{"text":"-O --no-owner","url":"/docs/18/app-pg-dumpall.html"},"summary":"不要输出用于将对象所有权设置为与原始数据库一致的命令。默认情况下， pg_dumpall 会发出 ALTER OWNER 或 SET SESSION AUTHORIZATION 语句，以设置已创建模式元素的所有权。除非该脚本由超级用户（或拥有脚本中全部对象的同一用户）启动，否则这些语句在运行时会失败。若要创建一个可由任意用户恢复、并让该用户获得所有对象所有权的脚本，请指定 -O 。"},{"signature":{"text":"-r --roles-only","url":"/docs/18/app-pg-dumpall.html"},"summary":"只转储角色，不转储数据库或表空间。"},{"signature":{"text":"-s --schema-only","url":"/docs/18/app-pg-dumpall.html"},"summary":"只转储对象定义（模式），不转储数据。"},{"signature":{"text":"-S username --superuser= username","url":"/docs/18/app-pg-dumpall.html"},"summary":"指定在禁用触发器时要使用的超级用户名。这只在使用 --disable-triggers 时相关。（通常最好省略它，而是以超级用户身份运行生成的脚本。）"},{"signature":{"text":"-t --tablespaces-only","url":"/docs/18/app-pg-dumpall.html"},"summary":"只转储表空间，不转储数据库或角色。"},{"signature":{"text":"-v --verbose","url":"/docs/18/app-pg-dumpall.html"},"summary":"指定详细模式。这会让 pg_dumpall 把开始/停止时间写入转储文件，并将进度消息输出到标准错误。重复指定该选项会使更多调试级别的消息出现在标准错误中。该选项也会传递给 pg_dump 。"},{"signature":{"text":"-V --version","url":"/docs/18/app-pg-dumpall.html"},"summary":"打印 pg_dumpall 的版本并退出。"},{"signature":{"text":"-x --no-privileges --no-acl","url":"/docs/18/app-pg-dumpall.html"},"summary":"不转储访问权限（GRANT/REVOKE 命令）。"},{"signature":{"text":"--binary-upgrade","url":"/docs/18/app-pg-dumpall.html"},"summary":"此选项供就地升级实用程序使用。不建议也不支持将其用于其他目的。该选项的行为可能在未来的版本中更改而不另行通知。"},{"signature":{"text":"--column-inserts --attribute-inserts","url":"/docs/18/app-pg-dumpall.html"},"summary":"将数据转储为带有显式列名的 INSERT 命令（ INSERT INTO table ( column , ...) VALUES ... ）。这会使恢复变得非常缓慢；它主要用于生成可以装入非 PostgreSQL 数据库的转储。"},{"signature":{"text":"--disable-dollar-quoting","url":"/docs/18/app-pg-dumpall.html"},"summary":"此选项禁用对函数体的美元引用，并强制用 SQL 标准字符串语法对它们加引号。"},{"signature":{"text":"--disable-triggers","url":"/docs/18/app-pg-dumpall.html"},"summary":"此选项只在创建包含数据但不包含模式的转储时才相关。它指示 pg_dumpall 在输出中包含一些命令，以便在恢复数据时临时禁用目标表上的触发器。如果这些表上存在不希望在数据恢复期间触发的引用完整性检查或其他触发器，请使用此选项。"},{"signature":{"text":"--exclude-database= pattern","url":"/docs/18/app-pg-dumpall.html"},"summary":"不转储名称匹配 pattern 的数据库。可以多次写 --exclude-database 开关，以排除匹配所给模式中任意一个的数据库。 pattern 参数按照 psql 的 \\d 命令所使用的同样规则解释（见 模式 ），因此也可以通过在模式中使用通配符来排除多个数据库。使用通配符时，如有需要请务必为模式加引号，以防止 shell 展开通配符。"},{"signature":{"text":"--extra-float-digits= ndigits","url":"/docs/18/app-pg-dumpall.html"},"summary":"在转储浮点数据时，使用指定的 extra_float_digits 值，而不是最大可用精度。出于备份目的的常规转储不应使用此选项。"},{"signature":{"text":"--filter= filename","url":"/docs/18/app-pg-dumpall.html"},"summary":"指定一个文件名，从中读取要从转储中排除的数据库名称的匹配模式。这些模式按照与 --exclude-database 相同的规则解释。要从 STDIN 读取，请使用 - 作为文件名。 --filter 可与 --exclude-database 结合使用以排除数据库，也可以指定多次以读取多个过滤文件。"},{"signature":{"text":"--if-exists","url":"/docs/18/app-pg-dumpall.html"},"summary":"使用 DROP ... IF EXISTS 命令在 --clean 模式下删除对象。这会抑制原本可能报告的 “ does not exist ” 错误信息。除非同时指定了 --clean ，否则此选项无效。"},{"signature":{"text":"--inserts","url":"/docs/18/app-pg-dumpall.html"},"summary":"将数据转储为 INSERT 命令（而不是 COPY ）。这会使恢复非常缓慢；它主要用于生成可以装入非 PostgreSQL 数据库的转储。注意，如果重新安排了列顺序，恢复可能会彻底失败。 --column-inserts 选项可以避免列顺序变化带来的问题，但速度更慢。"},{"signature":{"text":"--load-via-partition-root","url":"/docs/18/app-pg-dumpall.html"},"summary":"当为表分区转储数据时，让 COPY 或 INSERT 语句以包含该分区的分区层次结构根为目标，而不是以该分区本身为目标。这会导致在加载数据时为每一行重新确定适当的分区。当在另一台服务器上恢复数据，而行并不总是落在与原始服务器相同的分区中时，这可能很有用。例如，如果分区列是 text 类型，而两个系统对用于排序该分区列的排序规则定义不同，就可能发生这种情况。"},{"signature":{"text":"--lock-wait-timeout= timeout","url":"/docs/18/app-pg-dumpall.html"},"summary":"在转储开始时，不要无限等待获取共享表锁。如果无法在指定的 timeout 内锁定某个表，就让转储失败。超时可以用 SET statement_timeout 接受的任意格式指定。"},{"signature":{"text":"--no-comments","url":"/docs/18/app-pg-dumpall.html"},"summary":"不要转储 COMMENT 命令。"},{"signature":{"text":"--no-data","url":"/docs/18/app-pg-dumpall.html"},"summary":"不要转储数据。"},{"signature":{"text":"--no-policies","url":"/docs/18/app-pg-dumpall.html"},"summary":"不要转储行安全性策略。"},{"signature":{"text":"--no-publications","url":"/docs/18/app-pg-dumpall.html"},"summary":"不要转储发布。"},{"signature":{"text":"--no-role-passwords","url":"/docs/18/app-pg-dumpall.html"},"summary":"不要转储角色密码。恢复后，角色的密码值将为 null，在设置密码之前，密码认证始终会失败。由于指定此选项时不需要密码值，角色信息将从目录视图 pg_roles 而不是 pg_authid 读取。因此，如果某些安全策略限制了对 pg_authid 的访问，此选项也会有帮助。"},{"signature":{"text":"--no-schema","url":"/docs/18/app-pg-dumpall.html"},"summary":"不要转储模式（数据定义）。"},{"signature":{"text":"--no-security-labels","url":"/docs/18/app-pg-dumpall.html"},"summary":"不要转储安全标签。"},{"signature":{"text":"--no-statistics","url":"/docs/18/app-pg-dumpall.html"},"summary":"不要转储统计信息。这是默认行为。"},{"signature":{"text":"--no-subscriptions","url":"/docs/18/app-pg-dumpall.html"},"summary":"不要转储订阅。"},{"signature":{"text":"--no-sync","url":"/docs/18/app-pg-dumpall.html"},"summary":"默认情况下， pg_dumpall 会等待所有文件都被安全写入磁盘。该选项会使 pg_dumpall 立即返回而不等待，这样更快，但意味着随后如果操作系统崩溃，转储可能会损坏。通常，此选项适用于测试，但不应在从生产安装转储数据时使用。"},{"signature":{"text":"--no-table-access-method","url":"/docs/18/app-pg-dumpall.html"},"summary":"不输出用于选择表访问方法的命令。使用此选项时，所有对象在恢复时都会使用当时默认的表访问方法创建。"},{"signature":{"text":"--no-tablespaces","url":"/docs/18/app-pg-dumpall.html"},"summary":"不输出创建表空间的命令，也不输出用于为对象选择表空间的命令。使用此选项时，所有对象在恢复时都会创建在当时默认的表空间中。"},{"signature":{"text":"--no-toast-compression","url":"/docs/18/app-pg-dumpall.html"},"summary":"不输出用于设置 TOAST 压缩方法的命令。使用此选项时，所有列都会以默认压缩设置恢复。"},{"signature":{"text":"--no-unlogged-table-data","url":"/docs/18/app-pg-dumpall.html"},"summary":"不要转储不记录 WAL 的表的内容。此选项不影响是否转储表定义（模式）；它只会抑制转储表数据。"},{"signature":{"text":"--on-conflict-do-nothing","url":"/docs/18/app-pg-dumpall.html"},"summary":"为 INSERT 命令添加 ON CONFLICT DO NOTHING。此选项必须与 --inserts 或 --column-inserts 一起指定才有效。"},{"signature":{"text":"--quote-all-identifiers","url":"/docs/18/app-pg-dumpall.html"},"summary":"强制为所有标识符加引号。当从其 PostgreSQL 主版本与 pg_dumpall 不同的服务器转储数据库时，或者当输出打算装入另一主版本服务器中时，建议使用此选项。默认情况下， pg_dumpall 只会给在其自身主版本中属于保留字的标识符加引号。处理其他版本服务器时，这有时会带来兼容性问题，因为它们的保留字集合可能略有不同。使用 --quote-all-identifiers 可以避免这类问题，但代价是转储脚本更难阅读。"},{"signature":{"text":"--restrict-key= restrict_key","url":"/docs/18/app-pg-dumpall.html"},"summary":"在转储输出中，把给定字符串用作 psql 的 \\restrict 键。若未指定限制键， pg_dumpall 会按需要随机生成一个。键只能包含字母数字字符。"},{"signature":{"text":"--rows-per-insert= nrows","url":"/docs/18/app-pg-dumpall.html"},"summary":"将数据转储为 INSERT 命令（而不是 COPY ）。它控制每个 INSERT 命令的最大行数。指定的值必须是大于零的数字。恢复过程中的任何错误将导致只有属于有问题的 INSERT 的行丢失，而不是整个表的内容。"},{"signature":{"text":"--statistics","url":"/docs/18/app-pg-dumpall.html"},"summary":"转储优化器统计信息。"},{"signature":{"text":"--statistics-only","url":"/docs/18/app-pg-dumpall.html"},"summary":"只转储统计信息，不转储模式（数据定义）或数据。会转储表、物化视图、外部表和索引的优化器统计信息。"},{"signature":{"text":"--sequence-data","url":"/docs/18/app-pg-dumpall.html"},"summary":"在转储中包含序列数据。除非指定了 --no-data 、 --schema-only 或 --statistics-only ，否则这是默认行为。"},{"signature":{"text":"--use-set-session-authorization","url":"/docs/18/app-pg-dumpall.html"},"summary":"输出符合 SQL 标准的 SET SESSION AUTHORIZATION 命令，而不是用 ALTER OWNER 命令来确定对象所有权。这会让转储更符合标准，但根据转储中对象的历史，可能无法正确恢复。"},{"signature":{"text":"-? --help","url":"/docs/18/app-pg-dumpall.html"},"summary":"显示关于 pg_dumpall 命令行参数的帮助信息，并退出。"},{"signature":{"text":"-d connstr --dbname= connstr","url":"/docs/18/app-pg-dumpall.html"},"summary":"以 连接字符串 形式指定用于连接服务器的参数；这些参数将覆盖任何冲突的命令行选项。"},{"signature":{"text":"-h host --host= host","url":"/docs/18/app-pg-dumpall.html"},"summary":"指定运行数据库服务器的机器的主机名。如果该值以斜杠开头，则将其用作 Unix 域套接字的目录。默认值取自 PGHOST 环境变量（如果已设置）；否则会尝试使用 Unix 域套接字连接。"},{"signature":{"text":"-l dbname --database= dbname","url":"/docs/18/app-pg-dumpall.html"},"summary":"指定用于转储全局对象并发现还应转储哪些数据库的连接数据库名。如果未指定，则使用 postgres 数据库；如果该数据库不存在，则使用 template1 。"},{"signature":{"text":"-p port --port= port","url":"/docs/18/app-pg-dumpall.html"},"summary":"指定服务器正在监听连接的 TCP 端口，或本地 Unix 域套接字文件扩展名。默认值取自 PGPORT 环境变量（如果已设置），否则使用编译时默认值。"},{"signature":{"text":"-U username --username= username","url":"/docs/18/app-pg-dumpall.html"},"summary":"用于连接的用户名。"},{"signature":{"text":"-w --no-password","url":"/docs/18/app-pg-dumpall.html"},"summary":"绝不发出密码提示。如果服务器要求密码认证，而又无法通过 .pgpass 文件等其他方式获得密码，则连接尝试将失败。在没有用户在场输入密码的批处理作业和脚本中，此选项很有用。"},{"signature":{"text":"-W --password","url":"/docs/18/app-pg-dumpall.html"},"summary":"强制 pg_dumpall 在连接数据库之前提示输入密码。"},{"signature":{"text":"--role= rolename","url":"/docs/18/app-pg-dumpall.html"},"summary":"指定一个角色名，用于创建转储。此选项会使 pg_dumpall 在连接数据库后发出 SET ROLE rolename 命令。当已认证用户（由 -U 指定）缺少 pg_dumpall 所需权限，但可以切换到具备所需权限的角色时，这很有用。有些安装环境不允许直接以超级用户身份登录，而使用此选项可以在不违反该策略的情况下完成转储。"}],"title":"手册中的选项"},{"columns":[{"key":"name","label":"变量"},{"key":"description","label":"含义"}],"key":"environment","rows":[{"description":"默认连接参数","name":"PGHOST PGOPTIONS PGPORT PGUSER"},{"description":"指定诊断消息是否使用颜色。可选值为 always 、 auto 和 never 。","name":"PG_COLOR"}],"title":"环境变量"}],"zh_from":{"authored_translation":"source-derived-identity","body_sha256":"3ee400721ec89affbc7033f186a3b46858a6aea1627da9cc7be10a25342c2479","kind":"same-version-chinese-manual-with-source-derived-identity","manual":{"anchor":"","build_id":107,"extraction":"command-description-and-options","fragment_sha256":"8f0a2cf3fa7d8439acdc6a6cba15f6a43dd8faa8d667d8555171967d865f577e","locale":"zh-Hans","page_key":"app-pg-dumpall.html","source_hash":"510156273a6fb6db16e5039fd93d23ab41331e653a21a20bbd393c2fda1278c5","source_revision":"unknown:rendered-translation-baseline","translated_from_revision":null,"translation_revision":"git:b1b500221dbe5437cfca004d6b04d3f6e422765d;html-sha256:08e987a66af27b98444a8057c256314eafa13611a3fb9e888214fc436824244b","url":"/zh/docs/18/app-pg-dumpall.html","version":"18"},"runtime_rerun":false,"source_facts_revision":"ee8d1a3612338fd9adf250730cb640fcc5233b5491337cc00a316a44e3a0b9f8"}},"ManualEvidence":{"manual_path":"app-pg-dumpall.html","release":{"channel":"stable","evidence_kind":"English manual and source declarations","label":"18.6","major":"18","manifest":{"index":"index.html","major":"18","pages":1148,"pdf":{"A4":{"built_at":"2026-09-26","bytes":15865106,"pages":3154,"sha256":"19512c405da53f9f7fcf0abba359223aa65f021be025bf3411381918f92e3190","url":"/files/documentation/pdf/18/postgresql-18-A4.pdf"},"US":{"built_at":"2026-09-26","bytes":15748059,"pages":3328,"sha256":"facbe6c229e598b872d3d98bef53308f46e06746006fa4590de9a7de9dd46319","url":"/files/documentation/pdf/18/postgresql-18-US.pdf"}},"release":"18.6","source_mode":"en SGML built with pinned official archive","source_sha256":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f","source_url":"https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2","svg_assets":3,"tree":"18"},"ref":"https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2","revision":"ee8d1a3612338fd9adf250730cb640fcc5233b5491337cc00a316a44e3a0b9f8","source_sha256":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f"},"sources":[{"anchor":"","file":"app-pg-dumpall.html","label":"18.6 English manual · app-pg-dumpall.html","sha256":"5f64e2921cefa4823764e46860b95e0f5f7568192670220a0bac10314c740683","url":"/docs/18/app-pg-dumpall.html"},{"anchor":"","file":"reference-client.html","label":"Client applications inventory","sha256":"68f726af77272fe73a827be2b7b5958d0f2239a6f8ed44264e9d42496bfa4fd0","url":"/docs/18/reference-client.html"}]},"MeasuredEvidence":{}},"Text":{"Collection":"tool","Key":"pg-dumpall","SourceDatabase":"center","Version":"18","Locale":"en","Title":"pg_dumpall","Summary":"pg_dumpall — extract a PostgreSQL database cluster into a script file","BodyHTML":"\u003cdiv\u003e\u003cdiv id=\"APP-PG-DUMPALL\"\u003e\n\u003cdiv\u003e\u003c/div\u003e\n\u003cdiv\u003e\n\u003ch2\u003e\u003cspan\u003e\u003cspan\u003epg_dumpall\u003c/span\u003e\u003c/span\u003e\u003c/h2\u003e\n\u003cp\u003epg_dumpall — extract a \u003cspan\u003ePostgreSQL\u003c/span\u003e database cluster into a script file\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv\u003e\n\u003ch2\u003eSynopsis\u003c/h2\u003e\n\u003cdiv\u003e\n\u003cp id=\"id-1.9.4.15.4.1\"\u003e\u003ccode\u003epg_dumpall\u003c/code\u003e [\u003cem\u003e\u003ccode\u003econnection-option\u003c/code\u003e\u003c/em\u003e...] [\u003cem\u003e\u003ccode\u003eoption\u003c/code\u003e\u003c/em\u003e...]\u003c/p\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cdiv id=\"APP-PG-DUMPALL-DESCRIPTION\"\u003e\n\u003ch2\u003eDescription\u003c/h2\u003e\n\u003cp\u003e\u003cspan\u003epg_dumpall\u003c/span\u003e is a utility for writing out (\u003cspan\u003e“\u003cspan\u003edumping\u003c/span\u003e”\u003c/span\u003e) all \u003cspan\u003ePostgreSQL\u003c/span\u003e databases of a cluster into one script file. The script file contains SQL commands that can be used as input 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 to restore the databases. It does this by calling \u003ca href=\"/docs/18/app-pgdump.html\" title=\"pg_dump\" rel=\"nofollow\"\u003e\u003cspan\u003e\u003cspan\u003epg_dump\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e for each database in the cluster. \u003cspan\u003epg_dumpall\u003c/span\u003e also dumps global objects that are common to all databases, namely database roles, tablespaces, and privilege grants for configuration parameters. (\u003cspan\u003epg_dump\u003c/span\u003e does not save these objects.)\u003c/p\u003e\n\u003cp\u003eSince \u003cspan\u003epg_dumpall\u003c/span\u003e reads tables from all databases you will most likely have to connect as a database superuser in order to produce a complete dump. Also you will need superuser privileges to execute the saved script in order to be allowed to add roles and create databases.\u003c/p\u003e\n\u003cp\u003eThe SQL script will be written to the standard output. Use the \u003ccode\u003e-f\u003c/code\u003e/\u003ccode\u003e--file\u003c/code\u003e option or shell operators to redirect it into a file.\u003c/p\u003e\n\u003cp\u003e\u003cspan\u003epg_dumpall\u003c/span\u003e needs to connect several times to the \u003cspan\u003ePostgreSQL\u003c/span\u003e server (once per database). If you use password authentication it will ask for a password each time. It is convenient to have a \u003ccode\u003e~/.pgpass\u003c/code\u003e file in such cases. See \u003ca href=\"/docs/18/libpq-pgpass.html\" rel=\"nofollow\"\u003eSection 32.16\u003c/a\u003e for more information.\u003c/p\u003e\n\u003cdiv\u003e\n\u003ch3\u003eWarning\u003c/h3\u003e\n\u003cp\u003eRestoring a dump causes the destination to execute arbitrary code of the source superusers\u0026#39; choice. Partial dumps and partial restores do not limit that. If the source superusers are not trusted, the dumped SQL statements must be inspected before restoring. Note that the client running the dump and restore need not trust the source or destination superusers.\u003c/p\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cdiv id=\"id-1.9.4.15.6\"\u003e\n\u003ch2\u003eOptions\u003c/h2\u003e\n\u003cp\u003eThe following command-line options control the content and format of the output.\u003c/p\u003e\n\u003cdiv\u003e\n\u003cdl\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-a\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--data-only\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDump only the data, not the schema (data definitions) or statistics.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-c\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--clean\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eEmit SQL commands to \u003ccode\u003eDROP\u003c/code\u003e all the dumped databases, roles, and tablespaces before recreating them. This option is useful when the restore is to overwrite an existing cluster. If any of the objects do not exist in the destination cluster, ignorable error messages will be reported during restore, unless \u003ccode\u003e--if-exists\u003c/code\u003e is also specified.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-E \u003cem\u003e\u003ccode\u003eencoding\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--encoding=\u003cem\u003e\u003ccode\u003eencoding\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eCreate the dump in the specified character set encoding. By default, the dump is created in the database encoding. (Another way to get the same result is to set the \u003ccode\u003ePGCLIENTENCODING\u003c/code\u003e environment variable to the desired dump encoding.)\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-f \u003cem\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--file=\u003cem\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSend output to the specified file. If this is omitted, the standard output is used.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-g\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--globals-only\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDump only global objects (roles and tablespaces), no databases.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-O\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--no-owner\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not output commands to set ownership of objects to match the original database. By default, \u003cspan\u003epg_dumpall\u003c/span\u003e issues \u003ccode\u003eALTER OWNER\u003c/code\u003e or \u003ccode\u003eSET SESSION AUTHORIZATION\u003c/code\u003e statements to set ownership of created schema elements. These statements will fail when the script is run unless it is started by a superuser (or the same user that owns all of the objects in the script). To make a script that can be restored by any user, but will give that user ownership of all the objects, specify \u003ccode\u003e-O\u003c/code\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-r\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--roles-only\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDump only roles, no databases or tablespaces.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-s\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--schema-only\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDump only the object definitions (schema), not data.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-S \u003cem\u003e\u003ccode\u003eusername\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--superuser=\u003cem\u003e\u003ccode\u003eusername\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecify the superuser user name to use when disabling triggers. This is relevant only if \u003ccode\u003e--disable-triggers\u003c/code\u003e is used. (Usually, it\u0026#39;s better to leave this out, and instead start the resulting script as superuser.)\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-t\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--tablespaces-only\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDump only tablespaces, no databases or roles.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-v\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--verbose\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies verbose mode. This will cause \u003cspan\u003epg_dumpall\u003c/span\u003e to output 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. The option is also passed down to \u003cspan\u003epg_dump\u003c/span\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-V\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--version\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003ePrint the \u003cspan\u003epg_dumpall\u003c/span\u003e version and exit.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-x\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--no-privileges\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--no-acl\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003ePrevent dumping of access privileges (grant/revoke commands).\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--binary-upgrade\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThis option is for use by in-place upgrade utilities. Its use for other purposes is not recommended or supported. The behavior of the option may change in future releases without notice.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--column-inserts\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--attribute-inserts\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDump data as \u003ccode\u003eINSERT\u003c/code\u003e commands with explicit column names (\u003ccode\u003eINSERT INTO \u003cem\u003e\u003ccode\u003etable\u003c/code\u003e\u003c/em\u003e (\u003cem\u003e\u003ccode\u003ecolumn\u003c/code\u003e\u003c/em\u003e, ...) VALUES ...\u003c/code\u003e). This will make restoration very slow; it is mainly useful for making dumps that can be loaded into non-\u003cspan\u003ePostgreSQL\u003c/span\u003e databases.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--disable-dollar-quoting\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThis option disables the use of dollar quoting for function bodies, and forces them to be quoted using SQL standard string syntax.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--disable-triggers\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThis option is relevant only when creating a dump with data and without schema. It instructs \u003cspan\u003epg_dumpall\u003c/span\u003e to include commands to temporarily disable triggers on the target tables while the data is restored. Use this if you have referential integrity checks or other triggers on the tables that you do not want to invoke during data restore.\u003c/p\u003e\n\u003cp\u003ePresently, the commands emitted for \u003ccode\u003e--disable-triggers\u003c/code\u003e must be done as superuser. So, you should also specify a superuser name with \u003ccode\u003e-S\u003c/code\u003e, or preferably be careful to start the resulting script as a superuser.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--exclude-database=\u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not dump databases whose name matches \u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e. Multiple patterns can be excluded by writing multiple \u003ccode\u003e--exclude-database\u003c/code\u003e switches. The \u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e parameter is interpreted as a pattern according to the same rules used by \u003cspan\u003epsql\u003c/span\u003e\u0026#39;s \u003ccode\u003e\\d\u003c/code\u003e commands (see \u003ca href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\" rel=\"nofollow\"\u003ePatterns\u003c/a\u003e), so multiple databases can also be excluded by writing wildcard characters in the pattern. When using wildcards, be careful to quote the pattern if needed to prevent shell wildcard expansion.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--extra-float-digits=\u003cem\u003e\u003ccode\u003endigits\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eUse the specified value of 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.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--filter=\u003cem\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecify a filename from which to read patterns for databases excluded from the dump. The patterns are interpreted according to the same rules as \u003ccode\u003e--exclude-database\u003c/code\u003e. To read from \u003ccode\u003eSTDIN\u003c/code\u003e, use \u003ccode\u003e-\u003c/code\u003e as the filename. The \u003ccode\u003e--filter\u003c/code\u003e option can be specified in conjunction with \u003ccode\u003e--exclude-database\u003c/code\u003e for excluding databases, and can also be specified more than once for multiple filter files.\u003c/p\u003e\n\u003cp\u003eThe file lists one database pattern per row, with the following format:\u003c/p\u003e\n\u003cpre\u003eexclude database \u003cem\u003e\u003ccode\u003ePATTERN\u003c/code\u003e\u003c/em\u003e\n\u003c/pre\u003e\n\u003cp\u003eLines starting with \u003ccode\u003e#\u003c/code\u003e are considered comments and ignored. Comments can be placed after an object pattern row as well. Blank lines are also ignored. See \u003ca href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\" rel=\"nofollow\"\u003ePatterns\u003c/a\u003e for how to perform quoting in patterns.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--if-exists\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eUse \u003ccode\u003eDROP ... IF EXISTS\u003c/code\u003e commands to drop objects in \u003ccode\u003e--clean\u003c/code\u003e mode. This suppresses \u003cspan\u003e“\u003cspan\u003edoes not exist\u003c/span\u003e”\u003c/span\u003e errors that might otherwise be reported. This option is not valid unless \u003ccode\u003e--clean\u003c/code\u003e is also specified.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--inserts\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDump data as \u003ccode\u003eINSERT\u003c/code\u003e commands (rather than \u003ccode\u003eCOPY\u003c/code\u003e). This will make restoration very slow; it is mainly useful for making dumps that can be loaded into non-\u003cspan\u003ePostgreSQL\u003c/span\u003e databases. Note that the restore might fail altogether if you have rearranged column order. The \u003ccode\u003e--column-inserts\u003c/code\u003e option is safer, though even slower.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--load-via-partition-root\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eWhen dumping data for a table partition, make the \u003ccode\u003eCOPY\u003c/code\u003e or \u003ccode\u003eINSERT\u003c/code\u003e statements target the root of the partitioning hierarchy that contains it, rather than the partition itself. This causes the appropriate partition to be re-determined for each row when the data is loaded. This may be useful when restoring data on a server where rows do not always fall into the same partitions as they did on the original server. That could happen, for example, if the partitioning column is of type text and the two systems have different definitions of the collation used to sort the partitioning column.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--lock-wait-timeout=\u003cem\u003e\u003ccode\u003etimeout\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not wait forever to acquire shared table locks at the beginning of the dump. Instead, fail if unable to lock a table within the specified \u003cem\u003e\u003ccode\u003etimeout\u003c/code\u003e\u003c/em\u003e. The timeout may be specified in any of the formats accepted by \u003ccode\u003eSET statement_timeout\u003c/code\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--no-comments\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not dump \u003ccode\u003eCOMMENT\u003c/code\u003e commands.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--no-data\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not dump data.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--no-policies\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not dump row security policies.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--no-publications\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not dump publications.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--no-role-passwords\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not dump passwords for roles. When restored, roles will have a null password, and password authentication will always fail until the password is set. Since password values aren\u0026#39;t needed when this option is specified, the role information is read from the catalog view \u003ccode\u003epg_roles\u003c/code\u003e instead of \u003ccode\u003epg_authid\u003c/code\u003e. Therefore, this option also helps if access to \u003ccode\u003epg_authid\u003c/code\u003e is restricted by some security policy.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--no-schema\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not dump schema (data definitions).\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--no-security-labels\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not dump security labels.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--no-statistics\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not dump statistics. This is the default.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--no-subscriptions\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not dump subscriptions.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--no-sync\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eBy default, \u003ccode\u003epg_dumpall\u003c/code\u003e will wait for all files to be written safely to disk. This option causes \u003ccode\u003epg_dumpall\u003c/code\u003e to return without waiting, which is faster, but means that a subsequent operating system crash can leave the dump corrupt. Generally, this option is useful for testing but should not be used when dumping data from production installation.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--no-table-access-method\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not output commands to select table access methods. With this option, all objects will be created with whichever table access method is the default during restore.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--no-tablespaces\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not output commands to create tablespaces nor select tablespaces for objects. With this option, all objects will be created in whichever tablespace is the default during restore.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--no-toast-compression\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not output commands to set TOAST compression methods. With this option, all columns will be restored with the default compression setting.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--no-unlogged-table-data\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not dump the contents of unlogged tables. This option has no effect on whether or not the table definitions (schema) are dumped; it only suppresses dumping the table data.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--on-conflict-do-nothing\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eAdd \u003ccode\u003eON CONFLICT DO NOTHING\u003c/code\u003e to \u003ccode\u003eINSERT\u003c/code\u003e commands. This option is not valid unless \u003ccode\u003e--inserts\u003c/code\u003e or \u003ccode\u003e--column-inserts\u003c/code\u003e is also specified.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--quote-all-identifiers\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eForce quoting of all identifiers. This option is recommended when dumping a database from a server whose \u003cspan\u003ePostgreSQL\u003c/span\u003e major version is different from \u003cspan\u003epg_dumpall\u003c/span\u003e\u0026#39;s, or when the output is intended to be loaded into a server of a different major version. By default, \u003cspan\u003epg_dumpall\u003c/span\u003e quotes only identifiers that are reserved words in its own major version. This sometimes results in compatibility issues when dealing with servers of other versions that may have slightly different sets of reserved words. Using \u003ccode\u003e--quote-all-identifiers\u003c/code\u003e prevents such issues, at the price of a harder-to-read dump script.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--restrict-key=\u003cem\u003e\u003ccode\u003erestrict_key\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eUse the provided string as the \u003cspan\u003epsql\u003c/span\u003e \u003ccode\u003e\\restrict\u003c/code\u003e key in the dump output. If no restrict key is specified, \u003cspan\u003epg_dumpall\u003c/span\u003e will generate a random one as needed. Keys may contain only alphanumeric characters.\u003c/p\u003e\n\u003cp\u003eThis option is primarily intended for testing purposes and other scenarios that require repeatable output (e.g., comparing dump files). It is not recommended for general use, as a malicious server with advance knowledge of the key may be able to inject arbitrary code that will be executed on the machine that runs \u003cspan\u003epsql\u003c/span\u003e with the dump output.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--rows-per-insert=\u003cem\u003e\u003ccode\u003enrows\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDump data as \u003ccode\u003eINSERT\u003c/code\u003e commands (rather than \u003ccode\u003eCOPY\u003c/code\u003e). Controls the maximum number of rows per \u003ccode\u003eINSERT\u003c/code\u003e command. The value specified must be a number greater than zero. Any error during restoring will cause only rows that are part of the problematic \u003ccode\u003eINSERT\u003c/code\u003e to be lost, rather than the entire table contents.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--statistics\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDump optimizer statistics.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--statistics-only\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDump only the statistics, not the schema (data definitions) or data. Optimizer statistics for tables, materialized views, foreign tables, and indexes are dumped.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--sequence-data\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eInclude sequence data in the dump. This is the default behavior except when \u003ccode\u003e--no-data\u003c/code\u003e, \u003ccode\u003e--schema-only\u003c/code\u003e, or \u003ccode\u003e--statistics-only\u003c/code\u003e is specified.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--use-set-session-authorization\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eOutput SQL-standard \u003ccode\u003eSET SESSION AUTHORIZATION\u003c/code\u003e commands instead of \u003ccode\u003eALTER OWNER\u003c/code\u003e commands to determine object ownership. This makes the dump more standards compatible, but depending on the history of the objects in the dump, might not restore properly.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-?\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--help\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eShow help about \u003cspan\u003epg_dumpall\u003c/span\u003e command line arguments, and exit.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003cp\u003eThe following command-line options control the database connection parameters.\u003c/p\u003e\n\u003cdiv\u003e\n\u003cdl\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-d \u003cem\u003e\u003ccode\u003econnstr\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--dbname=\u003cem\u003e\u003ccode\u003econnstr\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies parameters used to connect to the server, as a \u003ca href=\"/docs/18/libpq-connect.html#LIBPQ-CONNSTRING\" rel=\"nofollow\"\u003econnection string\u003c/a\u003e; these will override any conflicting command line options.\u003c/p\u003e\n\u003cp\u003eThe option is called \u003ccode\u003e--dbname\u003c/code\u003e for consistency with other client applications, but because \u003cspan\u003epg_dumpall\u003c/span\u003e needs to connect to many databases, the database name in the connection string will be ignored. Use the \u003ccode\u003e-l\u003c/code\u003e option to specify the name of the database used for the initial connection, which will dump global objects and discover what other databases should be dumped.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-h \u003cem\u003e\u003ccode\u003ehost\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--host=\u003cem\u003e\u003ccode\u003ehost\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the host name of the machine on which the database server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket. The default is taken from the \u003ccode\u003ePGHOST\u003c/code\u003e environment variable, if set, else a Unix domain socket connection is attempted.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-l \u003cem\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--database=\u003cem\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the name of the database to connect to for dumping global objects and discovering what other databases should be dumped. If not specified, the \u003ccode\u003epostgres\u003c/code\u003e database will be used, and if that does not exist, \u003ccode\u003etemplate1\u003c/code\u003e will be used.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-p \u003cem\u003e\u003ccode\u003eport\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--port=\u003cem\u003e\u003ccode\u003eport\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the \u003ccode\u003ePGPORT\u003c/code\u003e environment variable, if set, or a compiled-in default.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-U \u003cem\u003e\u003ccode\u003eusername\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--username=\u003cem\u003e\u003ccode\u003eusername\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eUser name to connect as.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-w\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--no-password\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eNever issue a password prompt. If the server requires password authentication and a password is not available by other means such as a \u003ccode\u003e.pgpass\u003c/code\u003e file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-W\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--password\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eForce \u003cspan\u003epg_dumpall\u003c/span\u003e to prompt for a password before connecting to a database.\u003c/p\u003e\n\u003cp\u003eThis option is never essential, since \u003cspan\u003epg_dumpall\u003c/span\u003e will automatically prompt for a password if the server demands password authentication. However, \u003cspan\u003epg_dumpall\u003c/span\u003e will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing \u003ccode\u003e-W\u003c/code\u003e to avoid the extra connection attempt.\u003c/p\u003e\n\u003cp\u003eNote that the password prompt will occur again for each database to be dumped. Usually, it\u0026#39;s better to set up a \u003ccode\u003e~/.pgpass\u003c/code\u003e file than to rely on manual password entry.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--role=\u003cem\u003e\u003ccode\u003erolename\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies a role name to be used to create the dump. This option causes \u003cspan\u003epg_dumpall\u003c/span\u003e to issue a \u003ccode\u003eSET ROLE\u003c/code\u003e \u003cem\u003e\u003ccode\u003erolename\u003c/code\u003e\u003c/em\u003e command after connecting to the database. It is useful when the authenticated user (specified by \u003ccode\u003e-U\u003c/code\u003e) lacks privileges needed by \u003cspan\u003epg_dumpall\u003c/span\u003e, but can switch to a role with the required rights. Some installations have a policy against logging in directly as a superuser, and use of this option allows dumps to be made without violating the policy.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cdiv id=\"id-1.9.4.15.7\"\u003e\n\u003ch2\u003eEnvironment\u003c/h2\u003e\n\u003cdiv\u003e\n\u003cdl\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003ePGHOST\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003ePGOPTIONS\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003ePGPORT\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003ePGUSER\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDefault connection parameters\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003ePG_COLOR\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies whether to use color in diagnostic messages. Possible values are \u003ccode\u003ealways\u003c/code\u003e, \u003ccode\u003eauto\u003c/code\u003e and \u003ccode\u003enever\u003c/code\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003cp\u003eThis utility, like most other \u003cspan\u003ePostgreSQL\u003c/span\u003e utilities, also uses the environment variables supported by \u003cspan\u003elibpq\u003c/span\u003e (see \u003ca href=\"/docs/18/libpq-envars.html\" rel=\"nofollow\"\u003eSection 32.15\u003c/a\u003e).\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv id=\"id-1.9.4.15.8\"\u003e\n\u003ch2\u003eNotes\u003c/h2\u003e\n\u003cp\u003eSince \u003cspan\u003epg_dumpall\u003c/span\u003e calls \u003cspan\u003epg_dump\u003c/span\u003e internally, some diagnostic messages will refer to \u003cspan\u003epg_dump\u003c/span\u003e.\u003c/p\u003e\n\u003cp\u003eThe \u003ccode\u003e--clean\u003c/code\u003e option can be useful even when your intention is to restore the dump script into a fresh cluster. Use of \u003ccode\u003e--clean\u003c/code\u003e authorizes the script to drop and re-create the built-in \u003ccode\u003epostgres\u003c/code\u003e and \u003ccode\u003etemplate1\u003c/code\u003e databases, ensuring that those databases will retain the same properties (for instance, locale and encoding) that they had in the source cluster. Without the option, those databases will retain their existing database-level properties, as well as any pre-existing contents.\u003c/p\u003e\n\u003cp\u003eWhen \u003ccode\u003e--statistics\u003c/code\u003e is specified, \u003ccode\u003epg_dumpall\u003c/code\u003e will include most optimizer statistics in the resulting dump file. This does not include all statistics, such as those created explicitly with \u003ca href=\"/docs/18/sql-createstatistics.html\" title=\"CREATE STATISTICS\" rel=\"nofollow\"\u003e\u003cspan\u003eCREATE STATISTICS\u003c/span\u003e\u003c/a\u003e, custom statistics added by an extension, or statistics collected by the cumulative statistics system. Therefore, it may still be useful to run \u003ccode\u003eANALYZE\u003c/code\u003e on each database after restoring from a dump file to ensure optimal performance. You can also run \u003ccode\u003evacuumdb -a -z\u003c/code\u003e to analyze all databases.\u003c/p\u003e\n\u003cp\u003eThe dump script should not be expected to run completely without errors. In particular, because the script will issue \u003ccode\u003eCREATE ROLE\u003c/code\u003e for every role existing in the source cluster, it is certain to get a \u003cspan\u003e“\u003cspan\u003erole already exists\u003c/span\u003e”\u003c/span\u003e error for the bootstrap superuser, unless the destination cluster was initialized with a different bootstrap superuser name. This error is harmless and should be ignored. Use of the \u003ccode\u003e--clean\u003c/code\u003e option is likely to produce additional harmless error messages about non-existent objects, although you can minimize those by adding \u003ccode\u003e--if-exists\u003c/code\u003e.\u003c/p\u003e\n\u003cp\u003e\u003cspan\u003epg_dumpall\u003c/span\u003e requires all needed tablespace directories to exist before the restore; otherwise, database creation will fail for databases in non-default locations.\u003c/p\u003e\n\u003cp\u003eIt is generally recommended to use the \u003ccode\u003e-X\u003c/code\u003e (\u003ccode\u003e--no-psqlrc\u003c/code\u003e) option when restoring a database from a \u003cspan\u003epg_dumpall\u003c/span\u003e script to ensure a clean restore process and prevent potential conflicts with non-default \u003cspan\u003epsql\u003c/span\u003e configurations. Additionally, because the \u003cspan\u003epg_dumpall\u003c/span\u003e script may include \u003cspan\u003epsql\u003c/span\u003e meta-commands, it may be incompatible with clients other than \u003cspan\u003epsql\u003c/span\u003e.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv id=\"APP-PG-DUMPALL-EX\"\u003e\n\u003ch2\u003eExamples\u003c/h2\u003e\n\u003cp\u003eTo dump all databases:\u003c/p\u003e\n\u003cpre\u003e\u003ccode\u003e$\u003c/code\u003e \u003cstrong\u003e\u003ccode\u003epg_dumpall \u0026gt; db.out\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\n\u003cp\u003eTo restore database(s) from this file, you can use:\u003c/p\u003e\n\u003cpre\u003e\u003ccode\u003e$\u003c/code\u003e \u003cstrong\u003e\u003ccode\u003epsql -X -f db.out -d postgres\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\n\u003cp\u003eIt is not important which database you connect to here since the script file created by \u003cspan\u003epg_dumpall\u003c/span\u003e will contain the appropriate commands to create and connect to the saved databases. An exception is that if you specified \u003ccode\u003e--clean\u003c/code\u003e, you must connect to the \u003ccode\u003epostgres\u003c/code\u003e database initially; the script will attempt to drop other databases immediately, and that will fail for the database you are connected to.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv id=\"id-1.9.4.15.10\"\u003e\n\u003ch2\u003eSee Also\u003c/h2\u003e\n\u003cp\u003eCheck \u003ca href=\"/docs/18/app-pgdump.html\" title=\"pg_dump\" rel=\"nofollow\"\u003e\u003cspan\u003e\u003cspan\u003epg_dump\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e for details on possible error conditions.\u003c/p\u003e\n\u003c/div\u003e\n\u003c/div\u003e\u003c/div\u003e","SourceRevision":"ee8d1a3612338fd9adf250730cb640fcc5233b5491337cc00a316a44e3a0b9f8","ContentHash":"0431e1500a448f45b9043943fc061267f0c7947009f55a931788af6ac4caea31","Payload":{"description":["pg_dumpall — extract a PostgreSQL database cluster into a script file"],"manual_html":"\u003cdiv\u003e\u003cdiv class=\"refentry\" id=\"APP-PG-DUMPALL\"\u003e\n\u003cdiv class=\"titlepage\"\u003e\u003c/div\u003e\n\u003cdiv class=\"refnamediv\"\u003e\n\u003ch2\u003e\u003cspan class=\"refentrytitle\"\u003e\u003cspan class=\"application\"\u003epg_dumpall\u003c/span\u003e\u003c/span\u003e\u003c/h2\u003e\n\u003cp\u003epg_dumpall — extract a \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e database cluster into a script file\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsynopsisdiv\"\u003e\n\u003ch2\u003eSynopsis\u003c/h2\u003e\n\u003cdiv class=\"cmdsynopsis\"\u003e\n\u003cp id=\"id-1.9.4.15.4.1\"\u003e\u003ccode class=\"command\"\u003epg_dumpall\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...]\u003c/p\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"APP-PG-DUMPALL-DESCRIPTION\"\u003e\n\u003ch2\u003eDescription\u003c/h2\u003e\n\u003cp\u003e\u003cspan class=\"application\"\u003epg_dumpall\u003c/span\u003e is a utility for writing out (\u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003edumping\u003c/span\u003e”\u003c/span\u003e) all \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e databases of a cluster into one script file. The script file contains SQL commands that can be used as input 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 to restore the databases. It does this by calling \u003ca class=\"xref\" href=\"/docs/18/app-pgdump.html\" title=\"pg_dump\"\u003e\u003cspan class=\"refentrytitle\"\u003e\u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e for each database in the cluster. \u003cspan class=\"application\"\u003epg_dumpall\u003c/span\u003e also dumps global objects that are common to all databases, namely database roles, tablespaces, and privilege grants for configuration parameters. (\u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e does not save these objects.)\u003c/p\u003e\n\u003cp\u003eSince \u003cspan class=\"application\"\u003epg_dumpall\u003c/span\u003e reads tables from all databases you will most likely have to connect as a database superuser in order to produce a complete dump. Also you will need superuser privileges to execute the saved script in order to be allowed to add roles and create databases.\u003c/p\u003e\n\u003cp\u003eThe SQL script will be written to the standard output. Use the \u003ccode class=\"option\"\u003e-f\u003c/code\u003e/\u003ccode class=\"option\"\u003e--file\u003c/code\u003e option or shell operators to redirect it into a file.\u003c/p\u003e\n\u003cp\u003e\u003cspan class=\"application\"\u003epg_dumpall\u003c/span\u003e needs to connect several times to the \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e server (once per database). If you use password authentication it will ask for a password each time. It is convenient to have a \u003ccode class=\"filename\"\u003e~/.pgpass\u003c/code\u003e file in such cases. See \u003ca class=\"xref\" href=\"/docs/18/libpq-pgpass.html\" title=\"32.16. The Password File\"\u003eSection 32.16\u003c/a\u003e for more information.\u003c/p\u003e\n\u003cdiv class=\"warning\"\u003e\n\u003ch3 class=\"title\"\u003eWarning\u003c/h3\u003e\n\u003cp\u003eRestoring a dump causes the destination to execute arbitrary code of the source superusers' choice. Partial dumps and partial restores do not limit that. If the source superusers are not trusted, the dumped SQL statements must be inspected before restoring. Note that the client running the dump and restore need not trust the source or destination superusers.\u003c/p\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"id-1.9.4.15.6\"\u003e\n\u003ch2\u003eOptions\u003c/h2\u003e\n\u003cp\u003eThe following command-line options control the content and format of the output.\u003c/p\u003e\n\u003cdiv class=\"variablelist\"\u003e\n\u003cdl class=\"variablelist\"\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-a\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--data-only\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDump only the data, not the schema (data definitions) or statistics.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-c\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--clean\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eEmit SQL commands to \u003ccode class=\"command\"\u003eDROP\u003c/code\u003e all the dumped databases, roles, and tablespaces before recreating them. This option is useful when the restore is to overwrite an existing cluster. If any of the objects do not exist in the destination cluster, ignorable error messages will be reported during restore, unless \u003ccode class=\"option\"\u003e--if-exists\u003c/code\u003e is also specified.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-E \u003cem class=\"replaceable\"\u003e\u003ccode\u003eencoding\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--encoding=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eencoding\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eCreate the dump in the specified character set encoding. By default, the dump is created in the database encoding. (Another way to get the same result is to set the \u003ccode class=\"envar\"\u003ePGCLIENTENCODING\u003c/code\u003e environment variable to the desired dump encoding.)\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-f \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\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\u003efilename\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSend output to the specified file. If this is omitted, the standard output is used.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-g\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--globals-only\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDump only global objects (roles and tablespaces), no databases.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-O\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-owner\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not output commands to set ownership of objects to match the original database. By default, \u003cspan class=\"application\"\u003epg_dumpall\u003c/span\u003e issues \u003ccode class=\"command\"\u003eALTER OWNER\u003c/code\u003e or \u003ccode class=\"command\"\u003eSET SESSION AUTHORIZATION\u003c/code\u003e statements to set ownership of created schema elements. These statements will fail when the script is run unless it is started by a superuser (or the same user that owns all of the objects in the script). To make a script that can be restored by any user, but will give that user ownership of all the objects, specify \u003ccode class=\"option\"\u003e-O\u003c/code\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-r\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--roles-only\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDump only roles, no databases or tablespaces.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-s\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--schema-only\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDump only the object definitions (schema), not data.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-S \u003cem class=\"replaceable\"\u003e\u003ccode\u003eusername\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--superuser=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eusername\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecify the superuser user name to use when disabling triggers. This is relevant only if \u003ccode class=\"option\"\u003e--disable-triggers\u003c/code\u003e is used. (Usually, it's better to leave this out, and instead start the resulting script as superuser.)\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-t\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--tablespaces-only\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDump only tablespaces, no databases or roles.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-v\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--verbose\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies verbose mode. This will cause \u003cspan class=\"application\"\u003epg_dumpall\u003c/span\u003e to output 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. The option is also passed down to \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-V\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--version\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003ePrint the \u003cspan class=\"application\"\u003epg_dumpall\u003c/span\u003e version and exit.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-x\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-privileges\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-acl\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003ePrevent dumping of access privileges (grant/revoke commands).\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--binary-upgrade\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThis option is for use by in-place upgrade utilities. Its use for other purposes is not recommended or supported. The behavior of the option may change in future releases without notice.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--column-inserts\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--attribute-inserts\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDump data as \u003ccode class=\"command\"\u003eINSERT\u003c/code\u003e commands with explicit column names (\u003ccode class=\"literal\"\u003eINSERT INTO \u003cem class=\"replaceable\"\u003e\u003ccode\u003etable\u003c/code\u003e\u003c/em\u003e (\u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolumn\u003c/code\u003e\u003c/em\u003e, ...) VALUES ...\u003c/code\u003e). This will make restoration very slow; it is mainly useful for making dumps that can be loaded into non-\u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e databases.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--disable-dollar-quoting\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThis option disables the use of dollar quoting for function bodies, and forces them to be quoted using SQL standard string syntax.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--disable-triggers\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThis option is relevant only when creating a dump with data and without schema. It instructs \u003cspan class=\"application\"\u003epg_dumpall\u003c/span\u003e to include commands to temporarily disable triggers on the target tables while the data is restored. Use this if you have referential integrity checks or other triggers on the tables that you do not want to invoke during data restore.\u003c/p\u003e\n\u003cp\u003ePresently, the commands emitted for \u003ccode class=\"option\"\u003e--disable-triggers\u003c/code\u003e must be done as superuser. So, you should also specify a superuser name with \u003ccode class=\"option\"\u003e-S\u003c/code\u003e, or preferably be careful to start the resulting script as a superuser.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--exclude-database=\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not dump databases whose name matches \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e. Multiple patterns can be excluded by writing multiple \u003ccode class=\"option\"\u003e--exclude-database\u003c/code\u003e switches. The \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e parameter is interpreted as a pattern according to the same rules used by \u003cspan class=\"application\"\u003epsql\u003c/span\u003e's \u003ccode class=\"literal\"\u003e\\d\u003c/code\u003e commands (see \u003ca class=\"xref\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003ePatterns\u003c/a\u003e), so multiple databases can also be excluded by writing wildcard characters in the pattern. When using wildcards, be careful to quote the pattern if needed to prevent shell wildcard expansion.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--extra-float-digits=\u003cem class=\"replaceable\"\u003e\u003ccode\u003endigits\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eUse the specified value of 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.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--filter=\u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecify a filename from which to read patterns for databases excluded from the dump. The patterns are interpreted according to the same rules as \u003ccode class=\"option\"\u003e--exclude-database\u003c/code\u003e. To read from \u003ccode class=\"literal\"\u003eSTDIN\u003c/code\u003e, use \u003ccode class=\"filename\"\u003e-\u003c/code\u003e as the filename. The \u003ccode class=\"option\"\u003e--filter\u003c/code\u003e option can be specified in conjunction with \u003ccode class=\"option\"\u003e--exclude-database\u003c/code\u003e for excluding databases, and can also be specified more than once for multiple filter files.\u003c/p\u003e\n\u003cp\u003eThe file lists one database pattern per row, with the following format:\u003c/p\u003e\n\u003cpre class=\"synopsis\"\u003eexclude database \u003cem class=\"replaceable\"\u003e\u003ccode\u003ePATTERN\u003c/code\u003e\u003c/em\u003e\n\u003c/pre\u003e\n\u003cp\u003eLines starting with \u003ccode class=\"literal\"\u003e#\u003c/code\u003e are considered comments and ignored. Comments can be placed after an object pattern row as well. Blank lines are also ignored. See \u003ca class=\"xref\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003ePatterns\u003c/a\u003e for how to perform quoting in patterns.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--if-exists\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eUse \u003ccode class=\"literal\"\u003eDROP ... IF EXISTS\u003c/code\u003e commands to drop objects in \u003ccode class=\"option\"\u003e--clean\u003c/code\u003e mode. This suppresses \u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003edoes not exist\u003c/span\u003e”\u003c/span\u003e errors that might otherwise be reported. This option is not valid unless \u003ccode class=\"option\"\u003e--clean\u003c/code\u003e is also specified.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--inserts\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDump data as \u003ccode class=\"command\"\u003eINSERT\u003c/code\u003e commands (rather than \u003ccode class=\"command\"\u003eCOPY\u003c/code\u003e). This will make restoration very slow; it is mainly useful for making dumps that can be loaded into non-\u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e databases. Note that the restore might fail altogether if you have rearranged column order. The \u003ccode class=\"option\"\u003e--column-inserts\u003c/code\u003e option is safer, though even slower.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--load-via-partition-root\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eWhen dumping data for a table partition, make the \u003ccode class=\"command\"\u003eCOPY\u003c/code\u003e or \u003ccode class=\"command\"\u003eINSERT\u003c/code\u003e statements target the root of the partitioning hierarchy that contains it, rather than the partition itself. This causes the appropriate partition to be re-determined for each row when the data is loaded. This may be useful when restoring data on a server where rows do not always fall into the same partitions as they did on the original server. That could happen, for example, if the partitioning column is of type text and the two systems have different definitions of the collation used to sort the partitioning column.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--lock-wait-timeout=\u003cem class=\"replaceable\"\u003e\u003ccode\u003etimeout\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not wait forever to acquire shared table locks at the beginning of the dump. Instead, fail if unable to lock a table within the specified \u003cem class=\"replaceable\"\u003e\u003ccode\u003etimeout\u003c/code\u003e\u003c/em\u003e. The timeout may be specified in any of the formats accepted by \u003ccode class=\"command\"\u003eSET statement_timeout\u003c/code\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-comments\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not dump \u003ccode class=\"command\"\u003eCOMMENT\u003c/code\u003e commands.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-data\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not dump data.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-policies\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not dump row security policies.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-publications\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not dump publications.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-role-passwords\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not dump passwords for roles. When restored, roles will have a null password, and password authentication will always fail until the password is set. Since password values aren't needed when this option is specified, the role information is read from the catalog view \u003ccode class=\"structname\"\u003epg_roles\u003c/code\u003e instead of \u003ccode class=\"structname\"\u003epg_authid\u003c/code\u003e. Therefore, this option also helps if access to \u003ccode class=\"structname\"\u003epg_authid\u003c/code\u003e is restricted by some security policy.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-schema\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not dump schema (data definitions).\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-security-labels\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not dump security labels.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-statistics\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not dump statistics. This is the default.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-subscriptions\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not dump subscriptions.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-sync\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eBy default, \u003ccode class=\"command\"\u003epg_dumpall\u003c/code\u003e will wait for all files to be written safely to disk. This option causes \u003ccode class=\"command\"\u003epg_dumpall\u003c/code\u003e to return without waiting, which is faster, but means that a subsequent operating system crash can leave the dump corrupt. Generally, this option is useful for testing but should not be used when dumping data from production installation.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-table-access-method\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not output commands to select table access methods. With this option, all objects will be created with whichever table access method is the default during restore.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-tablespaces\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not output commands to create tablespaces nor select tablespaces for objects. With this option, all objects will be created in whichever tablespace is the default during restore.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-toast-compression\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not output commands to set TOAST compression methods. With this option, all columns will be restored with the default compression setting.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-unlogged-table-data\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not dump the contents of unlogged tables. This option has no effect on whether or not the table definitions (schema) are dumped; it only suppresses dumping the table data.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--on-conflict-do-nothing\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eAdd \u003ccode class=\"literal\"\u003eON CONFLICT DO NOTHING\u003c/code\u003e to \u003ccode class=\"command\"\u003eINSERT\u003c/code\u003e commands. This option is not valid unless \u003ccode class=\"option\"\u003e--inserts\u003c/code\u003e or \u003ccode class=\"option\"\u003e--column-inserts\u003c/code\u003e is also specified.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--quote-all-identifiers\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eForce quoting of all identifiers. This option is recommended when dumping a database from a server whose \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e major version is different from \u003cspan class=\"application\"\u003epg_dumpall\u003c/span\u003e's, or when the output is intended to be loaded into a server of a different major version. By default, \u003cspan class=\"application\"\u003epg_dumpall\u003c/span\u003e quotes only identifiers that are reserved words in its own major version. This sometimes results in compatibility issues when dealing with servers of other versions that may have slightly different sets of reserved words. Using \u003ccode class=\"option\"\u003e--quote-all-identifiers\u003c/code\u003e prevents such issues, at the price of a harder-to-read dump script.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--restrict-key=\u003cem class=\"replaceable\"\u003e\u003ccode\u003erestrict_key\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eUse the provided string as the \u003cspan class=\"application\"\u003epsql\u003c/span\u003e \u003ccode class=\"command\"\u003e\\restrict\u003c/code\u003e key in the dump output. If no restrict key is specified, \u003cspan class=\"application\"\u003epg_dumpall\u003c/span\u003e will generate a random one as needed. Keys may contain only alphanumeric characters.\u003c/p\u003e\n\u003cp\u003eThis option is primarily intended for testing purposes and other scenarios that require repeatable output (e.g., comparing dump files). It is not recommended for general use, as a malicious server with advance knowledge of the key may be able to inject arbitrary code that will be executed on the machine that runs \u003cspan class=\"application\"\u003epsql\u003c/span\u003e with the dump output.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--rows-per-insert=\u003cem class=\"replaceable\"\u003e\u003ccode\u003enrows\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDump data as \u003ccode class=\"command\"\u003eINSERT\u003c/code\u003e commands (rather than \u003ccode class=\"command\"\u003eCOPY\u003c/code\u003e). Controls the maximum number of rows per \u003ccode class=\"command\"\u003eINSERT\u003c/code\u003e command. The value specified must be a number greater than zero. Any error during restoring will cause only rows that are part of the problematic \u003ccode class=\"command\"\u003eINSERT\u003c/code\u003e to be lost, rather than the entire table contents.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--statistics\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDump optimizer statistics.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--statistics-only\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDump only the statistics, not the schema (data definitions) or data. Optimizer statistics for tables, materialized views, foreign tables, and indexes are dumped.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--sequence-data\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eInclude sequence data in the dump. This is the default behavior except when \u003ccode class=\"option\"\u003e--no-data\u003c/code\u003e, \u003ccode class=\"option\"\u003e--schema-only\u003c/code\u003e, or \u003ccode class=\"option\"\u003e--statistics-only\u003c/code\u003e is specified.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--use-set-session-authorization\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eOutput SQL-standard \u003ccode class=\"command\"\u003eSET SESSION AUTHORIZATION\u003c/code\u003e commands instead of \u003ccode class=\"command\"\u003eALTER OWNER\u003c/code\u003e commands to determine object ownership. This makes the dump more standards compatible, but depending on the history of the objects in the dump, might not restore properly.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-?\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--help\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eShow help about \u003cspan class=\"application\"\u003epg_dumpall\u003c/span\u003e command line arguments, and exit.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003cp\u003eThe following command-line options control the database connection parameters.\u003c/p\u003e\n\u003cdiv class=\"variablelist\"\u003e\n\u003cdl class=\"variablelist\"\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-d \u003cem class=\"replaceable\"\u003e\u003ccode\u003econnstr\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\u003econnstr\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies parameters used to connect to the server, as a \u003ca class=\"link\" href=\"/docs/18/libpq-connect.html#LIBPQ-CONNSTRING\" title=\"32.1.1. Connection Strings\"\u003econnection string\u003c/a\u003e; these will override any conflicting command line options.\u003c/p\u003e\n\u003cp\u003eThe option is called \u003ccode class=\"literal\"\u003e--dbname\u003c/code\u003e for consistency with other client applications, but because \u003cspan class=\"application\"\u003epg_dumpall\u003c/span\u003e needs to connect to many databases, the database name in the connection string will be ignored. Use the \u003ccode class=\"literal\"\u003e-l\u003c/code\u003e option to specify the name of the database used for the initial connection, which will dump global objects and discover what other databases should be dumped.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-h \u003cem class=\"replaceable\"\u003e\u003ccode\u003ehost\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--host=\u003cem class=\"replaceable\"\u003e\u003ccode\u003ehost\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the host name of the machine on which the database server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket. The default is taken from the \u003ccode class=\"envar\"\u003ePGHOST\u003c/code\u003e environment variable, if set, else a Unix domain socket connection is attempted.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-l \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--database=\u003cem class=\"replaceable\"\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the name of the database to connect to for dumping global objects and discovering what other databases should be dumped. If not specified, the \u003ccode class=\"literal\"\u003epostgres\u003c/code\u003e database will be used, and if that does not exist, \u003ccode class=\"literal\"\u003etemplate1\u003c/code\u003e will be used.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-p \u003cem class=\"replaceable\"\u003e\u003ccode\u003eport\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--port=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eport\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the \u003ccode class=\"envar\"\u003ePGPORT\u003c/code\u003e environment variable, if set, or a compiled-in default.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-U \u003cem class=\"replaceable\"\u003e\u003ccode\u003eusername\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--username=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eusername\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eUser name to connect as.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-w\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-password\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eNever issue a password prompt. If the server requires password authentication and a password is not available by other means such as a \u003ccode class=\"filename\"\u003e.pgpass\u003c/code\u003e file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-W\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--password\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eForce \u003cspan class=\"application\"\u003epg_dumpall\u003c/span\u003e to prompt for a password before connecting to a database.\u003c/p\u003e\n\u003cp\u003eThis option is never essential, since \u003cspan class=\"application\"\u003epg_dumpall\u003c/span\u003e will automatically prompt for a password if the server demands password authentication. However, \u003cspan class=\"application\"\u003epg_dumpall\u003c/span\u003e will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing \u003ccode class=\"option\"\u003e-W\u003c/code\u003e to avoid the extra connection attempt.\u003c/p\u003e\n\u003cp\u003eNote that the password prompt will occur again for each database to be dumped. Usually, it's better to set up a \u003ccode class=\"filename\"\u003e~/.pgpass\u003c/code\u003e file than to rely on manual password entry.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--role=\u003cem class=\"replaceable\"\u003e\u003ccode\u003erolename\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies a role name to be used to create the dump. This option causes \u003cspan class=\"application\"\u003epg_dumpall\u003c/span\u003e to issue a \u003ccode class=\"command\"\u003eSET ROLE\u003c/code\u003e \u003cem class=\"replaceable\"\u003e\u003ccode\u003erolename\u003c/code\u003e\u003c/em\u003e command after connecting to the database. It is useful when the authenticated user (specified by \u003ccode class=\"option\"\u003e-U\u003c/code\u003e) lacks privileges needed by \u003cspan class=\"application\"\u003epg_dumpall\u003c/span\u003e, but can switch to a role with the required rights. Some installations have a policy against logging in directly as a superuser, and use of this option allows dumps to be made without violating the policy.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"id-1.9.4.15.7\"\u003e\n\u003ch2\u003eEnvironment\u003c/h2\u003e\n\u003cdiv class=\"variablelist\"\u003e\n\u003cdl class=\"variablelist\"\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003ePGHOST\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003ePGOPTIONS\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003ePGPORT\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003ePGUSER\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDefault connection parameters\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003ePG_COLOR\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies whether to use color in diagnostic messages. Possible values are \u003ccode class=\"literal\"\u003ealways\u003c/code\u003e, \u003ccode class=\"literal\"\u003eauto\u003c/code\u003e and \u003ccode class=\"literal\"\u003enever\u003c/code\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003cp\u003eThis utility, like most other \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e utilities, also uses the environment variables supported by \u003cspan class=\"application\"\u003elibpq\u003c/span\u003e (see \u003ca class=\"xref\" href=\"/docs/18/libpq-envars.html\" title=\"32.15. Environment Variables\"\u003eSection 32.15\u003c/a\u003e).\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"id-1.9.4.15.8\"\u003e\n\u003ch2\u003eNotes\u003c/h2\u003e\n\u003cp\u003eSince \u003cspan class=\"application\"\u003epg_dumpall\u003c/span\u003e calls \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e internally, some diagnostic messages will refer to \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e.\u003c/p\u003e\n\u003cp\u003eThe \u003ccode class=\"option\"\u003e--clean\u003c/code\u003e option can be useful even when your intention is to restore the dump script into a fresh cluster. Use of \u003ccode class=\"option\"\u003e--clean\u003c/code\u003e authorizes the script to drop and re-create the built-in \u003ccode class=\"literal\"\u003epostgres\u003c/code\u003e and \u003ccode class=\"literal\"\u003etemplate1\u003c/code\u003e databases, ensuring that those databases will retain the same properties (for instance, locale and encoding) that they had in the source cluster. Without the option, those databases will retain their existing database-level properties, as well as any pre-existing contents.\u003c/p\u003e\n\u003cp\u003eWhen \u003ccode class=\"option\"\u003e--statistics\u003c/code\u003e is specified, \u003ccode class=\"command\"\u003epg_dumpall\u003c/code\u003e will include most optimizer statistics in the resulting dump file. This does not include all statistics, such as those created explicitly with \u003ca class=\"xref\" href=\"/docs/18/sql-createstatistics.html\" title=\"CREATE STATISTICS\"\u003e\u003cspan class=\"refentrytitle\"\u003eCREATE STATISTICS\u003c/span\u003e\u003c/a\u003e, custom statistics added by an extension, or statistics collected by the cumulative statistics system. Therefore, it may still be useful to run \u003ccode class=\"command\"\u003eANALYZE\u003c/code\u003e on each database after restoring from a dump file to ensure optimal performance. You can also run \u003ccode class=\"command\"\u003evacuumdb -a -z\u003c/code\u003e to analyze all databases.\u003c/p\u003e\n\u003cp\u003eThe dump script should not be expected to run completely without errors. In particular, because the script will issue \u003ccode class=\"command\"\u003eCREATE ROLE\u003c/code\u003e for every role existing in the source cluster, it is certain to get a \u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003erole already exists\u003c/span\u003e”\u003c/span\u003e error for the bootstrap superuser, unless the destination cluster was initialized with a different bootstrap superuser name. This error is harmless and should be ignored. Use of the \u003ccode class=\"option\"\u003e--clean\u003c/code\u003e option is likely to produce additional harmless error messages about non-existent objects, although you can minimize those by adding \u003ccode class=\"option\"\u003e--if-exists\u003c/code\u003e.\u003c/p\u003e\n\u003cp\u003e\u003cspan class=\"application\"\u003epg_dumpall\u003c/span\u003e requires all needed tablespace directories to exist before the restore; otherwise, database creation will fail for databases in non-default locations.\u003c/p\u003e\n\u003cp\u003eIt is generally recommended to use the \u003ccode class=\"option\"\u003e-X\u003c/code\u003e (\u003ccode class=\"option\"\u003e--no-psqlrc\u003c/code\u003e) option when restoring a database from a \u003cspan class=\"application\"\u003epg_dumpall\u003c/span\u003e script to ensure a clean restore process and prevent potential conflicts with non-default \u003cspan class=\"application\"\u003epsql\u003c/span\u003e configurations. Additionally, because the \u003cspan class=\"application\"\u003epg_dumpall\u003c/span\u003e script may include \u003cspan class=\"application\"\u003epsql\u003c/span\u003e meta-commands, it may be incompatible with clients other than \u003cspan class=\"application\"\u003epsql\u003c/span\u003e.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"APP-PG-DUMPALL-EX\"\u003e\n\u003ch2\u003eExamples\u003c/h2\u003e\n\u003cp\u003eTo dump all databases:\u003c/p\u003e\n\u003cpre class=\"screen\"\u003e\u003ccode class=\"prompt\"\u003e$\u003c/code\u003e \u003cstrong class=\"userinput\"\u003e\u003ccode\u003epg_dumpall \u0026gt; db.out\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\n\u003cp\u003eTo restore database(s) from this file, you can use:\u003c/p\u003e\n\u003cpre class=\"screen\"\u003e\u003ccode class=\"prompt\"\u003e$\u003c/code\u003e \u003cstrong class=\"userinput\"\u003e\u003ccode\u003epsql -X -f db.out -d postgres\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\n\u003cp\u003eIt is not important which database you connect to here since the script file created by \u003cspan class=\"application\"\u003epg_dumpall\u003c/span\u003e will contain the appropriate commands to create and connect to the saved databases. An exception is that if you specified \u003ccode class=\"option\"\u003e--clean\u003c/code\u003e, you must connect to the \u003ccode class=\"literal\"\u003epostgres\u003c/code\u003e database initially; the script will attempt to drop other databases immediately, and that will fail for the database you are connected to.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"id-1.9.4.15.10\"\u003e\n\u003ch2\u003eSee Also\u003c/h2\u003e\n\u003cp\u003eCheck \u003ca class=\"xref\" href=\"/docs/18/app-pgdump.html\" title=\"pg_dump\"\u003e\u003cspan class=\"refentrytitle\"\u003e\u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e for details on possible error conditions.\u003c/p\u003e\n\u003c/div\u003e\n\u003c/div\u003e\u003c/div\u003e","related":[{"label":"libpq connection parameters","url":"/wiki/conn/?v=18"}],"sections":[],"tables":[{"columns":[{"key":"signature","label":"Option and arguments"},{"key":"summary","label":"Description"}],"key":"options","rows":[{"signature":{"text":"-a --data-only","url":"/docs/18/app-pg-dumpall.html"},"summary":"Dump only the data, not the schema (data definitions) or statistics."},{"signature":{"text":"-c --clean","url":"/docs/18/app-pg-dumpall.html"},"summary":"Emit SQL commands to DROP all the dumped databases, roles, and tablespaces before recreating them. This option is useful when the restore is to overwrite an existing cluster. If any of the objects do not exist in the destination cluster, ignorable error messages will be reported during restore, unless --if-exists is also specified."},{"signature":{"text":"-E encoding --encoding= encoding","url":"/docs/18/app-pg-dumpall.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.)"},{"signature":{"text":"-f filename --file= filename","url":"/docs/18/app-pg-dumpall.html"},"summary":"Send output to the specified file. If this is omitted, the standard output is used."},{"signature":{"text":"-g --globals-only","url":"/docs/18/app-pg-dumpall.html"},"summary":"Dump only global objects (roles and tablespaces), no databases."},{"signature":{"text":"-O --no-owner","url":"/docs/18/app-pg-dumpall.html"},"summary":"Do not output commands to set ownership of objects to match the original database. By default, pg_dumpall issues ALTER OWNER or SET SESSION AUTHORIZATION statements to set ownership of created schema elements. 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 --roles-only","url":"/docs/18/app-pg-dumpall.html"},"summary":"Dump only roles, no databases or tablespaces."},{"signature":{"text":"-s --schema-only","url":"/docs/18/app-pg-dumpall.html"},"summary":"Dump only the object definitions (schema), not data."},{"signature":{"text":"-S username --superuser= username","url":"/docs/18/app-pg-dumpall.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 --tablespaces-only","url":"/docs/18/app-pg-dumpall.html"},"summary":"Dump only tablespaces, no databases or roles."},{"signature":{"text":"-v --verbose","url":"/docs/18/app-pg-dumpall.html"},"summary":"Specifies verbose mode. This will cause pg_dumpall to output 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. The option is also passed down to pg_dump ."},{"signature":{"text":"-V --version","url":"/docs/18/app-pg-dumpall.html"},"summary":"Print the pg_dumpall version and exit."},{"signature":{"text":"-x --no-privileges --no-acl","url":"/docs/18/app-pg-dumpall.html"},"summary":"Prevent dumping of access privileges (grant/revoke commands)."},{"signature":{"text":"--binary-upgrade","url":"/docs/18/app-pg-dumpall.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-pg-dumpall.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."},{"signature":{"text":"--disable-dollar-quoting","url":"/docs/18/app-pg-dumpall.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-pg-dumpall.html"},"summary":"This option is relevant only when creating a dump with data and without schema. It instructs pg_dumpall 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":"--exclude-database= pattern","url":"/docs/18/app-pg-dumpall.html"},"summary":"Do not dump databases whose name matches pattern . Multiple patterns can be excluded by writing multiple --exclude-database switches. The pattern parameter is interpreted as a pattern according to the same rules used by psql 's \\d commands (see Patterns ), so multiple databases can also be excluded by writing wildcard characters in the pattern. When using wildcards, be careful to quote the pattern if needed to prevent shell wildcard expansion."},{"signature":{"text":"--extra-float-digits= ndigits","url":"/docs/18/app-pg-dumpall.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-pg-dumpall.html"},"summary":"Specify a filename from which to read patterns for databases excluded from the dump. The patterns are interpreted according to the same rules as --exclude-database . To read from STDIN , use - as the filename. The --filter option can be specified in conjunction with --exclude-database for excluding databases, and can also be specified more than once for multiple filter files."},{"signature":{"text":"--if-exists","url":"/docs/18/app-pg-dumpall.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":"--inserts","url":"/docs/18/app-pg-dumpall.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. Note that the restore might fail altogether if you have rearranged column order. The --column-inserts option is safer, though even slower."},{"signature":{"text":"--load-via-partition-root","url":"/docs/18/app-pg-dumpall.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-pg-dumpall.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 ."},{"signature":{"text":"--no-comments","url":"/docs/18/app-pg-dumpall.html"},"summary":"Do not dump COMMENT commands."},{"signature":{"text":"--no-data","url":"/docs/18/app-pg-dumpall.html"},"summary":"Do not dump data."},{"signature":{"text":"--no-policies","url":"/docs/18/app-pg-dumpall.html"},"summary":"Do not dump row security policies."},{"signature":{"text":"--no-publications","url":"/docs/18/app-pg-dumpall.html"},"summary":"Do not dump publications."},{"signature":{"text":"--no-role-passwords","url":"/docs/18/app-pg-dumpall.html"},"summary":"Do not dump passwords for roles. When restored, roles will have a null password, and password authentication will always fail until the password is set. Since password values aren't needed when this option is specified, the role information is read from the catalog view pg_roles instead of pg_authid . Therefore, this option also helps if access to pg_authid is restricted by some security policy."},{"signature":{"text":"--no-schema","url":"/docs/18/app-pg-dumpall.html"},"summary":"Do not dump schema (data definitions)."},{"signature":{"text":"--no-security-labels","url":"/docs/18/app-pg-dumpall.html"},"summary":"Do not dump security labels."},{"signature":{"text":"--no-statistics","url":"/docs/18/app-pg-dumpall.html"},"summary":"Do not dump statistics. This is the default."},{"signature":{"text":"--no-subscriptions","url":"/docs/18/app-pg-dumpall.html"},"summary":"Do not dump subscriptions."},{"signature":{"text":"--no-sync","url":"/docs/18/app-pg-dumpall.html"},"summary":"By default, pg_dumpall will wait for all files to be written safely to disk. This option causes pg_dumpall 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-pg-dumpall.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-pg-dumpall.html"},"summary":"Do not output commands to create tablespaces nor select tablespaces for objects. 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-pg-dumpall.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-pg-dumpall.html"},"summary":"Do not dump the contents of unlogged tables. This option has no effect on whether or not the table definitions (schema) are dumped; it only suppresses dumping the table data."},{"signature":{"text":"--on-conflict-do-nothing","url":"/docs/18/app-pg-dumpall.html"},"summary":"Add ON CONFLICT DO NOTHING to INSERT commands. This option is not valid unless --inserts or --column-inserts is also specified."},{"signature":{"text":"--quote-all-identifiers","url":"/docs/18/app-pg-dumpall.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_dumpall 's, or when the output is intended to be loaded into a server of a different major version. By default, pg_dumpall 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-pg-dumpall.html"},"summary":"Use the provided string as the psql \\restrict key in the dump output. If no restrict key is specified, pg_dumpall will generate a random one as needed. Keys may contain only alphanumeric characters."},{"signature":{"text":"--rows-per-insert= nrows","url":"/docs/18/app-pg-dumpall.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":"--statistics","url":"/docs/18/app-pg-dumpall.html"},"summary":"Dump optimizer statistics."},{"signature":{"text":"--statistics-only","url":"/docs/18/app-pg-dumpall.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":"--sequence-data","url":"/docs/18/app-pg-dumpall.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":"--use-set-session-authorization","url":"/docs/18/app-pg-dumpall.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."},{"signature":{"text":"-? --help","url":"/docs/18/app-pg-dumpall.html"},"summary":"Show help about pg_dumpall command line arguments, and exit."},{"signature":{"text":"-d connstr --dbname= connstr","url":"/docs/18/app-pg-dumpall.html"},"summary":"Specifies parameters used to connect to the server, as a connection string ; these will override any conflicting command line options."},{"signature":{"text":"-h host --host= host","url":"/docs/18/app-pg-dumpall.html"},"summary":"Specifies the host name of the machine on which the database 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":"-l dbname --database= dbname","url":"/docs/18/app-pg-dumpall.html"},"summary":"Specifies the name of the database to connect to for dumping global objects and discovering what other databases should be dumped. If not specified, the postgres database will be used, and if that does not exist, template1 will be used."},{"signature":{"text":"-p port --port= port","url":"/docs/18/app-pg-dumpall.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-pg-dumpall.html"},"summary":"User name to connect as."},{"signature":{"text":"-w --no-password","url":"/docs/18/app-pg-dumpall.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-pg-dumpall.html"},"summary":"Force pg_dumpall to prompt for a password before connecting to a database."},{"signature":{"text":"--role= rolename","url":"/docs/18/app-pg-dumpall.html"},"summary":"Specifies a role name to be used to create the dump. This option causes pg_dumpall 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_dumpall , 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":"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}
