{"kind": "tool", "major": "18", "item": {"slug": "pg-dumpall", "name": "pg_dumpall", "name_zh": "", "category": "Client applications", "summary": "pg_dumpall \u2014 extract a PostgreSQL database cluster into a script file", "aliases": ["pg_dumpall"], "content_hash": "82862a4657b3670d03315ff837489306acf50ddeec653ca599efef442a6126fb", "versions": {"10": {"facts": [{"label": "Documented executable", "value": "pg_dumpall"}, {"label": "Executable version", "value": "10.23"}, {"label": "Reference inventory", "value": "Client applications"}, {"label": "Option definition groups", "value": "38"}], "tables": [{"key": "options", "rows": [{"summary": "Dump only the data, not the schema (data definitions).", "signature": {"url": "/docs/10/app-pg-dumpall.html", "text": "-a --data-only"}}, {"summary": "Include SQL commands to clean (drop) databases before recreating them. DROP commands for roles and tablespaces are added as well.", "signature": {"url": "/docs/10/app-pg-dumpall.html", "text": "-c --clean"}}, {"summary": "Send output to the specified file. If this is omitted, the standard output is used.", "signature": {"url": "/docs/10/app-pg-dumpall.html", "text": "-f filename --file= filename"}}, {"summary": "Dump only global objects (roles and tablespaces), no databases.", "signature": {"url": "/docs/10/app-pg-dumpall.html", "text": "-g --globals-only"}}, {"summary": "Dump object identifiers ( OID s) as part of the data for every table. Use this option if your application references the OID columns in some way (e.g., in a foreign key constraint). Otherwise, this option should not be used.", "signature": {"url": "/docs/10/app-pg-dumpall.html", "text": "-o --oids"}}, {"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": {"url": "/docs/10/app-pg-dumpall.html", "text": "-O --no-owner"}}, {"summary": "Dump only roles, no databases or tablespaces.", "signature": {"url": "/docs/10/app-pg-dumpall.html", "text": "-r --roles-only"}}, {"summary": "Dump only the object definitions (schema), not data.", "signature": {"url": "/docs/10/app-pg-dumpall.html", "text": "-s --schema-only"}}, {"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": {"url": "/docs/10/app-pg-dumpall.html", "text": "-S username --superuser= username"}}, {"summary": "Dump only tablespaces, no databases or roles.", "signature": {"url": "/docs/10/app-pg-dumpall.html", "text": "-t --tablespaces-only"}}, {"summary": "Specifies verbose mode. This will cause pg_dumpall to output start/stop times to the dump file, and progress messages to standard error. It will also enable verbose output in pg_dump .", "signature": {"url": "/docs/10/app-pg-dumpall.html", "text": "-v --verbose"}}, {"summary": "Print the pg_dumpall version and exit.", "signature": {"url": "/docs/10/app-pg-dumpall.html", "text": "-V --version"}}, {"summary": "Prevent dumping of access privileges (grant/revoke commands).", "signature": {"url": "/docs/10/app-pg-dumpall.html", "text": "-x --no-privileges --no-acl"}}, {"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": {"url": "/docs/10/app-pg-dumpall.html", "text": "--binary-upgrade"}}, {"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": {"url": "/docs/10/app-pg-dumpall.html", "text": "--column-inserts --attribute-inserts"}}, {"summary": "This option disables the use of dollar quoting for function bodies, and forces them to be quoted using SQL standard string syntax.", "signature": {"url": "/docs/10/app-pg-dumpall.html", "text": "--disable-dollar-quoting"}}, {"summary": "This option is relevant only when creating a data-only dump. It instructs pg_dumpall to include commands to temporarily disable triggers on the target tables while the data is reloaded. Use this if you have referential integrity checks or other triggers on the tables that you do not want to invoke during data reload.", "signature": {"url": "/docs/10/app-pg-dumpall.html", "text": "--disable-triggers"}}, {"summary": "Use conditional commands (i.e., add an IF EXISTS clause) to clean databases and other objects. This option is not valid unless --clean is also specified.", "signature": {"url": "/docs/10/app-pg-dumpall.html", "text": "--if-exists"}}, {"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": {"url": "/docs/10/app-pg-dumpall.html", "text": "--inserts"}}, {"summary": "Do not wait forever to acquire shared table locks at the beginning of the dump. Instead, fail if unable to lock a table within the specified timeout . The timeout may be specified in any of the formats accepted by SET statement_timeout . Allowed values vary depending on the server version you are dumping from, but an integer number of milliseconds is accepted by all versions since 7.3. This option is ignored when dumping from a pre-7.3 server.", "signature": {"url": "/docs/10/app-pg-dumpall.html", "text": "--lock-wait-timeout= timeout"}}, {"summary": "Do not dump publications.", "signature": {"url": "/docs/10/app-pg-dumpall.html", "text": "--no-publications"}}, {"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": {"url": "/docs/10/app-pg-dumpall.html", "text": "--no-role-passwords"}}, {"summary": "Do not dump security labels.", "signature": {"url": "/docs/10/app-pg-dumpall.html", "text": "--no-security-labels"}}, {"summary": "Do not dump subscriptions.", "signature": {"url": "/docs/10/app-pg-dumpall.html", "text": "--no-subscriptions"}}, {"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": {"url": "/docs/10/app-pg-dumpall.html", "text": "--no-sync"}}, {"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": {"url": "/docs/10/app-pg-dumpall.html", "text": "--no-tablespaces"}}, {"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": {"url": "/docs/10/app-pg-dumpall.html", "text": "--no-unlogged-table-data"}}, {"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": {"url": "/docs/10/app-pg-dumpall.html", "text": "--quote-all-identifiers"}}, {"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": {"url": "/docs/10/app-pg-dumpall.html", "text": "--use-set-session-authorization"}}, {"summary": "Show help about pg_dumpall command line arguments, and exit.", "signature": {"url": "/docs/10/app-pg-dumpall.html", "text": "-? --help"}}, {"summary": "Specifies parameters used to connect to the server, as a connection string ; these will override any conflicting command line options.", "signature": {"url": "/docs/10/app-pg-dumpall.html", "text": "-d connstr --dbname= connstr"}}, {"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": {"url": "/docs/10/app-pg-dumpall.html", "text": "-h host --host= host"}}, {"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": {"url": "/docs/10/app-pg-dumpall.html", "text": "-l dbname --database= dbname"}}, {"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": {"url": "/docs/10/app-pg-dumpall.html", "text": "-p port --port= port"}}, {"summary": "User name to connect as.", "signature": {"url": "/docs/10/app-pg-dumpall.html", "text": "-U username --username= username"}}, {"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": {"url": "/docs/10/app-pg-dumpall.html", "text": "-w --no-password"}}, {"summary": "Force pg_dumpall to prompt for a password before connecting to a database.", "signature": {"url": "/docs/10/app-pg-dumpall.html", "text": "-W --password"}}, {"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.", "signature": {"url": "/docs/10/app-pg-dumpall.html", "text": "--role= rolename"}}], "title": "Documented options", "columns": [{"key": "signature", "label": "Option and arguments"}, {"key": "summary", "label": "Description"}]}, {"key": "environment", "rows": [{"name": "PGHOST PGOPTIONS PGPORT PGUSER", "description": "Default connection parameters"}], "title": "Environment variables", "columns": [{"key": "name", "label": "Variable"}, {"key": "description", "label": "Meaning"}]}], "options": [{"names": ["-a", "--data-only"], "summary": "Dump only the data, not the schema (data definitions).", "signature": "-a --data-only", "source_url": "/docs/10/app-pg-dumpall.html", "description": "Dump only the data, not the schema (data definitions)."}, {"names": ["-c", "--clean"], "summary": "Include SQL commands to clean (drop) databases before recreating them. DROP commands for roles and tablespaces are added as well.", "signature": "-c --clean", "source_url": "/docs/10/app-pg-dumpall.html", "description": "Include SQL commands to clean (drop) databases before recreating them. DROP commands for roles and tablespaces are added as well."}, {"names": ["-f filename", "--file= filename"], "summary": "Send output to the specified file. If this is omitted, the standard output is used.", "signature": "-f filename --file= filename", "source_url": "/docs/10/app-pg-dumpall.html", "description": "Send output to the specified file. If this is omitted, the standard output is used."}, {"names": ["-g", "--globals-only"], "summary": "Dump only global objects (roles and tablespaces), no databases.", "signature": "-g --globals-only", "source_url": "/docs/10/app-pg-dumpall.html", "description": "Dump only global objects (roles and tablespaces), no databases."}, {"names": ["-o", "--oids"], "summary": "Dump object identifiers ( OID s) as part of the data for every table. Use this option if your application references the OID columns in some way (e.g., in a foreign key constraint). Otherwise, this option should not be used.", "signature": "-o --oids", "source_url": "/docs/10/app-pg-dumpall.html", "description": "Dump object identifiers ( OID s) as part of the data for every table. Use this option if your application references the OID columns in some way (e.g., in a foreign key constraint). Otherwise, this option should not be used."}, {"names": ["-O", "--no-owner"], "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": "-O --no-owner", "source_url": "/docs/10/app-pg-dumpall.html", "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": ["-r", "--roles-only"], "summary": "Dump only roles, no databases or tablespaces.", "signature": "-r --roles-only", "source_url": "/docs/10/app-pg-dumpall.html", "description": "Dump only roles, no databases or tablespaces."}, {"names": ["-s", "--schema-only"], "summary": "Dump only the object definitions (schema), not data.", "signature": "-s --schema-only", "source_url": "/docs/10/app-pg-dumpall.html", "description": "Dump only the object definitions (schema), not data."}, {"names": ["-S username", "--superuser= username"], "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": "-S username --superuser= username", "source_url": "/docs/10/app-pg-dumpall.html", "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": ["-t", "--tablespaces-only"], "summary": "Dump only tablespaces, no databases or roles.", "signature": "-t --tablespaces-only", "source_url": "/docs/10/app-pg-dumpall.html", "description": "Dump only tablespaces, no databases or roles."}, {"names": ["-v", "--verbose"], "summary": "Specifies verbose mode. This will cause pg_dumpall to output start/stop times to the dump file, and progress messages to standard error. It will also enable verbose output in pg_dump .", "signature": "-v --verbose", "source_url": "/docs/10/app-pg-dumpall.html", "description": "Specifies verbose mode. This will cause pg_dumpall to output start/stop times to the dump file, and progress messages to standard error. It will also enable verbose output in pg_dump ."}, {"names": ["-V", "--version"], "summary": "Print the pg_dumpall version and exit.", "signature": "-V --version", "source_url": "/docs/10/app-pg-dumpall.html", "description": "Print the pg_dumpall version and exit."}, {"names": ["-x", "--no-privileges", "--no-acl"], "summary": "Prevent dumping of access privileges (grant/revoke commands).", "signature": "-x --no-privileges --no-acl", "source_url": "/docs/10/app-pg-dumpall.html", "description": "Prevent dumping of access privileges (grant/revoke commands)."}, {"names": ["--binary-upgrade"], "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": "--binary-upgrade", "source_url": "/docs/10/app-pg-dumpall.html", "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": ["--column-inserts", "--attribute-inserts"], "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": "--column-inserts --attribute-inserts", "source_url": "/docs/10/app-pg-dumpall.html", "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": ["--disable-dollar-quoting"], "summary": "This option disables the use of dollar quoting for function bodies, and forces them to be quoted using SQL standard string syntax.", "signature": "--disable-dollar-quoting", "source_url": "/docs/10/app-pg-dumpall.html", "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-triggers"], "summary": "This option is relevant only when creating a data-only dump. It instructs pg_dumpall to include commands to temporarily disable triggers on the target tables while the data is reloaded. Use this if you have referential integrity checks or other triggers on the tables that you do not want to invoke during data reload.", "signature": "--disable-triggers", "source_url": "/docs/10/app-pg-dumpall.html", "description": "This option is relevant only when creating a data-only dump. It instructs pg_dumpall to include commands to temporarily disable triggers on the target tables while the data is reloaded. Use this if you have referential integrity checks or other triggers on the tables that you do not want to invoke during data reload. 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": ["--if-exists"], "summary": "Use conditional commands (i.e., add an IF EXISTS clause) to clean databases and other objects. This option is not valid unless --clean is also specified.", "signature": "--if-exists", "source_url": "/docs/10/app-pg-dumpall.html", "description": "Use conditional commands (i.e., add an IF EXISTS clause) to clean databases and other objects. This option is not valid unless --clean is also specified."}, {"names": ["--inserts"], "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": "--inserts", "source_url": "/docs/10/app-pg-dumpall.html", "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": ["--lock-wait-timeout= timeout"], "summary": "Do not wait forever to acquire shared table locks at the beginning of the dump. Instead, fail if unable to lock a table within the specified timeout . The timeout may be specified in any of the formats accepted by SET statement_timeout . Allowed values vary depending on the server version you are dumping from, but an integer number of milliseconds is accepted by all versions since 7.3. This option is ignored when dumping from a pre-7.3 server.", "signature": "--lock-wait-timeout= timeout", "source_url": "/docs/10/app-pg-dumpall.html", "description": "Do not wait forever to acquire shared table locks at the beginning of the dump. Instead, fail if unable to lock a table within the specified timeout . The timeout may be specified in any of the formats accepted by SET statement_timeout . Allowed values vary depending on the server version you are dumping from, but an integer number of milliseconds is accepted by all versions since 7.3. This option is ignored when dumping from a pre-7.3 server."}, {"names": ["--no-publications"], "summary": "Do not dump publications.", "signature": "--no-publications", "source_url": "/docs/10/app-pg-dumpall.html", "description": "Do not dump publications."}, {"names": ["--no-role-passwords"], "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": "--no-role-passwords", "source_url": "/docs/10/app-pg-dumpall.html", "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-security-labels"], "summary": "Do not dump security labels.", "signature": "--no-security-labels", "source_url": "/docs/10/app-pg-dumpall.html", "description": "Do not dump security labels."}, {"names": ["--no-subscriptions"], "summary": "Do not dump subscriptions.", "signature": "--no-subscriptions", "source_url": "/docs/10/app-pg-dumpall.html", "description": "Do not dump subscriptions."}, {"names": ["--no-sync"], "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": "--no-sync", "source_url": "/docs/10/app-pg-dumpall.html", "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-tablespaces"], "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": "--no-tablespaces", "source_url": "/docs/10/app-pg-dumpall.html", "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-unlogged-table-data"], "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": "--no-unlogged-table-data", "source_url": "/docs/10/app-pg-dumpall.html", "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": ["--quote-all-identifiers"], "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": "--quote-all-identifiers", "source_url": "/docs/10/app-pg-dumpall.html", "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": ["--use-set-session-authorization"], "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": "--use-set-session-authorization", "source_url": "/docs/10/app-pg-dumpall.html", "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": ["-?", "--help"], "summary": "Show help about pg_dumpall command line arguments, and exit.", "signature": "-? --help", "source_url": "/docs/10/app-pg-dumpall.html", "description": "Show help about pg_dumpall command line arguments, and exit."}, {"names": ["-d connstr", "--dbname= connstr"], "summary": "Specifies parameters used to connect to the server, as a connection string ; these will override any conflicting command line options.", "signature": "-d connstr --dbname= connstr", "source_url": "/docs/10/app-pg-dumpall.html", "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, database name in the connection string will be ignored. Use -l option to specify the name of the database used to dump global objects and to discover what other databases should be dumped."}, {"names": ["-h host", "--host= host"], "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": "-h host --host= host", "source_url": "/docs/10/app-pg-dumpall.html", "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": ["-l dbname", "--database= dbname"], "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": "-l dbname --database= dbname", "source_url": "/docs/10/app-pg-dumpall.html", "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": ["-p port", "--port= port"], "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": "-p port --port= port", "source_url": "/docs/10/app-pg-dumpall.html", "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": ["-U username", "--username= username"], "summary": "User name to connect as.", "signature": "-U username --username= username", "source_url": "/docs/10/app-pg-dumpall.html", "description": "User name to connect as."}, {"names": ["-w", "--no-password"], "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": "-w --no-password", "source_url": "/docs/10/app-pg-dumpall.html", "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", "--password"], "summary": "Force pg_dumpall to prompt for a password before connecting to a database.", "signature": "-W --password", "source_url": "/docs/10/app-pg-dumpall.html", "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": ["--role= rolename"], "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.", "signature": "--role= rolename", "source_url": "/docs/10/app-pg-dumpall.html", "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."}], "related": [{"url": "/wiki/conn/?v=10", "label": "libpq connection parameters"}], "release": {"ref": "https://ftp.postgresql.org/pub/source/v10.23/postgresql-10.23.tar.bz2", "label": "10.23", "major": "10", "channel": "historical", "manifest": {"pdf": {"A4": {"url": "/files/documentation/pdf/10/postgresql-10-A4.pdf", "bytes": 12631706, "pages": 2591, "sha256": "34497ab9efb45c5bdf1bd11b9016b5451354feb462fa029cf74557a5fa5fbbc1", "built_at": "2026-09-26"}, "US": {"url": "/files/documentation/pdf/10/postgresql-10-US.pdf", "bytes": 12531684, "pages": 2724, "sha256": "429cc7133ddf4f97c560aa466dc9caea4b718721a8321e293357037cf0af4733", "built_at": "2026-09-26"}}, "tree": "10", "index": "index.html", "major": "10", "pages": 1085, "release": "10.23", "source_url": "https://ftp.postgresql.org/pub/source/v10.23/postgresql-10.23.tar.bz2", "svg_assets": 0, "source_mode": "en HTML verified against the pinned official archive", "source_sha256": "94a4b2528372458e5662c18d406629266667c437198160a18cdfd2c4a4d6eee9"}, "revision": "f9301feba91e2e2566038a36b8cee0e4402db68989538f88670fddd20b1f78ea", "evidence_kind": "English manual and source declarations", "source_sha256": "94a4b2528372458e5662c18d406629266667c437198160a18cdfd2c4a4d6eee9"}, "sources": [{"url": "/docs/10/app-pg-dumpall.html", "file": "app-pg-dumpall.html", "label": "10.23 English manual \u00b7 app-pg-dumpall.html", "anchor": "", "sha256": "f29753397eb215a0f74cf563584b2de22a589d6f5732b51ddc2e31e5e7070f0e"}, {"url": "/docs/10/reference-client.html", "file": "reference-client.html", "label": "Client applications inventory", "anchor": "", "sha256": "e4330732b6acd6c025a1fbdce45574b23d964de847a1b849ea88b98ab628d2e2"}], "sections": [], "synopsis": ["pg_dumpall [ connection-option ...] [ option ...]"], "signature": "pg_dumpall [ connection-option ...] [ option ...]", "description": ["pg_dumpall \u2014 extract a PostgreSQL database cluster into a script file"], "environment": [{"name": "PGHOST PGOPTIONS PGPORT PGUSER", "description": "Default connection parameters"}], "manual_html": "<div><div class=\"refentry\" id=\"APP-PG-DUMPALL\">\n<div class=\"titlepage\"></div>\n\n<div class=\"refnamediv\">\n<h2><span class=\"refentrytitle\"><span class=\"application\">pg_dumpall</span></span></h2>\n<p>pg_dumpall \u2014 extract a <span class=\"productname\">PostgreSQL</span> database cluster into a script file</p>\n</div>\n<div class=\"refsynopsisdiv\">\n<h2>Synopsis</h2>\n<div class=\"cmdsynopsis\">\n<p id=\"id-1.9.4.13.4.1\"><code class=\"command\">pg_dumpall</code> [<em class=\"replaceable\"><code>connection-option</code></em>...] [<em class=\"replaceable\"><code>option</code></em>...]</p>\n</div>\n</div>\n<div class=\"refsect1\" id=\"APP-PG-DUMPALL-DESCRIPTION\">\n<h2>Description</h2>\n<p><span class=\"application\">pg_dumpall</span> is a utility for writing out (<span class=\"quote\">\u201c<span class=\"quote\">dumping</span>\u201d</span>) all <span class=\"productname\">PostgreSQL</span> databases of a cluster into one script file. The script file contains SQL commands that can be used as input to <a class=\"xref\" href=\"/docs/10/app-psql.html\" title=\"psql\"><span class=\"refentrytitle\"><span class=\"application\">psql</span></span></a> to restore the databases. It does this by calling <a class=\"xref\" href=\"/docs/10/app-pgdump.html\" title=\"pg_dump\"><span class=\"refentrytitle\">pg_dump</span></a> for each database in a cluster. <span class=\"application\">pg_dumpall</span> also dumps global objects that are common to all databases. (<span class=\"application\">pg_dump</span> does not save these objects.) This currently includes information about database users and groups, tablespaces, and properties such as access permissions that apply to databases as a whole.</p>\n<p>Since <span class=\"application\">pg_dumpall</span> 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 users and groups, and to create databases.</p>\n<p>The SQL script will be written to the standard output. Use the <code class=\"option\">-f</code>/<code class=\"option\">--file</code> option or shell operators to redirect it into a file.</p>\n<p><span class=\"application\">pg_dumpall</span> needs to connect several times to the <span class=\"productname\">PostgreSQL</span> server (once per database). If you use password authentication it will ask for a password each time. It is convenient to have a <code class=\"filename\">~/.pgpass</code> file in such cases. See <a class=\"xref\" href=\"/docs/10/libpq-pgpass.html\" title=\"33.15.\u00a0The Password File\">Section\u00a033.15</a> for more information.</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.13.6\">\n<h2>Options</h2>\n<p>The following command-line options control the content and format of the output.</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-a</code><br></span><span class=\"term\"><code class=\"option\">--data-only</code></span></dt>\n<dd>\n<p>Dump only the data, not the schema (data definitions).</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-c</code><br></span><span class=\"term\"><code class=\"option\">--clean</code></span></dt>\n<dd>\n<p>Include SQL commands to clean (drop) databases before recreating them. <code class=\"command\">DROP</code> commands for roles and tablespaces are added as well.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-f <em class=\"replaceable\"><code>filename</code></em></code><br></span><span class=\"term\"><code class=\"option\">--file=<em class=\"replaceable\"><code>filename</code></em></code></span></dt>\n<dd>\n<p>Send output to the specified file. If this is omitted, the standard output is used.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-g</code><br></span><span class=\"term\"><code class=\"option\">--globals-only</code></span></dt>\n<dd>\n<p>Dump only global objects (roles and tablespaces), no databases.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-o</code><br></span><span class=\"term\"><code class=\"option\">--oids</code></span></dt>\n<dd>\n<p>Dump object identifiers (OIDs) as part of the data for every table. Use this option if your application references the OID columns in some way (e.g., in a foreign key constraint). Otherwise, this option should not be used.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-O</code><br></span><span class=\"term\"><code class=\"option\">--no-owner</code></span></dt>\n<dd>\n<p>Do not output commands to set ownership of objects to match the original database. By default, <span class=\"application\">pg_dumpall</span> issues <code class=\"command\">ALTER OWNER</code> or <code class=\"command\">SET SESSION AUTHORIZATION</code> 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 <code class=\"option\">-O</code>.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-r</code><br></span><span class=\"term\"><code class=\"option\">--roles-only</code></span></dt>\n<dd>\n<p>Dump only roles, no databases or tablespaces.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-s</code><br></span><span class=\"term\"><code class=\"option\">--schema-only</code></span></dt>\n<dd>\n<p>Dump only the object definitions (schema), not data.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-S <em class=\"replaceable\"><code>username</code></em></code><br></span><span class=\"term\"><code class=\"option\">--superuser=<em class=\"replaceable\"><code>username</code></em></code></span></dt>\n<dd>\n<p>Specify the superuser user name to use when disabling triggers. This is relevant only if <code class=\"option\">--disable-triggers</code> is used. (Usually, it's better to leave this out, and instead start the resulting script as superuser.)</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-t</code><br></span><span class=\"term\"><code class=\"option\">--tablespaces-only</code></span></dt>\n<dd>\n<p>Dump only tablespaces, no databases or roles.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-v</code><br></span><span class=\"term\"><code class=\"option\">--verbose</code></span></dt>\n<dd>\n<p>Specifies verbose mode. This will cause <span class=\"application\">pg_dumpall</span> to output start/stop times to the dump file, and progress messages to standard error. It will also enable verbose output in <span class=\"application\">pg_dump</span>.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-V</code><br></span><span class=\"term\"><code class=\"option\">--version</code></span></dt>\n<dd>\n<p>Print the <span class=\"application\">pg_dumpall</span> version and exit.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-x</code><br></span><span class=\"term\"><code class=\"option\">--no-privileges</code><br></span><span class=\"term\"><code class=\"option\">--no-acl</code></span></dt>\n<dd>\n<p>Prevent dumping of access privileges (grant/revoke commands).</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--binary-upgrade</code></span></dt>\n<dd>\n<p>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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--column-inserts</code><br></span><span class=\"term\"><code class=\"option\">--attribute-inserts</code></span></dt>\n<dd>\n<p>Dump data as <code class=\"command\">INSERT</code> commands with explicit column names (<code class=\"literal\">INSERT INTO <em class=\"replaceable\"><code>table</code></em> (<em class=\"replaceable\"><code>column</code></em>, ...) VALUES ...</code>). This will make restoration very slow; it is mainly useful for making dumps that can be loaded into non-<span class=\"productname\">PostgreSQL</span> databases.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--disable-dollar-quoting</code></span></dt>\n<dd>\n<p>This option disables the use of dollar quoting for function bodies, and forces them to be quoted using SQL standard string syntax.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--disable-triggers</code></span></dt>\n<dd>\n<p>This option is relevant only when creating a data-only dump. It instructs <span class=\"application\">pg_dumpall</span> to include commands to temporarily disable triggers on the target tables while the data is reloaded. Use this if you have referential integrity checks or other triggers on the tables that you do not want to invoke during data reload.</p>\n<p>Presently, the commands emitted for <code class=\"option\">--disable-triggers</code> must be done as superuser. So, you should also specify a superuser name with <code class=\"option\">-S</code>, or preferably be careful to start the resulting script as a superuser.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--if-exists</code></span></dt>\n<dd>\n<p>Use conditional commands (i.e., add an <code class=\"literal\">IF EXISTS</code> clause) to clean databases and other objects. This option is not valid unless <code class=\"option\">--clean</code> is also specified.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--inserts</code></span></dt>\n<dd>\n<p>Dump data as <code class=\"command\">INSERT</code> commands (rather than <code class=\"command\">COPY</code>). This will make restoration very slow; it is mainly useful for making dumps that can be loaded into non-<span class=\"productname\">PostgreSQL</span> databases. Note that the restore might fail altogether if you have rearranged column order. The <code class=\"option\">--column-inserts</code> option is safer, though even slower.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--lock-wait-timeout=<em class=\"replaceable\"><code>timeout</code></em></code></span></dt>\n<dd>\n<p>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 <em class=\"replaceable\"><code>timeout</code></em>. The timeout may be specified in any of the formats accepted by <code class=\"command\">SET statement_timeout</code>. Allowed values vary depending on the server version you are dumping from, but an integer number of milliseconds is accepted by all versions since 7.3. This option is ignored when dumping from a pre-7.3 server.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-publications</code></span></dt>\n<dd>\n<p>Do not dump publications.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-role-passwords</code></span></dt>\n<dd>\n<p>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 <code class=\"structname\">pg_roles</code> instead of <code class=\"structname\">pg_authid</code>. Therefore, this option also helps if access to <code class=\"structname\">pg_authid</code> is restricted by some security policy.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-security-labels</code></span></dt>\n<dd>\n<p>Do not dump security labels.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-subscriptions</code></span></dt>\n<dd>\n<p>Do not dump subscriptions.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-sync</code></span></dt>\n<dd>\n<p>By default, <code class=\"command\">pg_dumpall</code> will wait for all files to be written safely to disk. This option causes <code class=\"command\">pg_dumpall</code> 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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-tablespaces</code></span></dt>\n<dd>\n<p>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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-unlogged-table-data</code></span></dt>\n<dd>\n<p>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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--quote-all-identifiers</code></span></dt>\n<dd>\n<p>Force quoting of all identifiers. This option is recommended when dumping a database from a server whose <span class=\"productname\">PostgreSQL</span> major version is different from <span class=\"application\">pg_dumpall</span>'s, or when the output is intended to be loaded into a server of a different major version. By default, <span class=\"application\">pg_dumpall</span> 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 <code class=\"option\">--quote-all-identifiers</code> prevents such issues, at the price of a harder-to-read dump script.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--use-set-session-authorization</code></span></dt>\n<dd>\n<p>Output SQL-standard <code class=\"command\">SET SESSION AUTHORIZATION</code> commands instead of <code class=\"command\">ALTER OWNER</code> 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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-?</code><br></span><span class=\"term\"><code class=\"option\">--help</code></span></dt>\n<dd>\n<p>Show help about <span class=\"application\">pg_dumpall</span> command line arguments, and exit.</p>\n</dd>\n</dl>\n</div>\n<p>The following command-line options control the database connection parameters.</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-d <em class=\"replaceable\"><code>connstr</code></em></code><br></span><span class=\"term\"><code class=\"option\">--dbname=<em class=\"replaceable\"><code>connstr</code></em></code></span></dt>\n<dd>\n<p>Specifies parameters used to connect to the server, as a <a class=\"link\" href=\"/docs/10/libpq-connect.html#LIBPQ-CONNSTRING\" title=\"33.1.1.\u00a0Connection Strings\">connection string</a>; these will override any conflicting command line options.</p>\n<p>The option is called <code class=\"literal\">--dbname</code> for consistency with other client applications, but because <span class=\"application\">pg_dumpall</span> needs to connect to many databases, database name in the connection string will be ignored. Use <code class=\"literal\">-l</code> option to specify the name of the database used to dump global objects and to discover what other databases should be dumped.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-h <em class=\"replaceable\"><code>host</code></em></code><br></span><span class=\"term\"><code class=\"option\">--host=<em class=\"replaceable\"><code>host</code></em></code></span></dt>\n<dd>\n<p>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 <code class=\"envar\">PGHOST</code> environment variable, if set, else a Unix domain socket connection is attempted.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-l <em class=\"replaceable\"><code>dbname</code></em></code><br></span><span class=\"term\"><code class=\"option\">--database=<em class=\"replaceable\"><code>dbname</code></em></code></span></dt>\n<dd>\n<p>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 <code class=\"literal\">postgres</code> database will be used, and if that does not exist, <code class=\"literal\">template1</code> will be used.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-p <em class=\"replaceable\"><code>port</code></em></code><br></span><span class=\"term\"><code class=\"option\">--port=<em class=\"replaceable\"><code>port</code></em></code></span></dt>\n<dd>\n<p>Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the <code class=\"envar\">PGPORT</code> environment variable, if set, or a compiled-in default.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-U <em class=\"replaceable\"><code>username</code></em></code><br></span><span class=\"term\"><code class=\"option\">--username=<em class=\"replaceable\"><code>username</code></em></code></span></dt>\n<dd>\n<p>User name to connect as.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-w</code><br></span><span class=\"term\"><code class=\"option\">--no-password</code></span></dt>\n<dd>\n<p>Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a <code class=\"filename\">.pgpass</code> 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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-W</code><br></span><span class=\"term\"><code class=\"option\">--password</code></span></dt>\n<dd>\n<p>Force <span class=\"application\">pg_dumpall</span> to prompt for a password before connecting to a database.</p>\n<p>This option is never essential, since <span class=\"application\">pg_dumpall</span> will automatically prompt for a password if the server demands password authentication. However, <span class=\"application\">pg_dumpall</span> will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing <code class=\"option\">-W</code> to avoid the extra connection attempt.</p>\n<p>Note that the password prompt will occur again for each database to be dumped. Usually, it's better to set up a <code class=\"filename\">~/.pgpass</code> file than to rely on manual password entry.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--role=<em class=\"replaceable\"><code>rolename</code></em></code></span></dt>\n<dd>\n<p>Specifies a role name to be used to create the dump. This option causes <span class=\"application\">pg_dumpall</span> to issue a <code class=\"command\">SET ROLE</code> <em class=\"replaceable\"><code>rolename</code></em> command after connecting to the database. It is useful when the authenticated user (specified by <code class=\"option\">-U</code>) lacks privileges needed by <span class=\"application\">pg_dumpall</span>, 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.</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.13.7\">\n<h2>Environment</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"envar\">PGHOST</code><br></span><span class=\"term\"><code class=\"envar\">PGOPTIONS</code><br></span><span class=\"term\"><code class=\"envar\">PGPORT</code><br></span><span class=\"term\"><code class=\"envar\">PGUSER</code></span></dt>\n<dd>\n<p>Default connection parameters</p>\n</dd>\n</dl>\n</div>\n<p>This utility, like most other <span class=\"productname\">PostgreSQL</span> utilities, also uses the environment variables supported by <span class=\"application\">libpq</span> (see <a class=\"xref\" href=\"/docs/10/libpq-envars.html\" title=\"33.14.\u00a0Environment Variables\">Section\u00a033.14</a>).</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.13.8\">\n<h2>Notes</h2>\n<p>Since <span class=\"application\">pg_dumpall</span> calls <span class=\"application\">pg_dump</span> internally, some diagnostic messages will refer to <span class=\"application\">pg_dump</span>.</p>\n<p>Once restored, it is wise to run <code class=\"command\">ANALYZE</code> on each database so the optimizer has useful statistics. You can also run <code class=\"command\">vacuumdb -a -z</code> to analyze all databases.</p>\n<p><span class=\"application\">pg_dumpall</span> requires all needed tablespace directories to exist before the restore; otherwise, database creation will fail for databases in non-default locations.</p>\n</div>\n<div class=\"refsect1\" id=\"APP-PG-DUMPALL-EX\">\n<h2>Examples</h2>\n<p>To dump all databases:</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_dumpall &gt; db.out</code></strong>\n</pre>\n<p>To reload database(s) from this file, you can use:</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>psql -f db.out postgres</code></strong>\n</pre>\n<p>(It is not important to which database you connect here since the script file created by <span class=\"application\">pg_dumpall</span> will contain the appropriate commands to create and connect to the saved databases.)</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.13.10\">\n<h2>See Also</h2>\n<p>Check <a class=\"xref\" href=\"/docs/10/app-pgdump.html\" title=\"pg_dump\"><span class=\"refentrytitle\">pg_dump</span></a> for details on possible error conditions.</p>\n</div>\n</div></div>", "manual_path": "app-pg-dumpall.html", "comparison_data": {"options": [{"names": ["-a", "--data-only"], "signature": "-a --data-only", "description": "Dump only the data, not the schema (data definitions)."}, {"names": ["-c", "--clean"], "signature": "-c --clean", "description": "Include SQL commands to clean (drop) databases before recreating them. DROP commands for roles and tablespaces are added as well."}, {"names": ["-f filename", "--file= filename"], "signature": "-f filename --file= filename", "description": "Send output to the specified file. If this is omitted, the standard output is used."}, {"names": ["-g", "--globals-only"], "signature": "-g --globals-only", "description": "Dump only global objects (roles and tablespaces), no databases."}, {"names": ["-o", "--oids"], "signature": "-o --oids", "description": "Dump object identifiers ( OID s) as part of the data for every table. Use this option if your application references the OID columns in some way (e.g., in a foreign key constraint). Otherwise, this option should not be used."}, {"names": ["-O", "--no-owner"], "signature": "-O --no-owner", "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": ["-r", "--roles-only"], "signature": "-r --roles-only", "description": "Dump only roles, no databases or tablespaces."}, {"names": ["-s", "--schema-only"], "signature": "-s --schema-only", "description": "Dump only the object definitions (schema), not data."}, {"names": ["-S username", "--superuser= username"], "signature": "-S username --superuser= username", "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": ["-t", "--tablespaces-only"], "signature": "-t --tablespaces-only", "description": "Dump only tablespaces, no databases or roles."}, {"names": ["-v", "--verbose"], "signature": "-v --verbose", "description": "Specifies verbose mode. This will cause pg_dumpall to output start/stop times to the dump file, and progress messages to standard error. It will also enable verbose output in pg_dump ."}, {"names": ["-V", "--version"], "signature": "-V --version", "description": "Print the pg_dumpall version and exit."}, {"names": ["-x", "--no-privileges", "--no-acl"], "signature": "-x --no-privileges --no-acl", "description": "Prevent dumping of access privileges (grant/revoke commands)."}, {"names": ["--binary-upgrade"], "signature": "--binary-upgrade", "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": ["--column-inserts", "--attribute-inserts"], "signature": "--column-inserts --attribute-inserts", "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": ["--disable-dollar-quoting"], "signature": "--disable-dollar-quoting", "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-triggers"], "signature": "--disable-triggers", "description": "This option is relevant only when creating a data-only dump. It instructs pg_dumpall to include commands to temporarily disable triggers on the target tables while the data is reloaded. Use this if you have referential integrity checks or other triggers on the tables that you do not want to invoke during data reload. 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": ["--if-exists"], "signature": "--if-exists", "description": "Use conditional commands (i.e., add an IF EXISTS clause) to clean databases and other objects. This option is not valid unless --clean is also specified."}, {"names": ["--inserts"], "signature": "--inserts", "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": ["--lock-wait-timeout= timeout"], "signature": "--lock-wait-timeout= timeout", "description": "Do not wait forever to acquire shared table locks at the beginning of the dump. Instead, fail if unable to lock a table within the specified timeout . The timeout may be specified in any of the formats accepted by SET statement_timeout . Allowed values vary depending on the server version you are dumping from, but an integer number of milliseconds is accepted by all versions since 7.3. This option is ignored when dumping from a pre-7.3 server."}, {"names": ["--no-publications"], "signature": "--no-publications", "description": "Do not dump publications."}, {"names": ["--no-role-passwords"], "signature": "--no-role-passwords", "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-security-labels"], "signature": "--no-security-labels", "description": "Do not dump security labels."}, {"names": ["--no-subscriptions"], "signature": "--no-subscriptions", "description": "Do not dump subscriptions."}, {"names": ["--no-sync"], "signature": "--no-sync", "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-tablespaces"], "signature": "--no-tablespaces", "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-unlogged-table-data"], "signature": "--no-unlogged-table-data", "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": ["--quote-all-identifiers"], "signature": "--quote-all-identifiers", "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": ["--use-set-session-authorization"], "signature": "--use-set-session-authorization", "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": ["-?", "--help"], "signature": "-? --help", "description": "Show help about pg_dumpall command line arguments, and exit."}, {"names": ["-d connstr", "--dbname= connstr"], "signature": "-d connstr --dbname= connstr", "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, database name in the connection string will be ignored. Use -l option to specify the name of the database used to dump global objects and to discover what other databases should be dumped."}, {"names": ["-h host", "--host= host"], "signature": "-h host --host= host", "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": ["-l dbname", "--database= dbname"], "signature": "-l dbname --database= dbname", "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": ["-p port", "--port= port"], "signature": "-p port --port= port", "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": ["-U username", "--username= username"], "signature": "-U username --username= username", "description": "User name to connect as."}, {"names": ["-w", "--no-password"], "signature": "-w --no-password", "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", "--password"], "signature": "-W --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": ["--role= rolename"], "signature": "--role= rolename", "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."}], "synopsis": ["pg_dumpall [ connection-option ...] [ option ...]"], "environment": [{"name": "PGHOST PGOPTIONS PGPORT PGUSER", "description": "Default connection parameters"}]}, "comparison_hash": "1cc99dff7530ea8095b71e6ee9b84580563d3561d73a34486560880f13e37ac3"}, "11": {"facts": [{"label": "Documented executable", "value": "pg_dumpall"}, {"label": "Executable version", "value": "11.22"}, {"label": "Reference inventory", "value": "Client applications"}, {"label": "Option definition groups", "value": "41"}], "tables": [{"key": "options", "rows": [{"summary": "Dump only the data, not the schema (data definitions).", "signature": {"url": "/docs/11/app-pg-dumpall.html", "text": "-a --data-only"}}, {"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": {"url": "/docs/11/app-pg-dumpall.html", "text": "-c --clean"}}, {"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": {"url": "/docs/11/app-pg-dumpall.html", "text": "-E encoding --encoding= encoding"}}, {"summary": "Send output to the specified file. If this is omitted, the standard output is used.", "signature": {"url": "/docs/11/app-pg-dumpall.html", "text": "-f filename --file= filename"}}, {"summary": "Dump only global objects (roles and tablespaces), no databases.", "signature": {"url": "/docs/11/app-pg-dumpall.html", "text": "-g --globals-only"}}, {"summary": "Dump object identifiers ( OID s) as part of the data for every table. Use this option if your application references the OID columns in some way (e.g., in a foreign key constraint). Otherwise, this option should not be used.", "signature": {"url": "/docs/11/app-pg-dumpall.html", "text": "-o --oids"}}, {"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": {"url": "/docs/11/app-pg-dumpall.html", "text": "-O --no-owner"}}, {"summary": "Dump only roles, no databases or tablespaces.", "signature": {"url": "/docs/11/app-pg-dumpall.html", "text": "-r --roles-only"}}, {"summary": "Dump only the object definitions (schema), not data.", "signature": {"url": "/docs/11/app-pg-dumpall.html", "text": "-s --schema-only"}}, {"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": {"url": "/docs/11/app-pg-dumpall.html", "text": "-S username --superuser= username"}}, {"summary": "Dump only tablespaces, no databases or roles.", "signature": {"url": "/docs/11/app-pg-dumpall.html", "text": "-t --tablespaces-only"}}, {"summary": "Specifies verbose mode. This will cause pg_dumpall to output start/stop times to the dump file, and progress messages to standard error. It will also enable verbose output in pg_dump .", "signature": {"url": "/docs/11/app-pg-dumpall.html", "text": "-v --verbose"}}, {"summary": "Print the pg_dumpall version and exit.", "signature": {"url": "/docs/11/app-pg-dumpall.html", "text": "-V --version"}}, {"summary": "Prevent dumping of access privileges (grant/revoke commands).", "signature": {"url": "/docs/11/app-pg-dumpall.html", "text": "-x --no-privileges --no-acl"}}, {"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": {"url": "/docs/11/app-pg-dumpall.html", "text": "--binary-upgrade"}}, {"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": {"url": "/docs/11/app-pg-dumpall.html", "text": "--column-inserts --attribute-inserts"}}, {"summary": "This option disables the use of dollar quoting for function bodies, and forces them to be quoted using SQL standard string syntax.", "signature": {"url": "/docs/11/app-pg-dumpall.html", "text": "--disable-dollar-quoting"}}, {"summary": "This option is relevant only when creating a data-only dump. 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": {"url": "/docs/11/app-pg-dumpall.html", "text": "--disable-triggers"}}, {"summary": "Use DROP ... IF EXISTS commands to drop objects in --clean mode. This suppresses \u201c does not exist \u201d errors that might otherwise be reported. This option is not valid unless --clean is also specified.", "signature": {"url": "/docs/11/app-pg-dumpall.html", "text": "--if-exists"}}, {"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": {"url": "/docs/11/app-pg-dumpall.html", "text": "--inserts"}}, {"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": {"url": "/docs/11/app-pg-dumpall.html", "text": "--load-via-partition-root"}}, {"summary": "Do not wait forever to acquire shared table locks at the beginning of the dump. Instead, fail if unable to lock a table within the specified timeout . The timeout may be specified in any of the formats accepted by SET statement_timeout . Allowed values vary depending on the server version you are dumping from, but an integer number of milliseconds is accepted by all versions since 7.3. This option is ignored when dumping from a pre-7.3 server.", "signature": {"url": "/docs/11/app-pg-dumpall.html", "text": "--lock-wait-timeout= timeout"}}, {"summary": "Do not dump comments.", "signature": {"url": "/docs/11/app-pg-dumpall.html", "text": "--no-comments"}}, {"summary": "Do not dump publications.", "signature": {"url": "/docs/11/app-pg-dumpall.html", "text": "--no-publications"}}, {"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": {"url": "/docs/11/app-pg-dumpall.html", "text": "--no-role-passwords"}}, {"summary": "Do not dump security labels.", "signature": {"url": "/docs/11/app-pg-dumpall.html", "text": "--no-security-labels"}}, {"summary": "Do not dump subscriptions.", "signature": {"url": "/docs/11/app-pg-dumpall.html", "text": "--no-subscriptions"}}, {"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": {"url": "/docs/11/app-pg-dumpall.html", "text": "--no-sync"}}, {"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": {"url": "/docs/11/app-pg-dumpall.html", "text": "--no-tablespaces"}}, {"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": {"url": "/docs/11/app-pg-dumpall.html", "text": "--no-unlogged-table-data"}}, {"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": {"url": "/docs/11/app-pg-dumpall.html", "text": "--quote-all-identifiers"}}, {"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": {"url": "/docs/11/app-pg-dumpall.html", "text": "--use-set-session-authorization"}}, {"summary": "Show help about pg_dumpall command line arguments, and exit.", "signature": {"url": "/docs/11/app-pg-dumpall.html", "text": "-? --help"}}, {"summary": "Specifies parameters used to connect to the server, as a connection string ; these will override any conflicting command line options.", "signature": {"url": "/docs/11/app-pg-dumpall.html", "text": "-d connstr --dbname= connstr"}}, {"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": {"url": "/docs/11/app-pg-dumpall.html", "text": "-h host --host= host"}}, {"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": {"url": "/docs/11/app-pg-dumpall.html", "text": "-l dbname --database= dbname"}}, {"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": {"url": "/docs/11/app-pg-dumpall.html", "text": "-p port --port= port"}}, {"summary": "User name to connect as.", "signature": {"url": "/docs/11/app-pg-dumpall.html", "text": "-U username --username= username"}}, {"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": {"url": "/docs/11/app-pg-dumpall.html", "text": "-w --no-password"}}, {"summary": "Force pg_dumpall to prompt for a password before connecting to a database.", "signature": {"url": "/docs/11/app-pg-dumpall.html", "text": "-W --password"}}, {"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.", "signature": {"url": "/docs/11/app-pg-dumpall.html", "text": "--role= rolename"}}], "title": "Documented options", "columns": [{"key": "signature", "label": "Option and arguments"}, {"key": "summary", "label": "Description"}]}, {"key": "environment", "rows": [{"name": "PGHOST PGOPTIONS PGPORT PGUSER", "description": "Default connection parameters"}], "title": "Environment variables", "columns": [{"key": "name", "label": "Variable"}, {"key": "description", "label": "Meaning"}]}], "options": [{"names": ["-a", "--data-only"], "summary": "Dump only the data, not the schema (data definitions).", "signature": "-a --data-only", "source_url": "/docs/11/app-pg-dumpall.html", "description": "Dump only the data, not the schema (data definitions)."}, {"names": ["-c", "--clean"], "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": "-c --clean", "source_url": "/docs/11/app-pg-dumpall.html", "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": ["-E encoding", "--encoding= encoding"], "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": "-E encoding --encoding= encoding", "source_url": "/docs/11/app-pg-dumpall.html", "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": ["-f filename", "--file= filename"], "summary": "Send output to the specified file. If this is omitted, the standard output is used.", "signature": "-f filename --file= filename", "source_url": "/docs/11/app-pg-dumpall.html", "description": "Send output to the specified file. If this is omitted, the standard output is used."}, {"names": ["-g", "--globals-only"], "summary": "Dump only global objects (roles and tablespaces), no databases.", "signature": "-g --globals-only", "source_url": "/docs/11/app-pg-dumpall.html", "description": "Dump only global objects (roles and tablespaces), no databases."}, {"names": ["-o", "--oids"], "summary": "Dump object identifiers ( OID s) as part of the data for every table. Use this option if your application references the OID columns in some way (e.g., in a foreign key constraint). Otherwise, this option should not be used.", "signature": "-o --oids", "source_url": "/docs/11/app-pg-dumpall.html", "description": "Dump object identifiers ( OID s) as part of the data for every table. Use this option if your application references the OID columns in some way (e.g., in a foreign key constraint). Otherwise, this option should not be used."}, {"names": ["-O", "--no-owner"], "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": "-O --no-owner", "source_url": "/docs/11/app-pg-dumpall.html", "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": ["-r", "--roles-only"], "summary": "Dump only roles, no databases or tablespaces.", "signature": "-r --roles-only", "source_url": "/docs/11/app-pg-dumpall.html", "description": "Dump only roles, no databases or tablespaces."}, {"names": ["-s", "--schema-only"], "summary": "Dump only the object definitions (schema), not data.", "signature": "-s --schema-only", "source_url": "/docs/11/app-pg-dumpall.html", "description": "Dump only the object definitions (schema), not data."}, {"names": ["-S username", "--superuser= username"], "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": "-S username --superuser= username", "source_url": "/docs/11/app-pg-dumpall.html", "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": ["-t", "--tablespaces-only"], "summary": "Dump only tablespaces, no databases or roles.", "signature": "-t --tablespaces-only", "source_url": "/docs/11/app-pg-dumpall.html", "description": "Dump only tablespaces, no databases or roles."}, {"names": ["-v", "--verbose"], "summary": "Specifies verbose mode. This will cause pg_dumpall to output start/stop times to the dump file, and progress messages to standard error. It will also enable verbose output in pg_dump .", "signature": "-v --verbose", "source_url": "/docs/11/app-pg-dumpall.html", "description": "Specifies verbose mode. This will cause pg_dumpall to output start/stop times to the dump file, and progress messages to standard error. It will also enable verbose output in pg_dump ."}, {"names": ["-V", "--version"], "summary": "Print the pg_dumpall version and exit.", "signature": "-V --version", "source_url": "/docs/11/app-pg-dumpall.html", "description": "Print the pg_dumpall version and exit."}, {"names": ["-x", "--no-privileges", "--no-acl"], "summary": "Prevent dumping of access privileges (grant/revoke commands).", "signature": "-x --no-privileges --no-acl", "source_url": "/docs/11/app-pg-dumpall.html", "description": "Prevent dumping of access privileges (grant/revoke commands)."}, {"names": ["--binary-upgrade"], "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": "--binary-upgrade", "source_url": "/docs/11/app-pg-dumpall.html", "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": ["--column-inserts", "--attribute-inserts"], "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": "--column-inserts --attribute-inserts", "source_url": "/docs/11/app-pg-dumpall.html", "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": ["--disable-dollar-quoting"], "summary": "This option disables the use of dollar quoting for function bodies, and forces them to be quoted using SQL standard string syntax.", "signature": "--disable-dollar-quoting", "source_url": "/docs/11/app-pg-dumpall.html", "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-triggers"], "summary": "This option is relevant only when creating a data-only dump. 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": "--disable-triggers", "source_url": "/docs/11/app-pg-dumpall.html", "description": "This option is relevant only when creating a data-only dump. 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": ["--if-exists"], "summary": "Use DROP ... IF EXISTS commands to drop objects in --clean mode. This suppresses \u201c does not exist \u201d errors that might otherwise be reported. This option is not valid unless --clean is also specified.", "signature": "--if-exists", "source_url": "/docs/11/app-pg-dumpall.html", "description": "Use DROP ... IF EXISTS commands to drop objects in --clean mode. This suppresses \u201c does not exist \u201d errors that might otherwise be reported. This option is not valid unless --clean is also specified."}, {"names": ["--inserts"], "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": "--inserts", "source_url": "/docs/11/app-pg-dumpall.html", "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": ["--load-via-partition-root"], "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": "--load-via-partition-root", "source_url": "/docs/11/app-pg-dumpall.html", "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": ["--lock-wait-timeout= timeout"], "summary": "Do not wait forever to acquire shared table locks at the beginning of the dump. Instead, fail if unable to lock a table within the specified timeout . The timeout may be specified in any of the formats accepted by SET statement_timeout . Allowed values vary depending on the server version you are dumping from, but an integer number of milliseconds is accepted by all versions since 7.3. This option is ignored when dumping from a pre-7.3 server.", "signature": "--lock-wait-timeout= timeout", "source_url": "/docs/11/app-pg-dumpall.html", "description": "Do not wait forever to acquire shared table locks at the beginning of the dump. Instead, fail if unable to lock a table within the specified timeout . The timeout may be specified in any of the formats accepted by SET statement_timeout . Allowed values vary depending on the server version you are dumping from, but an integer number of milliseconds is accepted by all versions since 7.3. This option is ignored when dumping from a pre-7.3 server."}, {"names": ["--no-comments"], "summary": "Do not dump comments.", "signature": "--no-comments", "source_url": "/docs/11/app-pg-dumpall.html", "description": "Do not dump comments."}, {"names": ["--no-publications"], "summary": "Do not dump publications.", "signature": "--no-publications", "source_url": "/docs/11/app-pg-dumpall.html", "description": "Do not dump publications."}, {"names": ["--no-role-passwords"], "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": "--no-role-passwords", "source_url": "/docs/11/app-pg-dumpall.html", "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-security-labels"], "summary": "Do not dump security labels.", "signature": "--no-security-labels", "source_url": "/docs/11/app-pg-dumpall.html", "description": "Do not dump security labels."}, {"names": ["--no-subscriptions"], "summary": "Do not dump subscriptions.", "signature": "--no-subscriptions", "source_url": "/docs/11/app-pg-dumpall.html", "description": "Do not dump subscriptions."}, {"names": ["--no-sync"], "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": "--no-sync", "source_url": "/docs/11/app-pg-dumpall.html", "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-tablespaces"], "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": "--no-tablespaces", "source_url": "/docs/11/app-pg-dumpall.html", "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-unlogged-table-data"], "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": "--no-unlogged-table-data", "source_url": "/docs/11/app-pg-dumpall.html", "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": ["--quote-all-identifiers"], "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": "--quote-all-identifiers", "source_url": "/docs/11/app-pg-dumpall.html", "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": ["--use-set-session-authorization"], "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": "--use-set-session-authorization", "source_url": "/docs/11/app-pg-dumpall.html", "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": ["-?", "--help"], "summary": "Show help about pg_dumpall command line arguments, and exit.", "signature": "-? --help", "source_url": "/docs/11/app-pg-dumpall.html", "description": "Show help about pg_dumpall command line arguments, and exit."}, {"names": ["-d connstr", "--dbname= connstr"], "summary": "Specifies parameters used to connect to the server, as a connection string ; these will override any conflicting command line options.", "signature": "-d connstr --dbname= connstr", "source_url": "/docs/11/app-pg-dumpall.html", "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": ["-h host", "--host= host"], "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": "-h host --host= host", "source_url": "/docs/11/app-pg-dumpall.html", "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": ["-l dbname", "--database= dbname"], "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": "-l dbname --database= dbname", "source_url": "/docs/11/app-pg-dumpall.html", "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": ["-p port", "--port= port"], "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": "-p port --port= port", "source_url": "/docs/11/app-pg-dumpall.html", "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": ["-U username", "--username= username"], "summary": "User name to connect as.", "signature": "-U username --username= username", "source_url": "/docs/11/app-pg-dumpall.html", "description": "User name to connect as."}, {"names": ["-w", "--no-password"], "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": "-w --no-password", "source_url": "/docs/11/app-pg-dumpall.html", "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", "--password"], "summary": "Force pg_dumpall to prompt for a password before connecting to a database.", "signature": "-W --password", "source_url": "/docs/11/app-pg-dumpall.html", "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": ["--role= rolename"], "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.", "signature": "--role= rolename", "source_url": "/docs/11/app-pg-dumpall.html", "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."}], "related": [{"url": "/wiki/conn/?v=11", "label": "libpq connection parameters"}], "release": {"ref": "https://ftp.postgresql.org/pub/source/v11.22/postgresql-11.22.tar.bz2", "label": "11.22", "major": "11", "channel": "historical", "manifest": {"pdf": {"A4": {"url": "/files/documentation/pdf/11/postgresql-11-A4.pdf", "bytes": 13057499, "pages": 2732, "sha256": "41d75855e610d0d9b8802b87dc5b080bef8d7e91c7cf69401fbf8d3cf801b4b5", "built_at": "2026-09-26"}, "US": {"url": "/files/documentation/pdf/11/postgresql-11-US.pdf", "bytes": 12961189, "pages": 2883, "sha256": "6a8899ef36935a5b7ed2b436207564a567a4ef1eb1c2200195876b8de4d4fa30", "built_at": "2026-09-26"}}, "tree": "11", "index": "index.html", "major": "11", "pages": 1125, "release": "11.22", "source_url": "https://ftp.postgresql.org/pub/source/v11.22/postgresql-11.22.tar.bz2", "svg_assets": 0, "source_mode": "en HTML verified against the pinned official archive", "source_sha256": "2cb7c97d7a0d7278851bbc9c61f467b69c094c72b81740b751108e7892ebe1f0"}, "revision": "53315ddaf3b3f9e6669fd1edc096bbb2cd4a65ea3e836c89e542b43af9ba3a7f", "evidence_kind": "English manual and source declarations", "source_sha256": "2cb7c97d7a0d7278851bbc9c61f467b69c094c72b81740b751108e7892ebe1f0"}, "sources": [{"url": "/docs/11/app-pg-dumpall.html", "file": "app-pg-dumpall.html", "label": "11.22 English manual \u00b7 app-pg-dumpall.html", "anchor": "", "sha256": "b76a8cba418f43c63c9f6d98f9808df26a07086249195a62921e14af7d52cdd8"}, {"url": "/docs/11/reference-client.html", "file": "reference-client.html", "label": "Client applications inventory", "anchor": "", "sha256": "3a30e696058b118a55cc42892c39671d9bae86f77e1024d5ebcc4688ad9ab4c3"}], "sections": [], "synopsis": ["pg_dumpall [ connection-option ...] [ option ...]"], "signature": "pg_dumpall [ connection-option ...] [ option ...]", "description": ["pg_dumpall \u2014 extract a PostgreSQL database cluster into a script file"], "environment": [{"name": "PGHOST PGOPTIONS PGPORT PGUSER", "description": "Default connection parameters"}], "manual_html": "<div><div class=\"refentry\" id=\"APP-PG-DUMPALL\">\n<div class=\"titlepage\"></div>\n<div class=\"refnamediv\">\n<h2><span class=\"refentrytitle\"><span class=\"application\">pg_dumpall</span></span></h2>\n<p>pg_dumpall \u2014 extract a <span class=\"productname\">PostgreSQL</span> database cluster into a script file</p>\n</div>\n<div class=\"refsynopsisdiv\">\n<h2>Synopsis</h2>\n<div class=\"cmdsynopsis\">\n<p id=\"id-1.9.4.13.4.1\"><code class=\"command\">pg_dumpall</code> [<em class=\"replaceable\"><code>connection-option</code></em>...] [<em class=\"replaceable\"><code>option</code></em>...]</p>\n</div>\n</div>\n<div class=\"refsect1\" id=\"APP-PG-DUMPALL-DESCRIPTION\">\n<h2>Description</h2>\n<p><span class=\"application\">pg_dumpall</span> is a utility for writing out (<span class=\"quote\">\u201c<span class=\"quote\">dumping</span>\u201d</span>) all <span class=\"productname\">PostgreSQL</span> databases of a cluster into one script file. The script file contains SQL commands that can be used as input to <a class=\"xref\" href=\"/docs/11/app-psql.html\" title=\"psql\"><span class=\"refentrytitle\"><span class=\"application\">psql</span></span></a> to restore the databases. It does this by calling <a class=\"xref\" href=\"/docs/11/app-pgdump.html\" title=\"pg_dump\"><span class=\"refentrytitle\">pg_dump</span></a> for each database in the cluster. <span class=\"application\">pg_dumpall</span> also dumps global objects that are common to all databases, that is, database roles and tablespaces. (<span class=\"application\">pg_dump</span> does not save these objects.)</p>\n<p>Since <span class=\"application\">pg_dumpall</span> 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.</p>\n<p>The SQL script will be written to the standard output. Use the <code class=\"option\">-f</code>/<code class=\"option\">--file</code> option or shell operators to redirect it into a file.</p>\n<p><span class=\"application\">pg_dumpall</span> needs to connect several times to the <span class=\"productname\">PostgreSQL</span> server (once per database). If you use password authentication it will ask for a password each time. It is convenient to have a <code class=\"filename\">~/.pgpass</code> file in such cases. See <a class=\"xref\" href=\"/docs/11/libpq-pgpass.html\" title=\"34.15.\u00a0The Password File\">Section\u00a034.15</a> for more information.</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.13.6\">\n<h2>Options</h2>\n<p>The following command-line options control the content and format of the output.</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-a</code><br></span><span class=\"term\"><code class=\"option\">--data-only</code></span></dt>\n<dd>\n<p>Dump only the data, not the schema (data definitions).</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-c</code><br></span><span class=\"term\"><code class=\"option\">--clean</code></span></dt>\n<dd>\n<p>Emit SQL commands to <code class=\"command\">DROP</code> 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 <code class=\"option\">--if-exists</code> is also specified.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-E <em class=\"replaceable\"><code>encoding</code></em></code><br></span><span class=\"term\"><code class=\"option\">--encoding=<em class=\"replaceable\"><code>encoding</code></em></code></span></dt>\n<dd>\n<p>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 <code class=\"envar\">PGCLIENTENCODING</code> environment variable to the desired dump encoding.)</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-f <em class=\"replaceable\"><code>filename</code></em></code><br></span><span class=\"term\"><code class=\"option\">--file=<em class=\"replaceable\"><code>filename</code></em></code></span></dt>\n<dd>\n<p>Send output to the specified file. If this is omitted, the standard output is used.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-g</code><br></span><span class=\"term\"><code class=\"option\">--globals-only</code></span></dt>\n<dd>\n<p>Dump only global objects (roles and tablespaces), no databases.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-o</code><br></span><span class=\"term\"><code class=\"option\">--oids</code></span></dt>\n<dd>\n<p>Dump object identifiers (OIDs) as part of the data for every table. Use this option if your application references the OID columns in some way (e.g., in a foreign key constraint). Otherwise, this option should not be used.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-O</code><br></span><span class=\"term\"><code class=\"option\">--no-owner</code></span></dt>\n<dd>\n<p>Do not output commands to set ownership of objects to match the original database. By default, <span class=\"application\">pg_dumpall</span> issues <code class=\"command\">ALTER OWNER</code> or <code class=\"command\">SET SESSION AUTHORIZATION</code> 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 <code class=\"option\">-O</code>.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-r</code><br></span><span class=\"term\"><code class=\"option\">--roles-only</code></span></dt>\n<dd>\n<p>Dump only roles, no databases or tablespaces.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-s</code><br></span><span class=\"term\"><code class=\"option\">--schema-only</code></span></dt>\n<dd>\n<p>Dump only the object definitions (schema), not data.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-S <em class=\"replaceable\"><code>username</code></em></code><br></span><span class=\"term\"><code class=\"option\">--superuser=<em class=\"replaceable\"><code>username</code></em></code></span></dt>\n<dd>\n<p>Specify the superuser user name to use when disabling triggers. This is relevant only if <code class=\"option\">--disable-triggers</code> is used. (Usually, it's better to leave this out, and instead start the resulting script as superuser.)</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-t</code><br></span><span class=\"term\"><code class=\"option\">--tablespaces-only</code></span></dt>\n<dd>\n<p>Dump only tablespaces, no databases or roles.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-v</code><br></span><span class=\"term\"><code class=\"option\">--verbose</code></span></dt>\n<dd>\n<p>Specifies verbose mode. This will cause <span class=\"application\">pg_dumpall</span> to output start/stop times to the dump file, and progress messages to standard error. It will also enable verbose output in <span class=\"application\">pg_dump</span>.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-V</code><br></span><span class=\"term\"><code class=\"option\">--version</code></span></dt>\n<dd>\n<p>Print the <span class=\"application\">pg_dumpall</span> version and exit.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-x</code><br></span><span class=\"term\"><code class=\"option\">--no-privileges</code><br></span><span class=\"term\"><code class=\"option\">--no-acl</code></span></dt>\n<dd>\n<p>Prevent dumping of access privileges (grant/revoke commands).</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--binary-upgrade</code></span></dt>\n<dd>\n<p>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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--column-inserts</code><br></span><span class=\"term\"><code class=\"option\">--attribute-inserts</code></span></dt>\n<dd>\n<p>Dump data as <code class=\"command\">INSERT</code> commands with explicit column names (<code class=\"literal\">INSERT INTO <em class=\"replaceable\"><code>table</code></em> (<em class=\"replaceable\"><code>column</code></em>, ...) VALUES ...</code>). This will make restoration very slow; it is mainly useful for making dumps that can be loaded into non-<span class=\"productname\">PostgreSQL</span> databases.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--disable-dollar-quoting</code></span></dt>\n<dd>\n<p>This option disables the use of dollar quoting for function bodies, and forces them to be quoted using SQL standard string syntax.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--disable-triggers</code></span></dt>\n<dd>\n<p>This option is relevant only when creating a data-only dump. It instructs <span class=\"application\">pg_dumpall</span> 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.</p>\n<p>Presently, the commands emitted for <code class=\"option\">--disable-triggers</code> must be done as superuser. So, you should also specify a superuser name with <code class=\"option\">-S</code>, or preferably be careful to start the resulting script as a superuser.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--if-exists</code></span></dt>\n<dd>\n<p>Use <code class=\"literal\">DROP ... IF EXISTS</code> commands to drop objects in <code class=\"option\">--clean</code> mode. This suppresses <span class=\"quote\">\u201c<span class=\"quote\">does not exist</span>\u201d</span> errors that might otherwise be reported. This option is not valid unless <code class=\"option\">--clean</code> is also specified.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--inserts</code></span></dt>\n<dd>\n<p>Dump data as <code class=\"command\">INSERT</code> commands (rather than <code class=\"command\">COPY</code>). This will make restoration very slow; it is mainly useful for making dumps that can be loaded into non-<span class=\"productname\">PostgreSQL</span> databases. Note that the restore might fail altogether if you have rearranged column order. The <code class=\"option\">--column-inserts</code> option is safer, though even slower.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--load-via-partition-root</code></span></dt>\n<dd>\n<p>When dumping data for a table partition, make the <code class=\"command\">COPY</code> or <code class=\"command\">INSERT</code> 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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--lock-wait-timeout=<em class=\"replaceable\"><code>timeout</code></em></code></span></dt>\n<dd>\n<p>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 <em class=\"replaceable\"><code>timeout</code></em>. The timeout may be specified in any of the formats accepted by <code class=\"command\">SET statement_timeout</code>. Allowed values vary depending on the server version you are dumping from, but an integer number of milliseconds is accepted by all versions since 7.3. This option is ignored when dumping from a pre-7.3 server.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-comments</code></span></dt>\n<dd>\n<p>Do not dump comments.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-publications</code></span></dt>\n<dd>\n<p>Do not dump publications.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-role-passwords</code></span></dt>\n<dd>\n<p>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 <code class=\"structname\">pg_roles</code> instead of <code class=\"structname\">pg_authid</code>. Therefore, this option also helps if access to <code class=\"structname\">pg_authid</code> is restricted by some security policy.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-security-labels</code></span></dt>\n<dd>\n<p>Do not dump security labels.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-subscriptions</code></span></dt>\n<dd>\n<p>Do not dump subscriptions.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-sync</code></span></dt>\n<dd>\n<p>By default, <code class=\"command\">pg_dumpall</code> will wait for all files to be written safely to disk. This option causes <code class=\"command\">pg_dumpall</code> 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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-tablespaces</code></span></dt>\n<dd>\n<p>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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-unlogged-table-data</code></span></dt>\n<dd>\n<p>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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--quote-all-identifiers</code></span></dt>\n<dd>\n<p>Force quoting of all identifiers. This option is recommended when dumping a database from a server whose <span class=\"productname\">PostgreSQL</span> major version is different from <span class=\"application\">pg_dumpall</span>'s, or when the output is intended to be loaded into a server of a different major version. By default, <span class=\"application\">pg_dumpall</span> 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 <code class=\"option\">--quote-all-identifiers</code> prevents such issues, at the price of a harder-to-read dump script.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--use-set-session-authorization</code></span></dt>\n<dd>\n<p>Output SQL-standard <code class=\"command\">SET SESSION AUTHORIZATION</code> commands instead of <code class=\"command\">ALTER OWNER</code> 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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-?</code><br></span><span class=\"term\"><code class=\"option\">--help</code></span></dt>\n<dd>\n<p>Show help about <span class=\"application\">pg_dumpall</span> command line arguments, and exit.</p>\n</dd>\n</dl>\n</div>\n<p>The following command-line options control the database connection parameters.</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-d <em class=\"replaceable\"><code>connstr</code></em></code><br></span><span class=\"term\"><code class=\"option\">--dbname=<em class=\"replaceable\"><code>connstr</code></em></code></span></dt>\n<dd>\n<p>Specifies parameters used to connect to the server, as a <a class=\"link\" href=\"/docs/11/libpq-connect.html#LIBPQ-CONNSTRING\" title=\"34.1.1.\u00a0Connection Strings\">connection string</a>; these will override any conflicting command line options.</p>\n<p>The option is called <code class=\"literal\">--dbname</code> for consistency with other client applications, but because <span class=\"application\">pg_dumpall</span> needs to connect to many databases, the database name in the connection string will be ignored. Use the <code class=\"literal\">-l</code> 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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-h <em class=\"replaceable\"><code>host</code></em></code><br></span><span class=\"term\"><code class=\"option\">--host=<em class=\"replaceable\"><code>host</code></em></code></span></dt>\n<dd>\n<p>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 <code class=\"envar\">PGHOST</code> environment variable, if set, else a Unix domain socket connection is attempted.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-l <em class=\"replaceable\"><code>dbname</code></em></code><br></span><span class=\"term\"><code class=\"option\">--database=<em class=\"replaceable\"><code>dbname</code></em></code></span></dt>\n<dd>\n<p>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 <code class=\"literal\">postgres</code> database will be used, and if that does not exist, <code class=\"literal\">template1</code> will be used.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-p <em class=\"replaceable\"><code>port</code></em></code><br></span><span class=\"term\"><code class=\"option\">--port=<em class=\"replaceable\"><code>port</code></em></code></span></dt>\n<dd>\n<p>Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the <code class=\"envar\">PGPORT</code> environment variable, if set, or a compiled-in default.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-U <em class=\"replaceable\"><code>username</code></em></code><br></span><span class=\"term\"><code class=\"option\">--username=<em class=\"replaceable\"><code>username</code></em></code></span></dt>\n<dd>\n<p>User name to connect as.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-w</code><br></span><span class=\"term\"><code class=\"option\">--no-password</code></span></dt>\n<dd>\n<p>Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a <code class=\"filename\">.pgpass</code> 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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-W</code><br></span><span class=\"term\"><code class=\"option\">--password</code></span></dt>\n<dd>\n<p>Force <span class=\"application\">pg_dumpall</span> to prompt for a password before connecting to a database.</p>\n<p>This option is never essential, since <span class=\"application\">pg_dumpall</span> will automatically prompt for a password if the server demands password authentication. However, <span class=\"application\">pg_dumpall</span> will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing <code class=\"option\">-W</code> to avoid the extra connection attempt.</p>\n<p>Note that the password prompt will occur again for each database to be dumped. Usually, it's better to set up a <code class=\"filename\">~/.pgpass</code> file than to rely on manual password entry.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--role=<em class=\"replaceable\"><code>rolename</code></em></code></span></dt>\n<dd>\n<p>Specifies a role name to be used to create the dump. This option causes <span class=\"application\">pg_dumpall</span> to issue a <code class=\"command\">SET ROLE</code> <em class=\"replaceable\"><code>rolename</code></em> command after connecting to the database. It is useful when the authenticated user (specified by <code class=\"option\">-U</code>) lacks privileges needed by <span class=\"application\">pg_dumpall</span>, 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.</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.13.7\">\n<h2>Environment</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"envar\">PGHOST</code><br></span><span class=\"term\"><code class=\"envar\">PGOPTIONS</code><br></span><span class=\"term\"><code class=\"envar\">PGPORT</code><br></span><span class=\"term\"><code class=\"envar\">PGUSER</code></span></dt>\n<dd>\n<p>Default connection parameters</p>\n</dd>\n</dl>\n</div>\n<p>This utility, like most other <span class=\"productname\">PostgreSQL</span> utilities, also uses the environment variables supported by <span class=\"application\">libpq</span> (see <a class=\"xref\" href=\"/docs/11/libpq-envars.html\" title=\"34.14.\u00a0Environment Variables\">Section\u00a034.14</a>).</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.13.8\">\n<h2>Notes</h2>\n<p>Since <span class=\"application\">pg_dumpall</span> calls <span class=\"application\">pg_dump</span> internally, some diagnostic messages will refer to <span class=\"application\">pg_dump</span>.</p>\n<p>The <code class=\"option\">--clean</code> option can be useful even when your intention is to restore the dump script into a fresh cluster. Use of <code class=\"option\">--clean</code> authorizes the script to drop and re-create the built-in <code class=\"literal\">postgres</code> and <code class=\"literal\">template1</code> 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.</p>\n<p>Once restored, it is wise to run <code class=\"command\">ANALYZE</code> on each database so the optimizer has useful statistics. You can also run <code class=\"command\">vacuumdb -a -z</code> to analyze all databases.</p>\n<p>The dump script should not be expected to run completely without errors. In particular, because the script will issue <code class=\"command\">CREATE ROLE</code> for every role existing in the source cluster, it is certain to get a <span class=\"quote\">\u201c<span class=\"quote\">role already exists</span>\u201d</span> 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 <code class=\"option\">--clean</code> option is likely to produce additional harmless error messages about non-existent objects, although you can minimize those by adding <code class=\"option\">--if-exists</code>.</p>\n<p><span class=\"application\">pg_dumpall</span> requires all needed tablespace directories to exist before the restore; otherwise, database creation will fail for databases in non-default locations.</p>\n</div>\n<div class=\"refsect1\" id=\"APP-PG-DUMPALL-EX\">\n<h2>Examples</h2>\n<p>To dump all databases:</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_dumpall &gt; db.out</code></strong>\n</pre>\n<p>To restore database(s) from this file, you can use:</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>psql -f db.out postgres</code></strong>\n</pre>\n<p>It is not important to which database you connect here since the script file created by <span class=\"application\">pg_dumpall</span> will contain the appropriate commands to create and connect to the saved databases. An exception is that if you specified <code class=\"option\">--clean</code>, you must connect to the <code class=\"literal\">postgres</code> database initially; the script will attempt to drop other databases immediately, and that will fail for the database you are connected to.</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.13.10\">\n<h2>See Also</h2>\n<p>Check <a class=\"xref\" href=\"/docs/11/app-pgdump.html\" title=\"pg_dump\"><span class=\"refentrytitle\">pg_dump</span></a> for details on possible error conditions.</p>\n</div>\n</div></div>", "manual_path": "app-pg-dumpall.html", "comparison_data": {"options": [{"names": ["-a", "--data-only"], "signature": "-a --data-only", "description": "Dump only the data, not the schema (data definitions)."}, {"names": ["-c", "--clean"], "signature": "-c --clean", "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": ["-E encoding", "--encoding= encoding"], "signature": "-E encoding --encoding= encoding", "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": ["-f filename", "--file= filename"], "signature": "-f filename --file= filename", "description": "Send output to the specified file. If this is omitted, the standard output is used."}, {"names": ["-g", "--globals-only"], "signature": "-g --globals-only", "description": "Dump only global objects (roles and tablespaces), no databases."}, {"names": ["-o", "--oids"], "signature": "-o --oids", "description": "Dump object identifiers ( OID s) as part of the data for every table. Use this option if your application references the OID columns in some way (e.g., in a foreign key constraint). Otherwise, this option should not be used."}, {"names": ["-O", "--no-owner"], "signature": "-O --no-owner", "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": ["-r", "--roles-only"], "signature": "-r --roles-only", "description": "Dump only roles, no databases or tablespaces."}, {"names": ["-s", "--schema-only"], "signature": "-s --schema-only", "description": "Dump only the object definitions (schema), not data."}, {"names": ["-S username", "--superuser= username"], "signature": "-S username --superuser= username", "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": ["-t", "--tablespaces-only"], "signature": "-t --tablespaces-only", "description": "Dump only tablespaces, no databases or roles."}, {"names": ["-v", "--verbose"], "signature": "-v --verbose", "description": "Specifies verbose mode. This will cause pg_dumpall to output start/stop times to the dump file, and progress messages to standard error. It will also enable verbose output in pg_dump ."}, {"names": ["-V", "--version"], "signature": "-V --version", "description": "Print the pg_dumpall version and exit."}, {"names": ["-x", "--no-privileges", "--no-acl"], "signature": "-x --no-privileges --no-acl", "description": "Prevent dumping of access privileges (grant/revoke commands)."}, {"names": ["--binary-upgrade"], "signature": "--binary-upgrade", "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": ["--column-inserts", "--attribute-inserts"], "signature": "--column-inserts --attribute-inserts", "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": ["--disable-dollar-quoting"], "signature": "--disable-dollar-quoting", "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-triggers"], "signature": "--disable-triggers", "description": "This option is relevant only when creating a data-only dump. 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": ["--if-exists"], "signature": "--if-exists", "description": "Use DROP ... IF EXISTS commands to drop objects in --clean mode. This suppresses \u201c does not exist \u201d errors that might otherwise be reported. This option is not valid unless --clean is also specified."}, {"names": ["--inserts"], "signature": "--inserts", "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": ["--load-via-partition-root"], "signature": "--load-via-partition-root", "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": ["--lock-wait-timeout= timeout"], "signature": "--lock-wait-timeout= timeout", "description": "Do not wait forever to acquire shared table locks at the beginning of the dump. Instead, fail if unable to lock a table within the specified timeout . The timeout may be specified in any of the formats accepted by SET statement_timeout . Allowed values vary depending on the server version you are dumping from, but an integer number of milliseconds is accepted by all versions since 7.3. This option is ignored when dumping from a pre-7.3 server."}, {"names": ["--no-comments"], "signature": "--no-comments", "description": "Do not dump comments."}, {"names": ["--no-publications"], "signature": "--no-publications", "description": "Do not dump publications."}, {"names": ["--no-role-passwords"], "signature": "--no-role-passwords", "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-security-labels"], "signature": "--no-security-labels", "description": "Do not dump security labels."}, {"names": ["--no-subscriptions"], "signature": "--no-subscriptions", "description": "Do not dump subscriptions."}, {"names": ["--no-sync"], "signature": "--no-sync", "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-tablespaces"], "signature": "--no-tablespaces", "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-unlogged-table-data"], "signature": "--no-unlogged-table-data", "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": ["--quote-all-identifiers"], "signature": "--quote-all-identifiers", "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": ["--use-set-session-authorization"], "signature": "--use-set-session-authorization", "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": ["-?", "--help"], "signature": "-? --help", "description": "Show help about pg_dumpall command line arguments, and exit."}, {"names": ["-d connstr", "--dbname= connstr"], "signature": "-d connstr --dbname= connstr", "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": ["-h host", "--host= host"], "signature": "-h host --host= host", "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": ["-l dbname", "--database= dbname"], "signature": "-l dbname --database= dbname", "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": ["-p port", "--port= port"], "signature": "-p port --port= port", "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": ["-U username", "--username= username"], "signature": "-U username --username= username", "description": "User name to connect as."}, {"names": ["-w", "--no-password"], "signature": "-w --no-password", "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", "--password"], "signature": "-W --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": ["--role= rolename"], "signature": "--role= rolename", "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."}], "synopsis": ["pg_dumpall [ connection-option ...] [ option ...]"], "environment": [{"name": "PGHOST PGOPTIONS PGPORT PGUSER", "description": "Default connection parameters"}]}, "comparison_hash": "4b7b5673f507a56d4ccdf588c3a44a0cc3783ab56162175ec17cd9c653391401"}, "12": {"facts": [{"label": "Documented executable", "value": "pg_dumpall"}, {"label": "Executable version", "value": "12.22"}, {"label": "Reference inventory", "value": "Client applications"}, {"label": "Option definition groups", "value": "44"}], "tables": [{"key": "options", "rows": [{"summary": "Dump only the data, not the schema (data definitions).", "signature": {"url": "/docs/12/app-pg-dumpall.html", "text": "-a --data-only"}}, {"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": {"url": "/docs/12/app-pg-dumpall.html", "text": "-c --clean"}}, {"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": {"url": "/docs/12/app-pg-dumpall.html", "text": "-E encoding --encoding= encoding"}}, {"summary": "Send output to the specified file. If this is omitted, the standard output is used.", "signature": {"url": "/docs/12/app-pg-dumpall.html", "text": "-f filename --file= filename"}}, {"summary": "Dump only global objects (roles and tablespaces), no databases.", "signature": {"url": "/docs/12/app-pg-dumpall.html", "text": "-g --globals-only"}}, {"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": {"url": "/docs/12/app-pg-dumpall.html", "text": "-O --no-owner"}}, {"summary": "Dump only roles, no databases or tablespaces.", "signature": {"url": "/docs/12/app-pg-dumpall.html", "text": "-r --roles-only"}}, {"summary": "Dump only the object definitions (schema), not data.", "signature": {"url": "/docs/12/app-pg-dumpall.html", "text": "-s --schema-only"}}, {"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": {"url": "/docs/12/app-pg-dumpall.html", "text": "-S username --superuser= username"}}, {"summary": "Dump only tablespaces, no databases or roles.", "signature": {"url": "/docs/12/app-pg-dumpall.html", "text": "-t --tablespaces-only"}}, {"summary": "Specifies verbose mode. This will cause pg_dumpall to output start/stop times to the dump file, and progress messages to standard error. It will also enable verbose output in pg_dump .", "signature": {"url": "/docs/12/app-pg-dumpall.html", "text": "-v --verbose"}}, {"summary": "Print the pg_dumpall version and exit.", "signature": {"url": "/docs/12/app-pg-dumpall.html", "text": "-V --version"}}, {"summary": "Prevent dumping of access privileges (grant/revoke commands).", "signature": {"url": "/docs/12/app-pg-dumpall.html", "text": "-x --no-privileges --no-acl"}}, {"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": {"url": "/docs/12/app-pg-dumpall.html", "text": "--binary-upgrade"}}, {"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": {"url": "/docs/12/app-pg-dumpall.html", "text": "--column-inserts --attribute-inserts"}}, {"summary": "This option disables the use of dollar quoting for function bodies, and forces them to be quoted using SQL standard string syntax.", "signature": {"url": "/docs/12/app-pg-dumpall.html", "text": "--disable-dollar-quoting"}}, {"summary": "This option is relevant only when creating a data-only dump. 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": {"url": "/docs/12/app-pg-dumpall.html", "text": "--disable-triggers"}}, {"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": {"url": "/docs/12/app-pg-dumpall.html", "text": "--extra-float-digits= ndigits"}}, {"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": {"url": "/docs/12/app-pg-dumpall.html", "text": "--exclude-database= pattern"}}, {"summary": "Use DROP ... IF EXISTS commands to drop objects in --clean mode. This suppresses \u201c does not exist \u201d errors that might otherwise be reported. This option is not valid unless --clean is also specified.", "signature": {"url": "/docs/12/app-pg-dumpall.html", "text": "--if-exists"}}, {"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": {"url": "/docs/12/app-pg-dumpall.html", "text": "--inserts"}}, {"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": {"url": "/docs/12/app-pg-dumpall.html", "text": "--load-via-partition-root"}}, {"summary": "Do not wait forever to acquire shared table locks at the beginning of the dump. Instead, fail if unable to lock a table within the specified timeout . The timeout may be specified in any of the formats accepted by SET statement_timeout . Allowed values vary depending on the server version you are dumping from, but an integer number of milliseconds is accepted by all versions since 7.3. This option is ignored when dumping from a pre-7.3 server.", "signature": {"url": "/docs/12/app-pg-dumpall.html", "text": "--lock-wait-timeout= timeout"}}, {"summary": "Do not dump comments.", "signature": {"url": "/docs/12/app-pg-dumpall.html", "text": "--no-comments"}}, {"summary": "Do not dump publications.", "signature": {"url": "/docs/12/app-pg-dumpall.html", "text": "--no-publications"}}, {"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": {"url": "/docs/12/app-pg-dumpall.html", "text": "--no-role-passwords"}}, {"summary": "Do not dump security labels.", "signature": {"url": "/docs/12/app-pg-dumpall.html", "text": "--no-security-labels"}}, {"summary": "Do not dump subscriptions.", "signature": {"url": "/docs/12/app-pg-dumpall.html", "text": "--no-subscriptions"}}, {"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": {"url": "/docs/12/app-pg-dumpall.html", "text": "--no-sync"}}, {"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": {"url": "/docs/12/app-pg-dumpall.html", "text": "--no-tablespaces"}}, {"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": {"url": "/docs/12/app-pg-dumpall.html", "text": "--no-unlogged-table-data"}}, {"summary": "Add ON CONFLICT DO NOTHING to INSERT commands. This option is not valid unless --inserts or --column-inserts is also specified.", "signature": {"url": "/docs/12/app-pg-dumpall.html", "text": "--on-conflict-do-nothing"}}, {"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": {"url": "/docs/12/app-pg-dumpall.html", "text": "--quote-all-identifiers"}}, {"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": {"url": "/docs/12/app-pg-dumpall.html", "text": "--rows-per-insert= nrows"}}, {"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": {"url": "/docs/12/app-pg-dumpall.html", "text": "--use-set-session-authorization"}}, {"summary": "Show help about pg_dumpall command line arguments, and exit.", "signature": {"url": "/docs/12/app-pg-dumpall.html", "text": "-? --help"}}, {"summary": "Specifies parameters used to connect to the server, as a connection string ; these will override any conflicting command line options.", "signature": {"url": "/docs/12/app-pg-dumpall.html", "text": "-d connstr --dbname= connstr"}}, {"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": {"url": "/docs/12/app-pg-dumpall.html", "text": "-h host --host= host"}}, {"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": {"url": "/docs/12/app-pg-dumpall.html", "text": "-l dbname --database= dbname"}}, {"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": {"url": "/docs/12/app-pg-dumpall.html", "text": "-p port --port= port"}}, {"summary": "User name to connect as.", "signature": {"url": "/docs/12/app-pg-dumpall.html", "text": "-U username --username= username"}}, {"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": {"url": "/docs/12/app-pg-dumpall.html", "text": "-w --no-password"}}, {"summary": "Force pg_dumpall to prompt for a password before connecting to a database.", "signature": {"url": "/docs/12/app-pg-dumpall.html", "text": "-W --password"}}, {"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.", "signature": {"url": "/docs/12/app-pg-dumpall.html", "text": "--role= rolename"}}], "title": "Documented options", "columns": [{"key": "signature", "label": "Option and arguments"}, {"key": "summary", "label": "Description"}]}, {"key": "environment", "rows": [{"name": "PGHOST PGOPTIONS PGPORT PGUSER", "description": "Default connection parameters"}, {"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}], "title": "Environment variables", "columns": [{"key": "name", "label": "Variable"}, {"key": "description", "label": "Meaning"}]}], "options": [{"names": ["-a", "--data-only"], "summary": "Dump only the data, not the schema (data definitions).", "signature": "-a --data-only", "source_url": "/docs/12/app-pg-dumpall.html", "description": "Dump only the data, not the schema (data definitions)."}, {"names": ["-c", "--clean"], "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": "-c --clean", "source_url": "/docs/12/app-pg-dumpall.html", "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": ["-E encoding", "--encoding= encoding"], "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": "-E encoding --encoding= encoding", "source_url": "/docs/12/app-pg-dumpall.html", "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": ["-f filename", "--file= filename"], "summary": "Send output to the specified file. If this is omitted, the standard output is used.", "signature": "-f filename --file= filename", "source_url": "/docs/12/app-pg-dumpall.html", "description": "Send output to the specified file. If this is omitted, the standard output is used."}, {"names": ["-g", "--globals-only"], "summary": "Dump only global objects (roles and tablespaces), no databases.", "signature": "-g --globals-only", "source_url": "/docs/12/app-pg-dumpall.html", "description": "Dump only global objects (roles and tablespaces), no databases."}, {"names": ["-O", "--no-owner"], "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": "-O --no-owner", "source_url": "/docs/12/app-pg-dumpall.html", "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": ["-r", "--roles-only"], "summary": "Dump only roles, no databases or tablespaces.", "signature": "-r --roles-only", "source_url": "/docs/12/app-pg-dumpall.html", "description": "Dump only roles, no databases or tablespaces."}, {"names": ["-s", "--schema-only"], "summary": "Dump only the object definitions (schema), not data.", "signature": "-s --schema-only", "source_url": "/docs/12/app-pg-dumpall.html", "description": "Dump only the object definitions (schema), not data."}, {"names": ["-S username", "--superuser= username"], "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": "-S username --superuser= username", "source_url": "/docs/12/app-pg-dumpall.html", "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": ["-t", "--tablespaces-only"], "summary": "Dump only tablespaces, no databases or roles.", "signature": "-t --tablespaces-only", "source_url": "/docs/12/app-pg-dumpall.html", "description": "Dump only tablespaces, no databases or roles."}, {"names": ["-v", "--verbose"], "summary": "Specifies verbose mode. This will cause pg_dumpall to output start/stop times to the dump file, and progress messages to standard error. It will also enable verbose output in pg_dump .", "signature": "-v --verbose", "source_url": "/docs/12/app-pg-dumpall.html", "description": "Specifies verbose mode. This will cause pg_dumpall to output start/stop times to the dump file, and progress messages to standard error. It will also enable verbose output in pg_dump ."}, {"names": ["-V", "--version"], "summary": "Print the pg_dumpall version and exit.", "signature": "-V --version", "source_url": "/docs/12/app-pg-dumpall.html", "description": "Print the pg_dumpall version and exit."}, {"names": ["-x", "--no-privileges", "--no-acl"], "summary": "Prevent dumping of access privileges (grant/revoke commands).", "signature": "-x --no-privileges --no-acl", "source_url": "/docs/12/app-pg-dumpall.html", "description": "Prevent dumping of access privileges (grant/revoke commands)."}, {"names": ["--binary-upgrade"], "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": "--binary-upgrade", "source_url": "/docs/12/app-pg-dumpall.html", "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": ["--column-inserts", "--attribute-inserts"], "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": "--column-inserts --attribute-inserts", "source_url": "/docs/12/app-pg-dumpall.html", "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": ["--disable-dollar-quoting"], "summary": "This option disables the use of dollar quoting for function bodies, and forces them to be quoted using SQL standard string syntax.", "signature": "--disable-dollar-quoting", "source_url": "/docs/12/app-pg-dumpall.html", "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-triggers"], "summary": "This option is relevant only when creating a data-only dump. 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": "--disable-triggers", "source_url": "/docs/12/app-pg-dumpall.html", "description": "This option is relevant only when creating a data-only dump. 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": ["--extra-float-digits= ndigits"], "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": "--extra-float-digits= ndigits", "source_url": "/docs/12/app-pg-dumpall.html", "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": ["--exclude-database= pattern"], "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": "--exclude-database= pattern", "source_url": "/docs/12/app-pg-dumpall.html", "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": ["--if-exists"], "summary": "Use DROP ... IF EXISTS commands to drop objects in --clean mode. This suppresses \u201c does not exist \u201d errors that might otherwise be reported. This option is not valid unless --clean is also specified.", "signature": "--if-exists", "source_url": "/docs/12/app-pg-dumpall.html", "description": "Use DROP ... IF EXISTS commands to drop objects in --clean mode. This suppresses \u201c does not exist \u201d errors that might otherwise be reported. This option is not valid unless --clean is also specified."}, {"names": ["--inserts"], "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": "--inserts", "source_url": "/docs/12/app-pg-dumpall.html", "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": ["--load-via-partition-root"], "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": "--load-via-partition-root", "source_url": "/docs/12/app-pg-dumpall.html", "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": ["--lock-wait-timeout= timeout"], "summary": "Do not wait forever to acquire shared table locks at the beginning of the dump. Instead, fail if unable to lock a table within the specified timeout . The timeout may be specified in any of the formats accepted by SET statement_timeout . Allowed values vary depending on the server version you are dumping from, but an integer number of milliseconds is accepted by all versions since 7.3. This option is ignored when dumping from a pre-7.3 server.", "signature": "--lock-wait-timeout= timeout", "source_url": "/docs/12/app-pg-dumpall.html", "description": "Do not wait forever to acquire shared table locks at the beginning of the dump. Instead, fail if unable to lock a table within the specified timeout . The timeout may be specified in any of the formats accepted by SET statement_timeout . Allowed values vary depending on the server version you are dumping from, but an integer number of milliseconds is accepted by all versions since 7.3. This option is ignored when dumping from a pre-7.3 server."}, {"names": ["--no-comments"], "summary": "Do not dump comments.", "signature": "--no-comments", "source_url": "/docs/12/app-pg-dumpall.html", "description": "Do not dump comments."}, {"names": ["--no-publications"], "summary": "Do not dump publications.", "signature": "--no-publications", "source_url": "/docs/12/app-pg-dumpall.html", "description": "Do not dump publications."}, {"names": ["--no-role-passwords"], "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": "--no-role-passwords", "source_url": "/docs/12/app-pg-dumpall.html", "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-security-labels"], "summary": "Do not dump security labels.", "signature": "--no-security-labels", "source_url": "/docs/12/app-pg-dumpall.html", "description": "Do not dump security labels."}, {"names": ["--no-subscriptions"], "summary": "Do not dump subscriptions.", "signature": "--no-subscriptions", "source_url": "/docs/12/app-pg-dumpall.html", "description": "Do not dump subscriptions."}, {"names": ["--no-sync"], "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": "--no-sync", "source_url": "/docs/12/app-pg-dumpall.html", "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-tablespaces"], "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": "--no-tablespaces", "source_url": "/docs/12/app-pg-dumpall.html", "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-unlogged-table-data"], "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": "--no-unlogged-table-data", "source_url": "/docs/12/app-pg-dumpall.html", "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": ["--on-conflict-do-nothing"], "summary": "Add ON CONFLICT DO NOTHING to INSERT commands. This option is not valid unless --inserts or --column-inserts is also specified.", "signature": "--on-conflict-do-nothing", "source_url": "/docs/12/app-pg-dumpall.html", "description": "Add ON CONFLICT DO NOTHING to INSERT commands. This option is not valid unless --inserts or --column-inserts is also specified."}, {"names": ["--quote-all-identifiers"], "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": "--quote-all-identifiers", "source_url": "/docs/12/app-pg-dumpall.html", "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": ["--rows-per-insert= nrows"], "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": "--rows-per-insert= nrows", "source_url": "/docs/12/app-pg-dumpall.html", "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": ["--use-set-session-authorization"], "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": "--use-set-session-authorization", "source_url": "/docs/12/app-pg-dumpall.html", "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": ["-?", "--help"], "summary": "Show help about pg_dumpall command line arguments, and exit.", "signature": "-? --help", "source_url": "/docs/12/app-pg-dumpall.html", "description": "Show help about pg_dumpall command line arguments, and exit."}, {"names": ["-d connstr", "--dbname= connstr"], "summary": "Specifies parameters used to connect to the server, as a connection string ; these will override any conflicting command line options.", "signature": "-d connstr --dbname= connstr", "source_url": "/docs/12/app-pg-dumpall.html", "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": ["-h host", "--host= host"], "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": "-h host --host= host", "source_url": "/docs/12/app-pg-dumpall.html", "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": ["-l dbname", "--database= dbname"], "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": "-l dbname --database= dbname", "source_url": "/docs/12/app-pg-dumpall.html", "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": ["-p port", "--port= port"], "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": "-p port --port= port", "source_url": "/docs/12/app-pg-dumpall.html", "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": ["-U username", "--username= username"], "summary": "User name to connect as.", "signature": "-U username --username= username", "source_url": "/docs/12/app-pg-dumpall.html", "description": "User name to connect as."}, {"names": ["-w", "--no-password"], "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": "-w --no-password", "source_url": "/docs/12/app-pg-dumpall.html", "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", "--password"], "summary": "Force pg_dumpall to prompt for a password before connecting to a database.", "signature": "-W --password", "source_url": "/docs/12/app-pg-dumpall.html", "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": ["--role= rolename"], "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.", "signature": "--role= rolename", "source_url": "/docs/12/app-pg-dumpall.html", "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."}], "related": [{"url": "/wiki/conn/?v=12", "label": "libpq connection parameters"}], "release": {"ref": "https://ftp.postgresql.org/pub/source/v12.22/postgresql-12.22.tar.bz2", "label": "12.22", "major": "12", "channel": "historical", "manifest": {"pdf": {"A4": {"url": "/files/documentation/pdf/12/postgresql-12-A4.pdf", "bytes": 13424351, "pages": 2803, "sha256": "7422cf53fd1939e7a3d2925231a88b0330e468afa5393627cac0ff86158a0621", "built_at": "2026-09-26"}, "US": {"url": "/files/documentation/pdf/12/postgresql-12-US.pdf", "bytes": 13322565, "pages": 2958, "sha256": "51f3b04e72907fc38512685946223452ea65f84419c60c66241dfa3396035e77", "built_at": "2026-09-26"}}, "tree": "12", "index": "index.html", "major": "12", "pages": 1131, "release": "12.22", "source_url": "https://ftp.postgresql.org/pub/source/v12.22/postgresql-12.22.tar.bz2", "svg_assets": 2, "source_mode": "en HTML verified against the pinned official archive", "source_sha256": "8df3c0474782589d3c6f374b5133b1bd14d168086edbc13c6e72e67dd4527a3b"}, "revision": "7a827e97cbfacd7febff75f34443e2043e40723de5b6d8c9d81a9430b65a37e4", "evidence_kind": "English manual and source declarations", "source_sha256": "8df3c0474782589d3c6f374b5133b1bd14d168086edbc13c6e72e67dd4527a3b"}, "sources": [{"url": "/docs/12/app-pg-dumpall.html", "file": "app-pg-dumpall.html", "label": "12.22 English manual \u00b7 app-pg-dumpall.html", "anchor": "", "sha256": "c15edf1a2bffa2fd758886d3ea45a69094c71a140d9417dfc162eb62e6612fef"}, {"url": "/docs/12/reference-client.html", "file": "reference-client.html", "label": "Client applications inventory", "anchor": "", "sha256": "089624dd131f52eea682b304f87a1acb03392ee7bcf78b000699c9b17c7ca22d"}], "sections": [], "synopsis": ["pg_dumpall [ connection-option ...] [ option ...]"], "signature": "pg_dumpall [ connection-option ...] [ option ...]", "description": ["pg_dumpall \u2014 extract a PostgreSQL database cluster into a script file"], "environment": [{"name": "PGHOST PGOPTIONS PGPORT PGUSER", "description": "Default connection parameters"}, {"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}], "manual_html": "<div><div class=\"refentry\" id=\"APP-PG-DUMPALL\">\n<div class=\"titlepage\"></div>\n<div class=\"refnamediv\">\n<h2><span class=\"refentrytitle\"><span class=\"application\">pg_dumpall</span></span></h2>\n<p>pg_dumpall \u2014 extract a <span class=\"productname\">PostgreSQL</span> database cluster into a script file</p>\n</div>\n<div class=\"refsynopsisdiv\">\n<h2>Synopsis</h2>\n<div class=\"cmdsynopsis\">\n<p id=\"id-1.9.4.13.4.1\"><code class=\"command\">pg_dumpall</code> [<em class=\"replaceable\"><code>connection-option</code></em>...] [<em class=\"replaceable\"><code>option</code></em>...]</p>\n</div>\n</div>\n<div class=\"refsect1\" id=\"APP-PG-DUMPALL-DESCRIPTION\">\n<h2>Description</h2>\n<p><span class=\"application\">pg_dumpall</span> is a utility for writing out (<span class=\"quote\">\u201c<span class=\"quote\">dumping</span>\u201d</span>) all <span class=\"productname\">PostgreSQL</span> databases of a cluster into one script file. The script file contains SQL commands that can be used as input to <a class=\"xref\" href=\"/docs/12/app-psql.html\" title=\"psql\"><span class=\"refentrytitle\"><span class=\"application\">psql</span></span></a> to restore the databases. It does this by calling <a class=\"xref\" href=\"/docs/12/app-pgdump.html\" title=\"pg_dump\"><span class=\"refentrytitle\">pg_dump</span></a> for each database in the cluster. <span class=\"application\">pg_dumpall</span> also dumps global objects that are common to all databases, that is, database roles and tablespaces. (<span class=\"application\">pg_dump</span> does not save these objects.)</p>\n<p>Since <span class=\"application\">pg_dumpall</span> 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.</p>\n<p>The SQL script will be written to the standard output. Use the <code class=\"option\">-f</code>/<code class=\"option\">--file</code> option or shell operators to redirect it into a file.</p>\n<p><span class=\"application\">pg_dumpall</span> needs to connect several times to the <span class=\"productname\">PostgreSQL</span> server (once per database). If you use password authentication it will ask for a password each time. It is convenient to have a <code class=\"filename\">~/.pgpass</code> file in such cases. See <a class=\"xref\" href=\"/docs/12/libpq-pgpass.html\" title=\"33.15.\u00a0The Password File\">Section\u00a033.15</a> for more information.</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.13.6\">\n<h2>Options</h2>\n<p>The following command-line options control the content and format of the output.</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-a</code><br></span><span class=\"term\"><code class=\"option\">--data-only</code></span></dt>\n<dd>\n<p>Dump only the data, not the schema (data definitions).</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-c</code><br></span><span class=\"term\"><code class=\"option\">--clean</code></span></dt>\n<dd>\n<p>Emit SQL commands to <code class=\"command\">DROP</code> 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 <code class=\"option\">--if-exists</code> is also specified.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-E <em class=\"replaceable\"><code>encoding</code></em></code><br></span><span class=\"term\"><code class=\"option\">--encoding=<em class=\"replaceable\"><code>encoding</code></em></code></span></dt>\n<dd>\n<p>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 <code class=\"envar\">PGCLIENTENCODING</code> environment variable to the desired dump encoding.)</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-f <em class=\"replaceable\"><code>filename</code></em></code><br></span><span class=\"term\"><code class=\"option\">--file=<em class=\"replaceable\"><code>filename</code></em></code></span></dt>\n<dd>\n<p>Send output to the specified file. If this is omitted, the standard output is used.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-g</code><br></span><span class=\"term\"><code class=\"option\">--globals-only</code></span></dt>\n<dd>\n<p>Dump only global objects (roles and tablespaces), no databases.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-O</code><br></span><span class=\"term\"><code class=\"option\">--no-owner</code></span></dt>\n<dd>\n<p>Do not output commands to set ownership of objects to match the original database. By default, <span class=\"application\">pg_dumpall</span> issues <code class=\"command\">ALTER OWNER</code> or <code class=\"command\">SET SESSION AUTHORIZATION</code> 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 <code class=\"option\">-O</code>.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-r</code><br></span><span class=\"term\"><code class=\"option\">--roles-only</code></span></dt>\n<dd>\n<p>Dump only roles, no databases or tablespaces.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-s</code><br></span><span class=\"term\"><code class=\"option\">--schema-only</code></span></dt>\n<dd>\n<p>Dump only the object definitions (schema), not data.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-S <em class=\"replaceable\"><code>username</code></em></code><br></span><span class=\"term\"><code class=\"option\">--superuser=<em class=\"replaceable\"><code>username</code></em></code></span></dt>\n<dd>\n<p>Specify the superuser user name to use when disabling triggers. This is relevant only if <code class=\"option\">--disable-triggers</code> is used. (Usually, it's better to leave this out, and instead start the resulting script as superuser.)</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-t</code><br></span><span class=\"term\"><code class=\"option\">--tablespaces-only</code></span></dt>\n<dd>\n<p>Dump only tablespaces, no databases or roles.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-v</code><br></span><span class=\"term\"><code class=\"option\">--verbose</code></span></dt>\n<dd>\n<p>Specifies verbose mode. This will cause <span class=\"application\">pg_dumpall</span> to output start/stop times to the dump file, and progress messages to standard error. It will also enable verbose output in <span class=\"application\">pg_dump</span>.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-V</code><br></span><span class=\"term\"><code class=\"option\">--version</code></span></dt>\n<dd>\n<p>Print the <span class=\"application\">pg_dumpall</span> version and exit.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-x</code><br></span><span class=\"term\"><code class=\"option\">--no-privileges</code><br></span><span class=\"term\"><code class=\"option\">--no-acl</code></span></dt>\n<dd>\n<p>Prevent dumping of access privileges (grant/revoke commands).</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--binary-upgrade</code></span></dt>\n<dd>\n<p>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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--column-inserts</code><br></span><span class=\"term\"><code class=\"option\">--attribute-inserts</code></span></dt>\n<dd>\n<p>Dump data as <code class=\"command\">INSERT</code> commands with explicit column names (<code class=\"literal\">INSERT INTO <em class=\"replaceable\"><code>table</code></em> (<em class=\"replaceable\"><code>column</code></em>, ...) VALUES ...</code>). This will make restoration very slow; it is mainly useful for making dumps that can be loaded into non-<span class=\"productname\">PostgreSQL</span> databases.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--disable-dollar-quoting</code></span></dt>\n<dd>\n<p>This option disables the use of dollar quoting for function bodies, and forces them to be quoted using SQL standard string syntax.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--disable-triggers</code></span></dt>\n<dd>\n<p>This option is relevant only when creating a data-only dump. It instructs <span class=\"application\">pg_dumpall</span> 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.</p>\n<p>Presently, the commands emitted for <code class=\"option\">--disable-triggers</code> must be done as superuser. So, you should also specify a superuser name with <code class=\"option\">-S</code>, or preferably be careful to start the resulting script as a superuser.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--extra-float-digits=<em class=\"replaceable\"><code>ndigits</code></em></code></span></dt>\n<dd>\n<p>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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--exclude-database=<em class=\"replaceable\"><code>pattern</code></em></code></span></dt>\n<dd>\n<p>Do not dump databases whose name matches <em class=\"replaceable\"><code>pattern</code></em>. Multiple patterns can be excluded by writing multiple <code class=\"option\">--exclude-database</code> switches. The <em class=\"replaceable\"><code>pattern</code></em> parameter is interpreted as a pattern according to the same rules used by <span class=\"application\">psql</span>'s <code class=\"literal\">\\d</code> commands (see <a class=\"xref\" href=\"/docs/12/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\">Patterns</a>), 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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--if-exists</code></span></dt>\n<dd>\n<p>Use <code class=\"literal\">DROP ... IF EXISTS</code> commands to drop objects in <code class=\"option\">--clean</code> mode. This suppresses <span class=\"quote\">\u201c<span class=\"quote\">does not exist</span>\u201d</span> errors that might otherwise be reported. This option is not valid unless <code class=\"option\">--clean</code> is also specified.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--inserts</code></span></dt>\n<dd>\n<p>Dump data as <code class=\"command\">INSERT</code> commands (rather than <code class=\"command\">COPY</code>). This will make restoration very slow; it is mainly useful for making dumps that can be loaded into non-<span class=\"productname\">PostgreSQL</span> databases. Note that the restore might fail altogether if you have rearranged column order. The <code class=\"option\">--column-inserts</code> option is safer, though even slower.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--load-via-partition-root</code></span></dt>\n<dd>\n<p>When dumping data for a table partition, make the <code class=\"command\">COPY</code> or <code class=\"command\">INSERT</code> 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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--lock-wait-timeout=<em class=\"replaceable\"><code>timeout</code></em></code></span></dt>\n<dd>\n<p>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 <em class=\"replaceable\"><code>timeout</code></em>. The timeout may be specified in any of the formats accepted by <code class=\"command\">SET statement_timeout</code>. Allowed values vary depending on the server version you are dumping from, but an integer number of milliseconds is accepted by all versions since 7.3. This option is ignored when dumping from a pre-7.3 server.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-comments</code></span></dt>\n<dd>\n<p>Do not dump comments.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-publications</code></span></dt>\n<dd>\n<p>Do not dump publications.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-role-passwords</code></span></dt>\n<dd>\n<p>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 <code class=\"structname\">pg_roles</code> instead of <code class=\"structname\">pg_authid</code>. Therefore, this option also helps if access to <code class=\"structname\">pg_authid</code> is restricted by some security policy.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-security-labels</code></span></dt>\n<dd>\n<p>Do not dump security labels.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-subscriptions</code></span></dt>\n<dd>\n<p>Do not dump subscriptions.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-sync</code></span></dt>\n<dd>\n<p>By default, <code class=\"command\">pg_dumpall</code> will wait for all files to be written safely to disk. This option causes <code class=\"command\">pg_dumpall</code> 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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-tablespaces</code></span></dt>\n<dd>\n<p>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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-unlogged-table-data</code></span></dt>\n<dd>\n<p>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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--on-conflict-do-nothing</code></span></dt>\n<dd>\n<p>Add <code class=\"literal\">ON CONFLICT DO NOTHING</code> to <code class=\"command\">INSERT</code> commands. This option is not valid unless <code class=\"option\">--inserts</code> or <code class=\"option\">--column-inserts</code> is also specified.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--quote-all-identifiers</code></span></dt>\n<dd>\n<p>Force quoting of all identifiers. This option is recommended when dumping a database from a server whose <span class=\"productname\">PostgreSQL</span> major version is different from <span class=\"application\">pg_dumpall</span>'s, or when the output is intended to be loaded into a server of a different major version. By default, <span class=\"application\">pg_dumpall</span> 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 <code class=\"option\">--quote-all-identifiers</code> prevents such issues, at the price of a harder-to-read dump script.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--rows-per-insert=<em class=\"replaceable\"><code>nrows</code></em></code></span></dt>\n<dd>\n<p>Dump data as <code class=\"command\">INSERT</code> commands (rather than <code class=\"command\">COPY</code>). Controls the maximum number of rows per <code class=\"command\">INSERT</code> 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 <code class=\"command\">INSERT</code> to be lost, rather than the entire table contents.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--use-set-session-authorization</code></span></dt>\n<dd>\n<p>Output SQL-standard <code class=\"command\">SET SESSION AUTHORIZATION</code> commands instead of <code class=\"command\">ALTER OWNER</code> 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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-?</code><br></span><span class=\"term\"><code class=\"option\">--help</code></span></dt>\n<dd>\n<p>Show help about <span class=\"application\">pg_dumpall</span> command line arguments, and exit.</p>\n</dd>\n</dl>\n</div>\n<p>The following command-line options control the database connection parameters.</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-d <em class=\"replaceable\"><code>connstr</code></em></code><br></span><span class=\"term\"><code class=\"option\">--dbname=<em class=\"replaceable\"><code>connstr</code></em></code></span></dt>\n<dd>\n<p>Specifies parameters used to connect to the server, as a <a class=\"link\" href=\"/docs/12/libpq-connect.html#LIBPQ-CONNSTRING\" title=\"33.1.1.\u00a0Connection Strings\">connection string</a>; these will override any conflicting command line options.</p>\n<p>The option is called <code class=\"literal\">--dbname</code> for consistency with other client applications, but because <span class=\"application\">pg_dumpall</span> needs to connect to many databases, the database name in the connection string will be ignored. Use the <code class=\"literal\">-l</code> 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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-h <em class=\"replaceable\"><code>host</code></em></code><br></span><span class=\"term\"><code class=\"option\">--host=<em class=\"replaceable\"><code>host</code></em></code></span></dt>\n<dd>\n<p>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 <code class=\"envar\">PGHOST</code> environment variable, if set, else a Unix domain socket connection is attempted.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-l <em class=\"replaceable\"><code>dbname</code></em></code><br></span><span class=\"term\"><code class=\"option\">--database=<em class=\"replaceable\"><code>dbname</code></em></code></span></dt>\n<dd>\n<p>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 <code class=\"literal\">postgres</code> database will be used, and if that does not exist, <code class=\"literal\">template1</code> will be used.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-p <em class=\"replaceable\"><code>port</code></em></code><br></span><span class=\"term\"><code class=\"option\">--port=<em class=\"replaceable\"><code>port</code></em></code></span></dt>\n<dd>\n<p>Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the <code class=\"envar\">PGPORT</code> environment variable, if set, or a compiled-in default.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-U <em class=\"replaceable\"><code>username</code></em></code><br></span><span class=\"term\"><code class=\"option\">--username=<em class=\"replaceable\"><code>username</code></em></code></span></dt>\n<dd>\n<p>User name to connect as.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-w</code><br></span><span class=\"term\"><code class=\"option\">--no-password</code></span></dt>\n<dd>\n<p>Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a <code class=\"filename\">.pgpass</code> 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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-W</code><br></span><span class=\"term\"><code class=\"option\">--password</code></span></dt>\n<dd>\n<p>Force <span class=\"application\">pg_dumpall</span> to prompt for a password before connecting to a database.</p>\n<p>This option is never essential, since <span class=\"application\">pg_dumpall</span> will automatically prompt for a password if the server demands password authentication. However, <span class=\"application\">pg_dumpall</span> will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing <code class=\"option\">-W</code> to avoid the extra connection attempt.</p>\n<p>Note that the password prompt will occur again for each database to be dumped. Usually, it's better to set up a <code class=\"filename\">~/.pgpass</code> file than to rely on manual password entry.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--role=<em class=\"replaceable\"><code>rolename</code></em></code></span></dt>\n<dd>\n<p>Specifies a role name to be used to create the dump. This option causes <span class=\"application\">pg_dumpall</span> to issue a <code class=\"command\">SET ROLE</code> <em class=\"replaceable\"><code>rolename</code></em> command after connecting to the database. It is useful when the authenticated user (specified by <code class=\"option\">-U</code>) lacks privileges needed by <span class=\"application\">pg_dumpall</span>, 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.</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.13.7\">\n<h2>Environment</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"envar\">PGHOST</code><br></span><span class=\"term\"><code class=\"envar\">PGOPTIONS</code><br></span><span class=\"term\"><code class=\"envar\">PGPORT</code><br></span><span class=\"term\"><code class=\"envar\">PGUSER</code></span></dt>\n<dd>\n<p>Default connection parameters</p>\n</dd>\n<dt><span class=\"term\"><code class=\"envar\">PG_COLOR</code></span></dt>\n<dd>\n<p>Specifies whether to use color in diagnostic messages. Possible values are <code class=\"literal\">always</code>, <code class=\"literal\">auto</code> and <code class=\"literal\">never</code>.</p>\n</dd>\n</dl>\n</div>\n<p>This utility, like most other <span class=\"productname\">PostgreSQL</span> utilities, also uses the environment variables supported by <span class=\"application\">libpq</span> (see <a class=\"xref\" href=\"/docs/12/libpq-envars.html\" title=\"33.14.\u00a0Environment Variables\">Section\u00a033.14</a>).</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.13.8\">\n<h2>Notes</h2>\n<p>Since <span class=\"application\">pg_dumpall</span> calls <span class=\"application\">pg_dump</span> internally, some diagnostic messages will refer to <span class=\"application\">pg_dump</span>.</p>\n<p>The <code class=\"option\">--clean</code> option can be useful even when your intention is to restore the dump script into a fresh cluster. Use of <code class=\"option\">--clean</code> authorizes the script to drop and re-create the built-in <code class=\"literal\">postgres</code> and <code class=\"literal\">template1</code> 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.</p>\n<p>Once restored, it is wise to run <code class=\"command\">ANALYZE</code> on each database so the optimizer has useful statistics. You can also run <code class=\"command\">vacuumdb -a -z</code> to analyze all databases.</p>\n<p>The dump script should not be expected to run completely without errors. In particular, because the script will issue <code class=\"command\">CREATE ROLE</code> for every role existing in the source cluster, it is certain to get a <span class=\"quote\">\u201c<span class=\"quote\">role already exists</span>\u201d</span> 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 <code class=\"option\">--clean</code> option is likely to produce additional harmless error messages about non-existent objects, although you can minimize those by adding <code class=\"option\">--if-exists</code>.</p>\n<p><span class=\"application\">pg_dumpall</span> requires all needed tablespace directories to exist before the restore; otherwise, database creation will fail for databases in non-default locations.</p>\n</div>\n<div class=\"refsect1\" id=\"APP-PG-DUMPALL-EX\">\n<h2>Examples</h2>\n<p>To dump all databases:</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_dumpall &gt; db.out</code></strong>\n</pre>\n<p>To restore database(s) from this file, you can use:</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>psql -f db.out postgres</code></strong>\n</pre>\n<p>It is not important to which database you connect here since the script file created by <span class=\"application\">pg_dumpall</span> will contain the appropriate commands to create and connect to the saved databases. An exception is that if you specified <code class=\"option\">--clean</code>, you must connect to the <code class=\"literal\">postgres</code> database initially; the script will attempt to drop other databases immediately, and that will fail for the database you are connected to.</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.13.10\">\n<h2>See Also</h2>\n<p>Check <a class=\"xref\" href=\"/docs/12/app-pgdump.html\" title=\"pg_dump\"><span class=\"refentrytitle\">pg_dump</span></a> for details on possible error conditions.</p>\n</div>\n</div></div>", "manual_path": "app-pg-dumpall.html", "comparison_data": {"options": [{"names": ["-a", "--data-only"], "signature": "-a --data-only", "description": "Dump only the data, not the schema (data definitions)."}, {"names": ["-c", "--clean"], "signature": "-c --clean", "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": ["-E encoding", "--encoding= encoding"], "signature": "-E encoding --encoding= encoding", "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": ["-f filename", "--file= filename"], "signature": "-f filename --file= filename", "description": "Send output to the specified file. If this is omitted, the standard output is used."}, {"names": ["-g", "--globals-only"], "signature": "-g --globals-only", "description": "Dump only global objects (roles and tablespaces), no databases."}, {"names": ["-O", "--no-owner"], "signature": "-O --no-owner", "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": ["-r", "--roles-only"], "signature": "-r --roles-only", "description": "Dump only roles, no databases or tablespaces."}, {"names": ["-s", "--schema-only"], "signature": "-s --schema-only", "description": "Dump only the object definitions (schema), not data."}, {"names": ["-S username", "--superuser= username"], "signature": "-S username --superuser= username", "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": ["-t", "--tablespaces-only"], "signature": "-t --tablespaces-only", "description": "Dump only tablespaces, no databases or roles."}, {"names": ["-v", "--verbose"], "signature": "-v --verbose", "description": "Specifies verbose mode. This will cause pg_dumpall to output start/stop times to the dump file, and progress messages to standard error. It will also enable verbose output in pg_dump ."}, {"names": ["-V", "--version"], "signature": "-V --version", "description": "Print the pg_dumpall version and exit."}, {"names": ["-x", "--no-privileges", "--no-acl"], "signature": "-x --no-privileges --no-acl", "description": "Prevent dumping of access privileges (grant/revoke commands)."}, {"names": ["--binary-upgrade"], "signature": "--binary-upgrade", "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": ["--column-inserts", "--attribute-inserts"], "signature": "--column-inserts --attribute-inserts", "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": ["--disable-dollar-quoting"], "signature": "--disable-dollar-quoting", "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-triggers"], "signature": "--disable-triggers", "description": "This option is relevant only when creating a data-only dump. 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": ["--extra-float-digits= ndigits"], "signature": "--extra-float-digits= ndigits", "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": ["--exclude-database= pattern"], "signature": "--exclude-database= pattern", "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": ["--if-exists"], "signature": "--if-exists", "description": "Use DROP ... IF EXISTS commands to drop objects in --clean mode. This suppresses \u201c does not exist \u201d errors that might otherwise be reported. This option is not valid unless --clean is also specified."}, {"names": ["--inserts"], "signature": "--inserts", "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": ["--load-via-partition-root"], "signature": "--load-via-partition-root", "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": ["--lock-wait-timeout= timeout"], "signature": "--lock-wait-timeout= timeout", "description": "Do not wait forever to acquire shared table locks at the beginning of the dump. Instead, fail if unable to lock a table within the specified timeout . The timeout may be specified in any of the formats accepted by SET statement_timeout . Allowed values vary depending on the server version you are dumping from, but an integer number of milliseconds is accepted by all versions since 7.3. This option is ignored when dumping from a pre-7.3 server."}, {"names": ["--no-comments"], "signature": "--no-comments", "description": "Do not dump comments."}, {"names": ["--no-publications"], "signature": "--no-publications", "description": "Do not dump publications."}, {"names": ["--no-role-passwords"], "signature": "--no-role-passwords", "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-security-labels"], "signature": "--no-security-labels", "description": "Do not dump security labels."}, {"names": ["--no-subscriptions"], "signature": "--no-subscriptions", "description": "Do not dump subscriptions."}, {"names": ["--no-sync"], "signature": "--no-sync", "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-tablespaces"], "signature": "--no-tablespaces", "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-unlogged-table-data"], "signature": "--no-unlogged-table-data", "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": ["--on-conflict-do-nothing"], "signature": "--on-conflict-do-nothing", "description": "Add ON CONFLICT DO NOTHING to INSERT commands. This option is not valid unless --inserts or --column-inserts is also specified."}, {"names": ["--quote-all-identifiers"], "signature": "--quote-all-identifiers", "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": ["--rows-per-insert= nrows"], "signature": "--rows-per-insert= nrows", "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": ["--use-set-session-authorization"], "signature": "--use-set-session-authorization", "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": ["-?", "--help"], "signature": "-? --help", "description": "Show help about pg_dumpall command line arguments, and exit."}, {"names": ["-d connstr", "--dbname= connstr"], "signature": "-d connstr --dbname= connstr", "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": ["-h host", "--host= host"], "signature": "-h host --host= host", "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": ["-l dbname", "--database= dbname"], "signature": "-l dbname --database= dbname", "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": ["-p port", "--port= port"], "signature": "-p port --port= port", "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": ["-U username", "--username= username"], "signature": "-U username --username= username", "description": "User name to connect as."}, {"names": ["-w", "--no-password"], "signature": "-w --no-password", "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", "--password"], "signature": "-W --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": ["--role= rolename"], "signature": "--role= rolename", "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."}], "synopsis": ["pg_dumpall [ connection-option ...] [ option ...]"], "environment": [{"name": "PGHOST PGOPTIONS PGPORT PGUSER", "description": "Default connection parameters"}, {"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}]}, "comparison_hash": "24628b04cbc488c6cb2f05d0eb3eb81e90075e26f6d3af7181eedad7a1ea6c54"}, "13": {"facts": [{"label": "Documented executable", "value": "pg_dumpall"}, {"label": "Executable version", "value": "13.23"}, {"label": "Reference inventory", "value": "Client applications"}, {"label": "Option definition groups", "value": "45"}], "tables": [{"key": "options", "rows": [{"summary": "Dump only the data, not the schema (data definitions).", "signature": {"url": "/docs/13/app-pg-dumpall.html", "text": "-a --data-only"}}, {"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": {"url": "/docs/13/app-pg-dumpall.html", "text": "-c --clean"}}, {"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": {"url": "/docs/13/app-pg-dumpall.html", "text": "-E encoding --encoding= encoding"}}, {"summary": "Send output to the specified file. If this is omitted, the standard output is used.", "signature": {"url": "/docs/13/app-pg-dumpall.html", "text": "-f filename --file= filename"}}, {"summary": "Dump only global objects (roles and tablespaces), no databases.", "signature": {"url": "/docs/13/app-pg-dumpall.html", "text": "-g --globals-only"}}, {"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": {"url": "/docs/13/app-pg-dumpall.html", "text": "-O --no-owner"}}, {"summary": "Dump only roles, no databases or tablespaces.", "signature": {"url": "/docs/13/app-pg-dumpall.html", "text": "-r --roles-only"}}, {"summary": "Dump only the object definitions (schema), not data.", "signature": {"url": "/docs/13/app-pg-dumpall.html", "text": "-s --schema-only"}}, {"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": {"url": "/docs/13/app-pg-dumpall.html", "text": "-S username --superuser= username"}}, {"summary": "Dump only tablespaces, no databases or roles.", "signature": {"url": "/docs/13/app-pg-dumpall.html", "text": "-t --tablespaces-only"}}, {"summary": "Specifies verbose mode. This will cause pg_dumpall to output start/stop times to the dump file, and progress messages to standard error. It will also enable verbose output in pg_dump .", "signature": {"url": "/docs/13/app-pg-dumpall.html", "text": "-v --verbose"}}, {"summary": "Print the pg_dumpall version and exit.", "signature": {"url": "/docs/13/app-pg-dumpall.html", "text": "-V --version"}}, {"summary": "Prevent dumping of access privileges (grant/revoke commands).", "signature": {"url": "/docs/13/app-pg-dumpall.html", "text": "-x --no-privileges --no-acl"}}, {"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": {"url": "/docs/13/app-pg-dumpall.html", "text": "--binary-upgrade"}}, {"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": {"url": "/docs/13/app-pg-dumpall.html", "text": "--column-inserts --attribute-inserts"}}, {"summary": "This option disables the use of dollar quoting for function bodies, and forces them to be quoted using SQL standard string syntax.", "signature": {"url": "/docs/13/app-pg-dumpall.html", "text": "--disable-dollar-quoting"}}, {"summary": "This option is relevant only when creating a data-only dump. 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": {"url": "/docs/13/app-pg-dumpall.html", "text": "--disable-triggers"}}, {"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 below), 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": {"url": "/docs/13/app-pg-dumpall.html", "text": "--exclude-database= pattern"}}, {"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": {"url": "/docs/13/app-pg-dumpall.html", "text": "--extra-float-digits= ndigits"}}, {"summary": "Use DROP ... IF EXISTS commands to drop objects in --clean mode. This suppresses \u201c does not exist \u201d errors that might otherwise be reported. This option is not valid unless --clean is also specified.", "signature": {"url": "/docs/13/app-pg-dumpall.html", "text": "--if-exists"}}, {"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": {"url": "/docs/13/app-pg-dumpall.html", "text": "--inserts"}}, {"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": {"url": "/docs/13/app-pg-dumpall.html", "text": "--load-via-partition-root"}}, {"summary": "Do not wait forever to acquire shared table locks at the beginning of the dump. Instead, fail if unable to lock a table within the specified timeout . The timeout may be specified in any of the formats accepted by SET statement_timeout . Allowed values vary depending on the server version you are dumping from, but an integer number of milliseconds is accepted by all versions since 7.3. This option is ignored when dumping from a pre-7.3 server.", "signature": {"url": "/docs/13/app-pg-dumpall.html", "text": "--lock-wait-timeout= timeout"}}, {"summary": "Do not dump comments.", "signature": {"url": "/docs/13/app-pg-dumpall.html", "text": "--no-comments"}}, {"summary": "Do not dump publications.", "signature": {"url": "/docs/13/app-pg-dumpall.html", "text": "--no-publications"}}, {"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": {"url": "/docs/13/app-pg-dumpall.html", "text": "--no-role-passwords"}}, {"summary": "Do not dump security labels.", "signature": {"url": "/docs/13/app-pg-dumpall.html", "text": "--no-security-labels"}}, {"summary": "Do not dump subscriptions.", "signature": {"url": "/docs/13/app-pg-dumpall.html", "text": "--no-subscriptions"}}, {"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": {"url": "/docs/13/app-pg-dumpall.html", "text": "--no-sync"}}, {"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": {"url": "/docs/13/app-pg-dumpall.html", "text": "--no-tablespaces"}}, {"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": {"url": "/docs/13/app-pg-dumpall.html", "text": "--no-unlogged-table-data"}}, {"summary": "Add ON CONFLICT DO NOTHING to INSERT commands. This option is not valid unless --inserts or --column-inserts is also specified.", "signature": {"url": "/docs/13/app-pg-dumpall.html", "text": "--on-conflict-do-nothing"}}, {"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": {"url": "/docs/13/app-pg-dumpall.html", "text": "--quote-all-identifiers"}}, {"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": {"url": "/docs/13/app-pg-dumpall.html", "text": "--restrict-key= restrict_key"}}, {"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": {"url": "/docs/13/app-pg-dumpall.html", "text": "--rows-per-insert= nrows"}}, {"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": {"url": "/docs/13/app-pg-dumpall.html", "text": "--use-set-session-authorization"}}, {"summary": "Show help about pg_dumpall command line arguments, and exit.", "signature": {"url": "/docs/13/app-pg-dumpall.html", "text": "-? --help"}}, {"summary": "Specifies parameters used to connect to the server, as a connection string ; these will override any conflicting command line options.", "signature": {"url": "/docs/13/app-pg-dumpall.html", "text": "-d connstr --dbname= connstr"}}, {"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": {"url": "/docs/13/app-pg-dumpall.html", "text": "-h host --host= host"}}, {"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": {"url": "/docs/13/app-pg-dumpall.html", "text": "-l dbname --database= dbname"}}, {"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": {"url": "/docs/13/app-pg-dumpall.html", "text": "-p port --port= port"}}, {"summary": "User name to connect as.", "signature": {"url": "/docs/13/app-pg-dumpall.html", "text": "-U username --username= username"}}, {"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": {"url": "/docs/13/app-pg-dumpall.html", "text": "-w --no-password"}}, {"summary": "Force pg_dumpall to prompt for a password before connecting to a database.", "signature": {"url": "/docs/13/app-pg-dumpall.html", "text": "-W --password"}}, {"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.", "signature": {"url": "/docs/13/app-pg-dumpall.html", "text": "--role= rolename"}}], "title": "Documented options", "columns": [{"key": "signature", "label": "Option and arguments"}, {"key": "summary", "label": "Description"}]}, {"key": "environment", "rows": [{"name": "PGHOST PGOPTIONS PGPORT PGUSER", "description": "Default connection parameters"}, {"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}], "title": "Environment variables", "columns": [{"key": "name", "label": "Variable"}, {"key": "description", "label": "Meaning"}]}], "options": [{"names": ["-a", "--data-only"], "summary": "Dump only the data, not the schema (data definitions).", "signature": "-a --data-only", "source_url": "/docs/13/app-pg-dumpall.html", "description": "Dump only the data, not the schema (data definitions)."}, {"names": ["-c", "--clean"], "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": "-c --clean", "source_url": "/docs/13/app-pg-dumpall.html", "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": ["-E encoding", "--encoding= encoding"], "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": "-E encoding --encoding= encoding", "source_url": "/docs/13/app-pg-dumpall.html", "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": ["-f filename", "--file= filename"], "summary": "Send output to the specified file. If this is omitted, the standard output is used.", "signature": "-f filename --file= filename", "source_url": "/docs/13/app-pg-dumpall.html", "description": "Send output to the specified file. If this is omitted, the standard output is used."}, {"names": ["-g", "--globals-only"], "summary": "Dump only global objects (roles and tablespaces), no databases.", "signature": "-g --globals-only", "source_url": "/docs/13/app-pg-dumpall.html", "description": "Dump only global objects (roles and tablespaces), no databases."}, {"names": ["-O", "--no-owner"], "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": "-O --no-owner", "source_url": "/docs/13/app-pg-dumpall.html", "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": ["-r", "--roles-only"], "summary": "Dump only roles, no databases or tablespaces.", "signature": "-r --roles-only", "source_url": "/docs/13/app-pg-dumpall.html", "description": "Dump only roles, no databases or tablespaces."}, {"names": ["-s", "--schema-only"], "summary": "Dump only the object definitions (schema), not data.", "signature": "-s --schema-only", "source_url": "/docs/13/app-pg-dumpall.html", "description": "Dump only the object definitions (schema), not data."}, {"names": ["-S username", "--superuser= username"], "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": "-S username --superuser= username", "source_url": "/docs/13/app-pg-dumpall.html", "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": ["-t", "--tablespaces-only"], "summary": "Dump only tablespaces, no databases or roles.", "signature": "-t --tablespaces-only", "source_url": "/docs/13/app-pg-dumpall.html", "description": "Dump only tablespaces, no databases or roles."}, {"names": ["-v", "--verbose"], "summary": "Specifies verbose mode. This will cause pg_dumpall to output start/stop times to the dump file, and progress messages to standard error. It will also enable verbose output in pg_dump .", "signature": "-v --verbose", "source_url": "/docs/13/app-pg-dumpall.html", "description": "Specifies verbose mode. This will cause pg_dumpall to output start/stop times to the dump file, and progress messages to standard error. It will also enable verbose output in pg_dump ."}, {"names": ["-V", "--version"], "summary": "Print the pg_dumpall version and exit.", "signature": "-V --version", "source_url": "/docs/13/app-pg-dumpall.html", "description": "Print the pg_dumpall version and exit."}, {"names": ["-x", "--no-privileges", "--no-acl"], "summary": "Prevent dumping of access privileges (grant/revoke commands).", "signature": "-x --no-privileges --no-acl", "source_url": "/docs/13/app-pg-dumpall.html", "description": "Prevent dumping of access privileges (grant/revoke commands)."}, {"names": ["--binary-upgrade"], "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": "--binary-upgrade", "source_url": "/docs/13/app-pg-dumpall.html", "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": ["--column-inserts", "--attribute-inserts"], "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": "--column-inserts --attribute-inserts", "source_url": "/docs/13/app-pg-dumpall.html", "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": ["--disable-dollar-quoting"], "summary": "This option disables the use of dollar quoting for function bodies, and forces them to be quoted using SQL standard string syntax.", "signature": "--disable-dollar-quoting", "source_url": "/docs/13/app-pg-dumpall.html", "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-triggers"], "summary": "This option is relevant only when creating a data-only dump. 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": "--disable-triggers", "source_url": "/docs/13/app-pg-dumpall.html", "description": "This option is relevant only when creating a data-only dump. 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": ["--exclude-database= pattern"], "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 below), 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": "--exclude-database= pattern", "source_url": "/docs/13/app-pg-dumpall.html", "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 below), 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": ["--extra-float-digits= ndigits"], "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": "--extra-float-digits= ndigits", "source_url": "/docs/13/app-pg-dumpall.html", "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": ["--if-exists"], "summary": "Use DROP ... IF EXISTS commands to drop objects in --clean mode. This suppresses \u201c does not exist \u201d errors that might otherwise be reported. This option is not valid unless --clean is also specified.", "signature": "--if-exists", "source_url": "/docs/13/app-pg-dumpall.html", "description": "Use DROP ... IF EXISTS commands to drop objects in --clean mode. This suppresses \u201c does not exist \u201d errors that might otherwise be reported. This option is not valid unless --clean is also specified."}, {"names": ["--inserts"], "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": "--inserts", "source_url": "/docs/13/app-pg-dumpall.html", "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": ["--load-via-partition-root"], "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": "--load-via-partition-root", "source_url": "/docs/13/app-pg-dumpall.html", "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": ["--lock-wait-timeout= timeout"], "summary": "Do not wait forever to acquire shared table locks at the beginning of the dump. Instead, fail if unable to lock a table within the specified timeout . The timeout may be specified in any of the formats accepted by SET statement_timeout . Allowed values vary depending on the server version you are dumping from, but an integer number of milliseconds is accepted by all versions since 7.3. This option is ignored when dumping from a pre-7.3 server.", "signature": "--lock-wait-timeout= timeout", "source_url": "/docs/13/app-pg-dumpall.html", "description": "Do not wait forever to acquire shared table locks at the beginning of the dump. Instead, fail if unable to lock a table within the specified timeout . The timeout may be specified in any of the formats accepted by SET statement_timeout . Allowed values vary depending on the server version you are dumping from, but an integer number of milliseconds is accepted by all versions since 7.3. This option is ignored when dumping from a pre-7.3 server."}, {"names": ["--no-comments"], "summary": "Do not dump comments.", "signature": "--no-comments", "source_url": "/docs/13/app-pg-dumpall.html", "description": "Do not dump comments."}, {"names": ["--no-publications"], "summary": "Do not dump publications.", "signature": "--no-publications", "source_url": "/docs/13/app-pg-dumpall.html", "description": "Do not dump publications."}, {"names": ["--no-role-passwords"], "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": "--no-role-passwords", "source_url": "/docs/13/app-pg-dumpall.html", "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-security-labels"], "summary": "Do not dump security labels.", "signature": "--no-security-labels", "source_url": "/docs/13/app-pg-dumpall.html", "description": "Do not dump security labels."}, {"names": ["--no-subscriptions"], "summary": "Do not dump subscriptions.", "signature": "--no-subscriptions", "source_url": "/docs/13/app-pg-dumpall.html", "description": "Do not dump subscriptions."}, {"names": ["--no-sync"], "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": "--no-sync", "source_url": "/docs/13/app-pg-dumpall.html", "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-tablespaces"], "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": "--no-tablespaces", "source_url": "/docs/13/app-pg-dumpall.html", "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-unlogged-table-data"], "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": "--no-unlogged-table-data", "source_url": "/docs/13/app-pg-dumpall.html", "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": ["--on-conflict-do-nothing"], "summary": "Add ON CONFLICT DO NOTHING to INSERT commands. This option is not valid unless --inserts or --column-inserts is also specified.", "signature": "--on-conflict-do-nothing", "source_url": "/docs/13/app-pg-dumpall.html", "description": "Add ON CONFLICT DO NOTHING to INSERT commands. This option is not valid unless --inserts or --column-inserts is also specified."}, {"names": ["--quote-all-identifiers"], "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": "--quote-all-identifiers", "source_url": "/docs/13/app-pg-dumpall.html", "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": ["--restrict-key= restrict_key"], "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": "--restrict-key= restrict_key", "source_url": "/docs/13/app-pg-dumpall.html", "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": ["--rows-per-insert= nrows"], "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": "--rows-per-insert= nrows", "source_url": "/docs/13/app-pg-dumpall.html", "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": ["--use-set-session-authorization"], "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": "--use-set-session-authorization", "source_url": "/docs/13/app-pg-dumpall.html", "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": ["-?", "--help"], "summary": "Show help about pg_dumpall command line arguments, and exit.", "signature": "-? --help", "source_url": "/docs/13/app-pg-dumpall.html", "description": "Show help about pg_dumpall command line arguments, and exit."}, {"names": ["-d connstr", "--dbname= connstr"], "summary": "Specifies parameters used to connect to the server, as a connection string ; these will override any conflicting command line options.", "signature": "-d connstr --dbname= connstr", "source_url": "/docs/13/app-pg-dumpall.html", "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": ["-h host", "--host= host"], "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": "-h host --host= host", "source_url": "/docs/13/app-pg-dumpall.html", "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": ["-l dbname", "--database= dbname"], "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": "-l dbname --database= dbname", "source_url": "/docs/13/app-pg-dumpall.html", "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": ["-p port", "--port= port"], "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": "-p port --port= port", "source_url": "/docs/13/app-pg-dumpall.html", "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": ["-U username", "--username= username"], "summary": "User name to connect as.", "signature": "-U username --username= username", "source_url": "/docs/13/app-pg-dumpall.html", "description": "User name to connect as."}, {"names": ["-w", "--no-password"], "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": "-w --no-password", "source_url": "/docs/13/app-pg-dumpall.html", "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", "--password"], "summary": "Force pg_dumpall to prompt for a password before connecting to a database.", "signature": "-W --password", "source_url": "/docs/13/app-pg-dumpall.html", "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": ["--role= rolename"], "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.", "signature": "--role= rolename", "source_url": "/docs/13/app-pg-dumpall.html", "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."}], "related": [{"url": "/wiki/conn/?v=13", "label": "libpq connection parameters"}], "release": {"ref": "https://ftp.postgresql.org/pub/source/v13.23/postgresql-13.23.tar.bz2", "label": "13.23", "major": "13", "channel": "historical", "manifest": {"pdf": {"A4": {"url": "/files/documentation/pdf/13/postgresql-13-A4.pdf", "bytes": 13843239, "pages": 2826, "sha256": "171cc09f90936dbc1cbd503a98ff07ae72ea58ab9771ff051313f1217737799c", "built_at": "2026-09-26"}, "US": {"url": "/files/documentation/pdf/13/postgresql-13-US.pdf", "bytes": 13739572, "pages": 2984, "sha256": "48d09c6e197d9db4220f41afe83efe848a8661b1b168d3b89419751ecaf6c24d", "built_at": "2026-09-26"}}, "tree": "13", "index": "index.html", "major": "13", "pages": 1139, "release": "13.23", "source_url": "https://ftp.postgresql.org/pub/source/v13.23/postgresql-13.23.tar.bz2", "svg_assets": 3, "source_mode": "en HTML verified against the pinned official archive", "source_sha256": "6ec3c82726af92b7dec873fa1cdf881eca92a4219787dfad05acb6b10e041fd6"}, "revision": "614ee3133270254e476c118cdf6f72af78d4e4b8bbd9b28ed9ab1e14e4e9c0f6", "evidence_kind": "English manual and source declarations", "source_sha256": "6ec3c82726af92b7dec873fa1cdf881eca92a4219787dfad05acb6b10e041fd6"}, "sources": [{"url": "/docs/13/app-pg-dumpall.html", "file": "app-pg-dumpall.html", "label": "13.23 English manual \u00b7 app-pg-dumpall.html", "anchor": "", "sha256": "b97011686172608f1369d74c6092377b32ba04b183d0be106e0bf79d76791a0e"}, {"url": "/docs/13/reference-client.html", "file": "reference-client.html", "label": "Client applications inventory", "anchor": "", "sha256": "2a16c2982d9803edd4bd6920f76b66083e7f2959182d6a3bcec7ccfbac0a9ad8"}], "sections": [], "synopsis": ["pg_dumpall [ connection-option ...] [ option ...]"], "signature": "pg_dumpall [ connection-option ...] [ option ...]", "description": ["pg_dumpall \u2014 extract a PostgreSQL database cluster into a script file"], "environment": [{"name": "PGHOST PGOPTIONS PGPORT PGUSER", "description": "Default connection parameters"}, {"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}], "manual_html": "<div><div class=\"refentry\" id=\"APP-PG-DUMPALL\">\n<div class=\"titlepage\"></div>\n<div class=\"refnamediv\">\n<h2><span class=\"refentrytitle\"><span class=\"application\">pg_dumpall</span></span></h2>\n<p>pg_dumpall \u2014 extract a <span class=\"productname\">PostgreSQL</span> database cluster into a script file</p>\n</div>\n<div class=\"refsynopsisdiv\">\n<h2>Synopsis</h2>\n<div class=\"cmdsynopsis\">\n<p id=\"id-1.9.4.13.4.1\"><code class=\"command\">pg_dumpall</code> [<em class=\"replaceable\"><code>connection-option</code></em>...] [<em class=\"replaceable\"><code>option</code></em>...]</p>\n</div>\n</div>\n<div class=\"refsect1\" id=\"APP-PG-DUMPALL-DESCRIPTION\">\n<h2>Description</h2>\n<p><span class=\"application\">pg_dumpall</span> is a utility for writing out (<span class=\"quote\">\u201c<span class=\"quote\">dumping</span>\u201d</span>) all <span class=\"productname\">PostgreSQL</span> databases of a cluster into one script file. The script file contains SQL commands that can be used as input to <a class=\"xref\" href=\"/docs/13/app-psql.html\" title=\"psql\"><span class=\"refentrytitle\"><span class=\"application\">psql</span></span></a> to restore the databases. It does this by calling <a class=\"xref\" href=\"/docs/13/app-pgdump.html\" title=\"pg_dump\"><span class=\"refentrytitle\">pg_dump</span></a> for each database in the cluster. <span class=\"application\">pg_dumpall</span> also dumps global objects that are common to all databases, that is, database roles and tablespaces. (<span class=\"application\">pg_dump</span> does not save these objects.)</p>\n<p>Since <span class=\"application\">pg_dumpall</span> 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.</p>\n<p>The SQL script will be written to the standard output. Use the <code class=\"option\">-f</code>/<code class=\"option\">--file</code> option or shell operators to redirect it into a file.</p>\n<p><span class=\"application\">pg_dumpall</span> needs to connect several times to the <span class=\"productname\">PostgreSQL</span> server (once per database). If you use password authentication it will ask for a password each time. It is convenient to have a <code class=\"filename\">~/.pgpass</code> file in such cases. See <a class=\"xref\" href=\"/docs/13/libpq-pgpass.html\" title=\"33.15.\u00a0The Password File\">Section\u00a033.15</a> for more information.</p>\n<div class=\"warning\">\n<h3 class=\"title\">Warning</h3>\n<p>Restoring 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.</p>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.13.6\">\n<h2>Options</h2>\n<p>The following command-line options control the content and format of the output.</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-a</code><br></span><span class=\"term\"><code class=\"option\">--data-only</code></span></dt>\n<dd>\n<p>Dump only the data, not the schema (data definitions).</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-c</code><br></span><span class=\"term\"><code class=\"option\">--clean</code></span></dt>\n<dd>\n<p>Emit SQL commands to <code class=\"command\">DROP</code> 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 <code class=\"option\">--if-exists</code> is also specified.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-E <em class=\"replaceable\"><code>encoding</code></em></code><br></span><span class=\"term\"><code class=\"option\">--encoding=<em class=\"replaceable\"><code>encoding</code></em></code></span></dt>\n<dd>\n<p>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 <code class=\"envar\">PGCLIENTENCODING</code> environment variable to the desired dump encoding.)</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-f <em class=\"replaceable\"><code>filename</code></em></code><br></span><span class=\"term\"><code class=\"option\">--file=<em class=\"replaceable\"><code>filename</code></em></code></span></dt>\n<dd>\n<p>Send output to the specified file. If this is omitted, the standard output is used.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-g</code><br></span><span class=\"term\"><code class=\"option\">--globals-only</code></span></dt>\n<dd>\n<p>Dump only global objects (roles and tablespaces), no databases.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-O</code><br></span><span class=\"term\"><code class=\"option\">--no-owner</code></span></dt>\n<dd>\n<p>Do not output commands to set ownership of objects to match the original database. By default, <span class=\"application\">pg_dumpall</span> issues <code class=\"command\">ALTER OWNER</code> or <code class=\"command\">SET SESSION AUTHORIZATION</code> 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 <code class=\"option\">-O</code>.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-r</code><br></span><span class=\"term\"><code class=\"option\">--roles-only</code></span></dt>\n<dd>\n<p>Dump only roles, no databases or tablespaces.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-s</code><br></span><span class=\"term\"><code class=\"option\">--schema-only</code></span></dt>\n<dd>\n<p>Dump only the object definitions (schema), not data.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-S <em class=\"replaceable\"><code>username</code></em></code><br></span><span class=\"term\"><code class=\"option\">--superuser=<em class=\"replaceable\"><code>username</code></em></code></span></dt>\n<dd>\n<p>Specify the superuser user name to use when disabling triggers. This is relevant only if <code class=\"option\">--disable-triggers</code> is used. (Usually, it's better to leave this out, and instead start the resulting script as superuser.)</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-t</code><br></span><span class=\"term\"><code class=\"option\">--tablespaces-only</code></span></dt>\n<dd>\n<p>Dump only tablespaces, no databases or roles.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-v</code><br></span><span class=\"term\"><code class=\"option\">--verbose</code></span></dt>\n<dd>\n<p>Specifies verbose mode. This will cause <span class=\"application\">pg_dumpall</span> to output start/stop times to the dump file, and progress messages to standard error. It will also enable verbose output in <span class=\"application\">pg_dump</span>.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-V</code><br></span><span class=\"term\"><code class=\"option\">--version</code></span></dt>\n<dd>\n<p>Print the <span class=\"application\">pg_dumpall</span> version and exit.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-x</code><br></span><span class=\"term\"><code class=\"option\">--no-privileges</code><br></span><span class=\"term\"><code class=\"option\">--no-acl</code></span></dt>\n<dd>\n<p>Prevent dumping of access privileges (grant/revoke commands).</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--binary-upgrade</code></span></dt>\n<dd>\n<p>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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--column-inserts</code><br></span><span class=\"term\"><code class=\"option\">--attribute-inserts</code></span></dt>\n<dd>\n<p>Dump data as <code class=\"command\">INSERT</code> commands with explicit column names (<code class=\"literal\">INSERT INTO <em class=\"replaceable\"><code>table</code></em> (<em class=\"replaceable\"><code>column</code></em>, ...) VALUES ...</code>). This will make restoration very slow; it is mainly useful for making dumps that can be loaded into non-<span class=\"productname\">PostgreSQL</span> databases.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--disable-dollar-quoting</code></span></dt>\n<dd>\n<p>This option disables the use of dollar quoting for function bodies, and forces them to be quoted using SQL standard string syntax.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--disable-triggers</code></span></dt>\n<dd>\n<p>This option is relevant only when creating a data-only dump. It instructs <span class=\"application\">pg_dumpall</span> 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.</p>\n<p>Presently, the commands emitted for <code class=\"option\">--disable-triggers</code> must be done as superuser. So, you should also specify a superuser name with <code class=\"option\">-S</code>, or preferably be careful to start the resulting script as a superuser.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--exclude-database=<em class=\"replaceable\"><code>pattern</code></em></code></span></dt>\n<dd>\n<p>Do not dump databases whose name matches <em class=\"replaceable\"><code>pattern</code></em>. Multiple patterns can be excluded by writing multiple <code class=\"option\">--exclude-database</code> switches. The <em class=\"replaceable\"><code>pattern</code></em> parameter is interpreted as a pattern according to the same rules used by <span class=\"application\">psql</span>'s <code class=\"literal\">\\d</code> commands (see <a class=\"xref\" href=\"/docs/13/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\">Patterns</a> below), 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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--extra-float-digits=<em class=\"replaceable\"><code>ndigits</code></em></code></span></dt>\n<dd>\n<p>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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--if-exists</code></span></dt>\n<dd>\n<p>Use <code class=\"literal\">DROP ... IF EXISTS</code> commands to drop objects in <code class=\"option\">--clean</code> mode. This suppresses <span class=\"quote\">\u201c<span class=\"quote\">does not exist</span>\u201d</span> errors that might otherwise be reported. This option is not valid unless <code class=\"option\">--clean</code> is also specified.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--inserts</code></span></dt>\n<dd>\n<p>Dump data as <code class=\"command\">INSERT</code> commands (rather than <code class=\"command\">COPY</code>). This will make restoration very slow; it is mainly useful for making dumps that can be loaded into non-<span class=\"productname\">PostgreSQL</span> databases. Note that the restore might fail altogether if you have rearranged column order. The <code class=\"option\">--column-inserts</code> option is safer, though even slower.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--load-via-partition-root</code></span></dt>\n<dd>\n<p>When dumping data for a table partition, make the <code class=\"command\">COPY</code> or <code class=\"command\">INSERT</code> 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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--lock-wait-timeout=<em class=\"replaceable\"><code>timeout</code></em></code></span></dt>\n<dd>\n<p>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 <em class=\"replaceable\"><code>timeout</code></em>. The timeout may be specified in any of the formats accepted by <code class=\"command\">SET statement_timeout</code>. Allowed values vary depending on the server version you are dumping from, but an integer number of milliseconds is accepted by all versions since 7.3. This option is ignored when dumping from a pre-7.3 server.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-comments</code></span></dt>\n<dd>\n<p>Do not dump comments.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-publications</code></span></dt>\n<dd>\n<p>Do not dump publications.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-role-passwords</code></span></dt>\n<dd>\n<p>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 <code class=\"structname\">pg_roles</code> instead of <code class=\"structname\">pg_authid</code>. Therefore, this option also helps if access to <code class=\"structname\">pg_authid</code> is restricted by some security policy.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-security-labels</code></span></dt>\n<dd>\n<p>Do not dump security labels.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-subscriptions</code></span></dt>\n<dd>\n<p>Do not dump subscriptions.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-sync</code></span></dt>\n<dd>\n<p>By default, <code class=\"command\">pg_dumpall</code> will wait for all files to be written safely to disk. This option causes <code class=\"command\">pg_dumpall</code> 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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-tablespaces</code></span></dt>\n<dd>\n<p>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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-unlogged-table-data</code></span></dt>\n<dd>\n<p>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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--on-conflict-do-nothing</code></span></dt>\n<dd>\n<p>Add <code class=\"literal\">ON CONFLICT DO NOTHING</code> to <code class=\"command\">INSERT</code> commands. This option is not valid unless <code class=\"option\">--inserts</code> or <code class=\"option\">--column-inserts</code> is also specified.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--quote-all-identifiers</code></span></dt>\n<dd>\n<p>Force quoting of all identifiers. This option is recommended when dumping a database from a server whose <span class=\"productname\">PostgreSQL</span> major version is different from <span class=\"application\">pg_dumpall</span>'s, or when the output is intended to be loaded into a server of a different major version. By default, <span class=\"application\">pg_dumpall</span> 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 <code class=\"option\">--quote-all-identifiers</code> prevents such issues, at the price of a harder-to-read dump script.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--restrict-key=<em class=\"replaceable\"><code>restrict_key</code></em></code></span></dt>\n<dd>\n<p>Use the provided string as the <span class=\"application\">psql</span> <code class=\"command\">\\restrict</code> key in the dump output. If no restrict key is specified, <span class=\"application\">pg_dumpall</span> will generate a random one as needed. Keys may contain only alphanumeric characters.</p>\n<p>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 <span class=\"application\">psql</span> with the dump output.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--rows-per-insert=<em class=\"replaceable\"><code>nrows</code></em></code></span></dt>\n<dd>\n<p>Dump data as <code class=\"command\">INSERT</code> commands (rather than <code class=\"command\">COPY</code>). Controls the maximum number of rows per <code class=\"command\">INSERT</code> 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 <code class=\"command\">INSERT</code> to be lost, rather than the entire table contents.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--use-set-session-authorization</code></span></dt>\n<dd>\n<p>Output SQL-standard <code class=\"command\">SET SESSION AUTHORIZATION</code> commands instead of <code class=\"command\">ALTER OWNER</code> 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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-?</code><br></span><span class=\"term\"><code class=\"option\">--help</code></span></dt>\n<dd>\n<p>Show help about <span class=\"application\">pg_dumpall</span> command line arguments, and exit.</p>\n</dd>\n</dl>\n</div>\n<p>The following command-line options control the database connection parameters.</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-d <em class=\"replaceable\"><code>connstr</code></em></code><br></span><span class=\"term\"><code class=\"option\">--dbname=<em class=\"replaceable\"><code>connstr</code></em></code></span></dt>\n<dd>\n<p>Specifies parameters used to connect to the server, as a <a class=\"link\" href=\"/docs/13/libpq-connect.html#LIBPQ-CONNSTRING\" title=\"33.1.1.\u00a0Connection Strings\">connection string</a>; these will override any conflicting command line options.</p>\n<p>The option is called <code class=\"literal\">--dbname</code> for consistency with other client applications, but because <span class=\"application\">pg_dumpall</span> needs to connect to many databases, the database name in the connection string will be ignored. Use the <code class=\"literal\">-l</code> 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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-h <em class=\"replaceable\"><code>host</code></em></code><br></span><span class=\"term\"><code class=\"option\">--host=<em class=\"replaceable\"><code>host</code></em></code></span></dt>\n<dd>\n<p>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 <code class=\"envar\">PGHOST</code> environment variable, if set, else a Unix domain socket connection is attempted.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-l <em class=\"replaceable\"><code>dbname</code></em></code><br></span><span class=\"term\"><code class=\"option\">--database=<em class=\"replaceable\"><code>dbname</code></em></code></span></dt>\n<dd>\n<p>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 <code class=\"literal\">postgres</code> database will be used, and if that does not exist, <code class=\"literal\">template1</code> will be used.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-p <em class=\"replaceable\"><code>port</code></em></code><br></span><span class=\"term\"><code class=\"option\">--port=<em class=\"replaceable\"><code>port</code></em></code></span></dt>\n<dd>\n<p>Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the <code class=\"envar\">PGPORT</code> environment variable, if set, or a compiled-in default.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-U <em class=\"replaceable\"><code>username</code></em></code><br></span><span class=\"term\"><code class=\"option\">--username=<em class=\"replaceable\"><code>username</code></em></code></span></dt>\n<dd>\n<p>User name to connect as.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-w</code><br></span><span class=\"term\"><code class=\"option\">--no-password</code></span></dt>\n<dd>\n<p>Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a <code class=\"filename\">.pgpass</code> 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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-W</code><br></span><span class=\"term\"><code class=\"option\">--password</code></span></dt>\n<dd>\n<p>Force <span class=\"application\">pg_dumpall</span> to prompt for a password before connecting to a database.</p>\n<p>This option is never essential, since <span class=\"application\">pg_dumpall</span> will automatically prompt for a password if the server demands password authentication. However, <span class=\"application\">pg_dumpall</span> will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing <code class=\"option\">-W</code> to avoid the extra connection attempt.</p>\n<p>Note that the password prompt will occur again for each database to be dumped. Usually, it's better to set up a <code class=\"filename\">~/.pgpass</code> file than to rely on manual password entry.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--role=<em class=\"replaceable\"><code>rolename</code></em></code></span></dt>\n<dd>\n<p>Specifies a role name to be used to create the dump. This option causes <span class=\"application\">pg_dumpall</span> to issue a <code class=\"command\">SET ROLE</code> <em class=\"replaceable\"><code>rolename</code></em> command after connecting to the database. It is useful when the authenticated user (specified by <code class=\"option\">-U</code>) lacks privileges needed by <span class=\"application\">pg_dumpall</span>, 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.</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.13.7\">\n<h2>Environment</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"envar\">PGHOST</code><br></span><span class=\"term\"><code class=\"envar\">PGOPTIONS</code><br></span><span class=\"term\"><code class=\"envar\">PGPORT</code><br></span><span class=\"term\"><code class=\"envar\">PGUSER</code></span></dt>\n<dd>\n<p>Default connection parameters</p>\n</dd>\n<dt><span class=\"term\"><code class=\"envar\">PG_COLOR</code></span></dt>\n<dd>\n<p>Specifies whether to use color in diagnostic messages. Possible values are <code class=\"literal\">always</code>, <code class=\"literal\">auto</code> and <code class=\"literal\">never</code>.</p>\n</dd>\n</dl>\n</div>\n<p>This utility, like most other <span class=\"productname\">PostgreSQL</span> utilities, also uses the environment variables supported by <span class=\"application\">libpq</span> (see <a class=\"xref\" href=\"/docs/13/libpq-envars.html\" title=\"33.14.\u00a0Environment Variables\">Section\u00a033.14</a>).</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.13.8\">\n<h2>Notes</h2>\n<p>Since <span class=\"application\">pg_dumpall</span> calls <span class=\"application\">pg_dump</span> internally, some diagnostic messages will refer to <span class=\"application\">pg_dump</span>.</p>\n<p>The <code class=\"option\">--clean</code> option can be useful even when your intention is to restore the dump script into a fresh cluster. Use of <code class=\"option\">--clean</code> authorizes the script to drop and re-create the built-in <code class=\"literal\">postgres</code> and <code class=\"literal\">template1</code> 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.</p>\n<p>Once restored, it is wise to run <code class=\"command\">ANALYZE</code> on each database so the optimizer has useful statistics. You can also run <code class=\"command\">vacuumdb -a -z</code> to analyze all databases.</p>\n<p>The dump script should not be expected to run completely without errors. In particular, because the script will issue <code class=\"command\">CREATE ROLE</code> for every role existing in the source cluster, it is certain to get a <span class=\"quote\">\u201c<span class=\"quote\">role already exists</span>\u201d</span> 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 <code class=\"option\">--clean</code> option is likely to produce additional harmless error messages about non-existent objects, although you can minimize those by adding <code class=\"option\">--if-exists</code>.</p>\n<p><span class=\"application\">pg_dumpall</span> requires all needed tablespace directories to exist before the restore; otherwise, database creation will fail for databases in non-default locations.</p>\n<p>It is generally recommended to use the <code class=\"option\">-X</code> (<code class=\"option\">--no-psqlrc</code>) option when restoring a database from a <span class=\"application\">pg_dumpall</span> script to ensure a clean restore process and prevent potential conflicts with non-default <span class=\"application\">psql</span> configurations. Additionally, because the <span class=\"application\">pg_dumpall</span> script may include <span class=\"application\">psql</span> meta-commands, it may be incompatible with clients other than <span class=\"application\">psql</span>.</p>\n</div>\n<div class=\"refsect1\" id=\"APP-PG-DUMPALL-EX\">\n<h2>Examples</h2>\n<p>To dump all databases:</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_dumpall &gt; db.out</code></strong>\n</pre>\n<p>To restore database(s) from this file, you can use:</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>psql -X -f db.out -d postgres</code></strong>\n</pre>\n<p>It is not important which database you connect to here since the script file created by <span class=\"application\">pg_dumpall</span> will contain the appropriate commands to create and connect to the saved databases. An exception is that if you specified <code class=\"option\">--clean</code>, you must connect to the <code class=\"literal\">postgres</code> database initially; the script will attempt to drop other databases immediately, and that will fail for the database you are connected to.</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.13.10\">\n<h2>See Also</h2>\n<p>Check <a class=\"xref\" href=\"/docs/13/app-pgdump.html\" title=\"pg_dump\"><span class=\"refentrytitle\">pg_dump</span></a> for details on possible error conditions.</p>\n</div>\n</div></div>", "manual_path": "app-pg-dumpall.html", "comparison_data": {"options": [{"names": ["-a", "--data-only"], "signature": "-a --data-only", "description": "Dump only the data, not the schema (data definitions)."}, {"names": ["-c", "--clean"], "signature": "-c --clean", "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": ["-E encoding", "--encoding= encoding"], "signature": "-E encoding --encoding= encoding", "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": ["-f filename", "--file= filename"], "signature": "-f filename --file= filename", "description": "Send output to the specified file. If this is omitted, the standard output is used."}, {"names": ["-g", "--globals-only"], "signature": "-g --globals-only", "description": "Dump only global objects (roles and tablespaces), no databases."}, {"names": ["-O", "--no-owner"], "signature": "-O --no-owner", "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": ["-r", "--roles-only"], "signature": "-r --roles-only", "description": "Dump only roles, no databases or tablespaces."}, {"names": ["-s", "--schema-only"], "signature": "-s --schema-only", "description": "Dump only the object definitions (schema), not data."}, {"names": ["-S username", "--superuser= username"], "signature": "-S username --superuser= username", "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": ["-t", "--tablespaces-only"], "signature": "-t --tablespaces-only", "description": "Dump only tablespaces, no databases or roles."}, {"names": ["-v", "--verbose"], "signature": "-v --verbose", "description": "Specifies verbose mode. This will cause pg_dumpall to output start/stop times to the dump file, and progress messages to standard error. It will also enable verbose output in pg_dump ."}, {"names": ["-V", "--version"], "signature": "-V --version", "description": "Print the pg_dumpall version and exit."}, {"names": ["-x", "--no-privileges", "--no-acl"], "signature": "-x --no-privileges --no-acl", "description": "Prevent dumping of access privileges (grant/revoke commands)."}, {"names": ["--binary-upgrade"], "signature": "--binary-upgrade", "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": ["--column-inserts", "--attribute-inserts"], "signature": "--column-inserts --attribute-inserts", "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": ["--disable-dollar-quoting"], "signature": "--disable-dollar-quoting", "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-triggers"], "signature": "--disable-triggers", "description": "This option is relevant only when creating a data-only dump. 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": ["--exclude-database= pattern"], "signature": "--exclude-database= pattern", "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 below), 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": ["--extra-float-digits= ndigits"], "signature": "--extra-float-digits= ndigits", "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": ["--if-exists"], "signature": "--if-exists", "description": "Use DROP ... IF EXISTS commands to drop objects in --clean mode. This suppresses \u201c does not exist \u201d errors that might otherwise be reported. This option is not valid unless --clean is also specified."}, {"names": ["--inserts"], "signature": "--inserts", "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": ["--load-via-partition-root"], "signature": "--load-via-partition-root", "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": ["--lock-wait-timeout= timeout"], "signature": "--lock-wait-timeout= timeout", "description": "Do not wait forever to acquire shared table locks at the beginning of the dump. Instead, fail if unable to lock a table within the specified timeout . The timeout may be specified in any of the formats accepted by SET statement_timeout . Allowed values vary depending on the server version you are dumping from, but an integer number of milliseconds is accepted by all versions since 7.3. This option is ignored when dumping from a pre-7.3 server."}, {"names": ["--no-comments"], "signature": "--no-comments", "description": "Do not dump comments."}, {"names": ["--no-publications"], "signature": "--no-publications", "description": "Do not dump publications."}, {"names": ["--no-role-passwords"], "signature": "--no-role-passwords", "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-security-labels"], "signature": "--no-security-labels", "description": "Do not dump security labels."}, {"names": ["--no-subscriptions"], "signature": "--no-subscriptions", "description": "Do not dump subscriptions."}, {"names": ["--no-sync"], "signature": "--no-sync", "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-tablespaces"], "signature": "--no-tablespaces", "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-unlogged-table-data"], "signature": "--no-unlogged-table-data", "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": ["--on-conflict-do-nothing"], "signature": "--on-conflict-do-nothing", "description": "Add ON CONFLICT DO NOTHING to INSERT commands. This option is not valid unless --inserts or --column-inserts is also specified."}, {"names": ["--quote-all-identifiers"], "signature": "--quote-all-identifiers", "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": ["--restrict-key= restrict_key"], "signature": "--restrict-key= restrict_key", "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": ["--rows-per-insert= nrows"], "signature": "--rows-per-insert= nrows", "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": ["--use-set-session-authorization"], "signature": "--use-set-session-authorization", "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": ["-?", "--help"], "signature": "-? --help", "description": "Show help about pg_dumpall command line arguments, and exit."}, {"names": ["-d connstr", "--dbname= connstr"], "signature": "-d connstr --dbname= connstr", "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": ["-h host", "--host= host"], "signature": "-h host --host= host", "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": ["-l dbname", "--database= dbname"], "signature": "-l dbname --database= dbname", "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": ["-p port", "--port= port"], "signature": "-p port --port= port", "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": ["-U username", "--username= username"], "signature": "-U username --username= username", "description": "User name to connect as."}, {"names": ["-w", "--no-password"], "signature": "-w --no-password", "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", "--password"], "signature": "-W --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": ["--role= rolename"], "signature": "--role= rolename", "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."}], "synopsis": ["pg_dumpall [ connection-option ...] [ option ...]"], "environment": [{"name": "PGHOST PGOPTIONS PGPORT PGUSER", "description": "Default connection parameters"}, {"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}]}, "comparison_hash": "8f35b7976f748fe3fd8ba5f94dfa540bdf55c07ee7919b50a9d0fc0ac8c274b4"}, "14": {"facts": [{"label": "Documented executable", "value": "pg_dumpall"}, {"label": "Executable version", "value": "14.24"}, {"label": "Reference inventory", "value": "Client applications"}, {"label": "Option definition groups", "value": "46"}], "tables": [{"key": "options", "rows": [{"summary": "Dump only the data, not the schema (data definitions).", "signature": {"url": "/docs/14/app-pg-dumpall.html", "text": "-a --data-only"}}, {"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": {"url": "/docs/14/app-pg-dumpall.html", "text": "-c --clean"}}, {"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": {"url": "/docs/14/app-pg-dumpall.html", "text": "-E encoding --encoding= encoding"}}, {"summary": "Send output to the specified file. If this is omitted, the standard output is used.", "signature": {"url": "/docs/14/app-pg-dumpall.html", "text": "-f filename --file= filename"}}, {"summary": "Dump only global objects (roles and tablespaces), no databases.", "signature": {"url": "/docs/14/app-pg-dumpall.html", "text": "-g --globals-only"}}, {"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": {"url": "/docs/14/app-pg-dumpall.html", "text": "-O --no-owner"}}, {"summary": "Dump only roles, no databases or tablespaces.", "signature": {"url": "/docs/14/app-pg-dumpall.html", "text": "-r --roles-only"}}, {"summary": "Dump only the object definitions (schema), not data.", "signature": {"url": "/docs/14/app-pg-dumpall.html", "text": "-s --schema-only"}}, {"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": {"url": "/docs/14/app-pg-dumpall.html", "text": "-S username --superuser= username"}}, {"summary": "Dump only tablespaces, no databases or roles.", "signature": {"url": "/docs/14/app-pg-dumpall.html", "text": "-t --tablespaces-only"}}, {"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": {"url": "/docs/14/app-pg-dumpall.html", "text": "-v --verbose"}}, {"summary": "Print the pg_dumpall version and exit.", "signature": {"url": "/docs/14/app-pg-dumpall.html", "text": "-V --version"}}, {"summary": "Prevent dumping of access privileges (grant/revoke commands).", "signature": {"url": "/docs/14/app-pg-dumpall.html", "text": "-x --no-privileges --no-acl"}}, {"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": {"url": "/docs/14/app-pg-dumpall.html", "text": "--binary-upgrade"}}, {"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": {"url": "/docs/14/app-pg-dumpall.html", "text": "--column-inserts --attribute-inserts"}}, {"summary": "This option disables the use of dollar quoting for function bodies, and forces them to be quoted using SQL standard string syntax.", "signature": {"url": "/docs/14/app-pg-dumpall.html", "text": "--disable-dollar-quoting"}}, {"summary": "This option is relevant only when creating a data-only dump. 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": {"url": "/docs/14/app-pg-dumpall.html", "text": "--disable-triggers"}}, {"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 below), 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": {"url": "/docs/14/app-pg-dumpall.html", "text": "--exclude-database= pattern"}}, {"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": {"url": "/docs/14/app-pg-dumpall.html", "text": "--extra-float-digits= ndigits"}}, {"summary": "Use DROP ... IF EXISTS commands to drop objects in --clean mode. This suppresses \u201c does not exist \u201d errors that might otherwise be reported. This option is not valid unless --clean is also specified.", "signature": {"url": "/docs/14/app-pg-dumpall.html", "text": "--if-exists"}}, {"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": {"url": "/docs/14/app-pg-dumpall.html", "text": "--inserts"}}, {"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": {"url": "/docs/14/app-pg-dumpall.html", "text": "--load-via-partition-root"}}, {"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": {"url": "/docs/14/app-pg-dumpall.html", "text": "--lock-wait-timeout= timeout"}}, {"summary": "Do not dump comments.", "signature": {"url": "/docs/14/app-pg-dumpall.html", "text": "--no-comments"}}, {"summary": "Do not dump publications.", "signature": {"url": "/docs/14/app-pg-dumpall.html", "text": "--no-publications"}}, {"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": {"url": "/docs/14/app-pg-dumpall.html", "text": "--no-role-passwords"}}, {"summary": "Do not dump security labels.", "signature": {"url": "/docs/14/app-pg-dumpall.html", "text": "--no-security-labels"}}, {"summary": "Do not dump subscriptions.", "signature": {"url": "/docs/14/app-pg-dumpall.html", "text": "--no-subscriptions"}}, {"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": {"url": "/docs/14/app-pg-dumpall.html", "text": "--no-sync"}}, {"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": {"url": "/docs/14/app-pg-dumpall.html", "text": "--no-tablespaces"}}, {"summary": "Do not output commands to set TOAST compression methods. With this option, all columns will be restored with the default compression setting.", "signature": {"url": "/docs/14/app-pg-dumpall.html", "text": "--no-toast-compression"}}, {"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": {"url": "/docs/14/app-pg-dumpall.html", "text": "--no-unlogged-table-data"}}, {"summary": "Add ON CONFLICT DO NOTHING to INSERT commands. This option is not valid unless --inserts or --column-inserts is also specified.", "signature": {"url": "/docs/14/app-pg-dumpall.html", "text": "--on-conflict-do-nothing"}}, {"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": {"url": "/docs/14/app-pg-dumpall.html", "text": "--quote-all-identifiers"}}, {"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": {"url": "/docs/14/app-pg-dumpall.html", "text": "--restrict-key= restrict_key"}}, {"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": {"url": "/docs/14/app-pg-dumpall.html", "text": "--rows-per-insert= nrows"}}, {"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": {"url": "/docs/14/app-pg-dumpall.html", "text": "--use-set-session-authorization"}}, {"summary": "Show help about pg_dumpall command line arguments, and exit.", "signature": {"url": "/docs/14/app-pg-dumpall.html", "text": "-? --help"}}, {"summary": "Specifies parameters used to connect to the server, as a connection string ; these will override any conflicting command line options.", "signature": {"url": "/docs/14/app-pg-dumpall.html", "text": "-d connstr --dbname= connstr"}}, {"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": {"url": "/docs/14/app-pg-dumpall.html", "text": "-h host --host= host"}}, {"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": {"url": "/docs/14/app-pg-dumpall.html", "text": "-l dbname --database= dbname"}}, {"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": {"url": "/docs/14/app-pg-dumpall.html", "text": "-p port --port= port"}}, {"summary": "User name to connect as.", "signature": {"url": "/docs/14/app-pg-dumpall.html", "text": "-U username --username= username"}}, {"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": {"url": "/docs/14/app-pg-dumpall.html", "text": "-w --no-password"}}, {"summary": "Force pg_dumpall to prompt for a password before connecting to a database.", "signature": {"url": "/docs/14/app-pg-dumpall.html", "text": "-W --password"}}, {"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.", "signature": {"url": "/docs/14/app-pg-dumpall.html", "text": "--role= rolename"}}], "title": "Documented options", "columns": [{"key": "signature", "label": "Option and arguments"}, {"key": "summary", "label": "Description"}]}, {"key": "environment", "rows": [{"name": "PGHOST PGOPTIONS PGPORT PGUSER", "description": "Default connection parameters"}, {"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}], "title": "Environment variables", "columns": [{"key": "name", "label": "Variable"}, {"key": "description", "label": "Meaning"}]}], "options": [{"names": ["-a", "--data-only"], "summary": "Dump only the data, not the schema (data definitions).", "signature": "-a --data-only", "source_url": "/docs/14/app-pg-dumpall.html", "description": "Dump only the data, not the schema (data definitions)."}, {"names": ["-c", "--clean"], "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": "-c --clean", "source_url": "/docs/14/app-pg-dumpall.html", "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": ["-E encoding", "--encoding= encoding"], "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": "-E encoding --encoding= encoding", "source_url": "/docs/14/app-pg-dumpall.html", "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": ["-f filename", "--file= filename"], "summary": "Send output to the specified file. If this is omitted, the standard output is used.", "signature": "-f filename --file= filename", "source_url": "/docs/14/app-pg-dumpall.html", "description": "Send output to the specified file. If this is omitted, the standard output is used."}, {"names": ["-g", "--globals-only"], "summary": "Dump only global objects (roles and tablespaces), no databases.", "signature": "-g --globals-only", "source_url": "/docs/14/app-pg-dumpall.html", "description": "Dump only global objects (roles and tablespaces), no databases."}, {"names": ["-O", "--no-owner"], "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": "-O --no-owner", "source_url": "/docs/14/app-pg-dumpall.html", "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": ["-r", "--roles-only"], "summary": "Dump only roles, no databases or tablespaces.", "signature": "-r --roles-only", "source_url": "/docs/14/app-pg-dumpall.html", "description": "Dump only roles, no databases or tablespaces."}, {"names": ["-s", "--schema-only"], "summary": "Dump only the object definitions (schema), not data.", "signature": "-s --schema-only", "source_url": "/docs/14/app-pg-dumpall.html", "description": "Dump only the object definitions (schema), not data."}, {"names": ["-S username", "--superuser= username"], "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": "-S username --superuser= username", "source_url": "/docs/14/app-pg-dumpall.html", "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": ["-t", "--tablespaces-only"], "summary": "Dump only tablespaces, no databases or roles.", "signature": "-t --tablespaces-only", "source_url": "/docs/14/app-pg-dumpall.html", "description": "Dump only tablespaces, no databases or roles."}, {"names": ["-v", "--verbose"], "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": "-v --verbose", "source_url": "/docs/14/app-pg-dumpall.html", "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", "--version"], "summary": "Print the pg_dumpall version and exit.", "signature": "-V --version", "source_url": "/docs/14/app-pg-dumpall.html", "description": "Print the pg_dumpall version and exit."}, {"names": ["-x", "--no-privileges", "--no-acl"], "summary": "Prevent dumping of access privileges (grant/revoke commands).", "signature": "-x --no-privileges --no-acl", "source_url": "/docs/14/app-pg-dumpall.html", "description": "Prevent dumping of access privileges (grant/revoke commands)."}, {"names": ["--binary-upgrade"], "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": "--binary-upgrade", "source_url": "/docs/14/app-pg-dumpall.html", "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": ["--column-inserts", "--attribute-inserts"], "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": "--column-inserts --attribute-inserts", "source_url": "/docs/14/app-pg-dumpall.html", "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": ["--disable-dollar-quoting"], "summary": "This option disables the use of dollar quoting for function bodies, and forces them to be quoted using SQL standard string syntax.", "signature": "--disable-dollar-quoting", "source_url": "/docs/14/app-pg-dumpall.html", "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-triggers"], "summary": "This option is relevant only when creating a data-only dump. 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": "--disable-triggers", "source_url": "/docs/14/app-pg-dumpall.html", "description": "This option is relevant only when creating a data-only dump. 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": ["--exclude-database= pattern"], "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 below), 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": "--exclude-database= pattern", "source_url": "/docs/14/app-pg-dumpall.html", "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 below), 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": ["--extra-float-digits= ndigits"], "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": "--extra-float-digits= ndigits", "source_url": "/docs/14/app-pg-dumpall.html", "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": ["--if-exists"], "summary": "Use DROP ... IF EXISTS commands to drop objects in --clean mode. This suppresses \u201c does not exist \u201d errors that might otherwise be reported. This option is not valid unless --clean is also specified.", "signature": "--if-exists", "source_url": "/docs/14/app-pg-dumpall.html", "description": "Use DROP ... IF EXISTS commands to drop objects in --clean mode. This suppresses \u201c does not exist \u201d errors that might otherwise be reported. This option is not valid unless --clean is also specified."}, {"names": ["--inserts"], "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": "--inserts", "source_url": "/docs/14/app-pg-dumpall.html", "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": ["--load-via-partition-root"], "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": "--load-via-partition-root", "source_url": "/docs/14/app-pg-dumpall.html", "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": ["--lock-wait-timeout= timeout"], "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": "--lock-wait-timeout= timeout", "source_url": "/docs/14/app-pg-dumpall.html", "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": ["--no-comments"], "summary": "Do not dump comments.", "signature": "--no-comments", "source_url": "/docs/14/app-pg-dumpall.html", "description": "Do not dump comments."}, {"names": ["--no-publications"], "summary": "Do not dump publications.", "signature": "--no-publications", "source_url": "/docs/14/app-pg-dumpall.html", "description": "Do not dump publications."}, {"names": ["--no-role-passwords"], "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": "--no-role-passwords", "source_url": "/docs/14/app-pg-dumpall.html", "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-security-labels"], "summary": "Do not dump security labels.", "signature": "--no-security-labels", "source_url": "/docs/14/app-pg-dumpall.html", "description": "Do not dump security labels."}, {"names": ["--no-subscriptions"], "summary": "Do not dump subscriptions.", "signature": "--no-subscriptions", "source_url": "/docs/14/app-pg-dumpall.html", "description": "Do not dump subscriptions."}, {"names": ["--no-sync"], "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": "--no-sync", "source_url": "/docs/14/app-pg-dumpall.html", "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-tablespaces"], "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": "--no-tablespaces", "source_url": "/docs/14/app-pg-dumpall.html", "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-toast-compression"], "summary": "Do not output commands to set TOAST compression methods. With this option, all columns will be restored with the default compression setting.", "signature": "--no-toast-compression", "source_url": "/docs/14/app-pg-dumpall.html", "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-unlogged-table-data"], "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": "--no-unlogged-table-data", "source_url": "/docs/14/app-pg-dumpall.html", "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": ["--on-conflict-do-nothing"], "summary": "Add ON CONFLICT DO NOTHING to INSERT commands. This option is not valid unless --inserts or --column-inserts is also specified.", "signature": "--on-conflict-do-nothing", "source_url": "/docs/14/app-pg-dumpall.html", "description": "Add ON CONFLICT DO NOTHING to INSERT commands. This option is not valid unless --inserts or --column-inserts is also specified."}, {"names": ["--quote-all-identifiers"], "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": "--quote-all-identifiers", "source_url": "/docs/14/app-pg-dumpall.html", "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": ["--restrict-key= restrict_key"], "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": "--restrict-key= restrict_key", "source_url": "/docs/14/app-pg-dumpall.html", "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": ["--rows-per-insert= nrows"], "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": "--rows-per-insert= nrows", "source_url": "/docs/14/app-pg-dumpall.html", "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": ["--use-set-session-authorization"], "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": "--use-set-session-authorization", "source_url": "/docs/14/app-pg-dumpall.html", "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": ["-?", "--help"], "summary": "Show help about pg_dumpall command line arguments, and exit.", "signature": "-? --help", "source_url": "/docs/14/app-pg-dumpall.html", "description": "Show help about pg_dumpall command line arguments, and exit."}, {"names": ["-d connstr", "--dbname= connstr"], "summary": "Specifies parameters used to connect to the server, as a connection string ; these will override any conflicting command line options.", "signature": "-d connstr --dbname= connstr", "source_url": "/docs/14/app-pg-dumpall.html", "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": ["-h host", "--host= host"], "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": "-h host --host= host", "source_url": "/docs/14/app-pg-dumpall.html", "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": ["-l dbname", "--database= dbname"], "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": "-l dbname --database= dbname", "source_url": "/docs/14/app-pg-dumpall.html", "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": ["-p port", "--port= port"], "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": "-p port --port= port", "source_url": "/docs/14/app-pg-dumpall.html", "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": ["-U username", "--username= username"], "summary": "User name to connect as.", "signature": "-U username --username= username", "source_url": "/docs/14/app-pg-dumpall.html", "description": "User name to connect as."}, {"names": ["-w", "--no-password"], "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": "-w --no-password", "source_url": "/docs/14/app-pg-dumpall.html", "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", "--password"], "summary": "Force pg_dumpall to prompt for a password before connecting to a database.", "signature": "-W --password", "source_url": "/docs/14/app-pg-dumpall.html", "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": ["--role= rolename"], "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.", "signature": "--role= rolename", "source_url": "/docs/14/app-pg-dumpall.html", "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."}], "related": [{"url": "/wiki/conn/?v=14", "label": "libpq connection parameters"}], "release": {"ref": "https://ftp.postgresql.org/pub/source/v14.24/postgresql-14.24.tar.bz2", "label": "14.24", "major": "14", "channel": "stable", "manifest": {"pdf": {"A4": {"url": "/files/documentation/pdf/14/postgresql-14-A4.pdf", "bytes": 14354704, "pages": 2944, "sha256": "8bc6b9dd7b246888bb77f0a5e8c39a2eae52e9926569832669c7d1600becb27c", "built_at": "2026-09-26"}, "US": {"url": "/files/documentation/pdf/14/postgresql-14-US.pdf", "bytes": 14242178, "pages": 3102, "sha256": "b7ecb5a5f62d8b9f73a69e25a7d26ba285373bc53168a553bff7b77955506db4", "built_at": "2026-09-26"}}, "tree": "14", "index": "index.html", "major": "14", "pages": 1158, "release": "14.24", "source_url": "https://ftp.postgresql.org/pub/source/v14.24/postgresql-14.24.tar.bz2", "svg_assets": 3, "source_mode": "en HTML verified against the pinned official archive", "source_sha256": "a7fa7ed3d558172355f51406097a7bd4f6b473be80f311ef7cda96bf383d8897"}, "revision": "588700d46356d8837c77c7c0a4e71e645fe6535983b8f1830aa8f2e4e41c40ae", "evidence_kind": "English manual and source declarations", "source_sha256": "a7fa7ed3d558172355f51406097a7bd4f6b473be80f311ef7cda96bf383d8897"}, "sources": [{"url": "/docs/14/app-pg-dumpall.html", "file": "app-pg-dumpall.html", "label": "14.24 English manual \u00b7 app-pg-dumpall.html", "anchor": "", "sha256": "46fcafed3b93bc5688e40d89276624b5c25968800a78e8a6f371f4ea1d882a30"}, {"url": "/docs/14/reference-client.html", "file": "reference-client.html", "label": "Client applications inventory", "anchor": "", "sha256": "5a13567a052954dfe494dfaab9f50919faa1ae56023930fdbb78d45e53feccde"}], "sections": [], "synopsis": ["pg_dumpall [ connection-option ...] [ option ...]"], "signature": "pg_dumpall [ connection-option ...] [ option ...]", "description": ["pg_dumpall \u2014 extract a PostgreSQL database cluster into a script file"], "environment": [{"name": "PGHOST PGOPTIONS PGPORT PGUSER", "description": "Default connection parameters"}, {"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}], "manual_html": "<div><div class=\"refentry\" id=\"APP-PG-DUMPALL\">\n<div class=\"titlepage\"></div>\n<div class=\"refnamediv\">\n<h2><span class=\"refentrytitle\"><span class=\"application\">pg_dumpall</span></span></h2>\n<p>pg_dumpall \u2014 extract a <span class=\"productname\">PostgreSQL</span> database cluster into a script file</p>\n</div>\n<div class=\"refsynopsisdiv\">\n<h2>Synopsis</h2>\n<div class=\"cmdsynopsis\">\n<p id=\"id-1.9.4.14.4.1\"><code class=\"command\">pg_dumpall</code> [<em class=\"replaceable\"><code>connection-option</code></em>...] [<em class=\"replaceable\"><code>option</code></em>...]</p>\n</div>\n</div>\n<div class=\"refsect1\" id=\"APP-PG-DUMPALL-DESCRIPTION\">\n<h2>Description</h2>\n<p><span class=\"application\">pg_dumpall</span> is a utility for writing out (<span class=\"quote\">\u201c<span class=\"quote\">dumping</span>\u201d</span>) all <span class=\"productname\">PostgreSQL</span> databases of a cluster into one script file. The script file contains SQL commands that can be used as input to <a class=\"xref\" href=\"/docs/14/app-psql.html\" title=\"psql\"><span class=\"refentrytitle\"><span class=\"application\">psql</span></span></a> to restore the databases. It does this by calling <a class=\"xref\" href=\"/docs/14/app-pgdump.html\" title=\"pg_dump\"><span class=\"refentrytitle\"><span class=\"application\">pg_dump</span></span></a> for each database in the cluster. <span class=\"application\">pg_dumpall</span> also dumps global objects that are common to all databases, that is, database roles and tablespaces. (<span class=\"application\">pg_dump</span> does not save these objects.)</p>\n<p>Since <span class=\"application\">pg_dumpall</span> 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.</p>\n<p>The SQL script will be written to the standard output. Use the <code class=\"option\">-f</code>/<code class=\"option\">--file</code> option or shell operators to redirect it into a file.</p>\n<p><span class=\"application\">pg_dumpall</span> needs to connect several times to the <span class=\"productname\">PostgreSQL</span> server (once per database). If you use password authentication it will ask for a password each time. It is convenient to have a <code class=\"filename\">~/.pgpass</code> file in such cases. See <a class=\"xref\" href=\"/docs/14/libpq-pgpass.html\" title=\"34.16.\u00a0The Password File\">Section\u00a034.16</a> for more information.</p>\n<div class=\"warning\">\n<h3 class=\"title\">Warning</h3>\n<p>Restoring 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.</p>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.14.6\">\n<h2>Options</h2>\n<p>The following command-line options control the content and format of the output.</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-a</code><br></span><span class=\"term\"><code class=\"option\">--data-only</code></span></dt>\n<dd>\n<p>Dump only the data, not the schema (data definitions).</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-c</code><br></span><span class=\"term\"><code class=\"option\">--clean</code></span></dt>\n<dd>\n<p>Emit SQL commands to <code class=\"command\">DROP</code> 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 <code class=\"option\">--if-exists</code> is also specified.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-E <em class=\"replaceable\"><code>encoding</code></em></code><br></span><span class=\"term\"><code class=\"option\">--encoding=<em class=\"replaceable\"><code>encoding</code></em></code></span></dt>\n<dd>\n<p>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 <code class=\"envar\">PGCLIENTENCODING</code> environment variable to the desired dump encoding.)</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-f <em class=\"replaceable\"><code>filename</code></em></code><br></span><span class=\"term\"><code class=\"option\">--file=<em class=\"replaceable\"><code>filename</code></em></code></span></dt>\n<dd>\n<p>Send output to the specified file. If this is omitted, the standard output is used.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-g</code><br></span><span class=\"term\"><code class=\"option\">--globals-only</code></span></dt>\n<dd>\n<p>Dump only global objects (roles and tablespaces), no databases.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-O</code><br></span><span class=\"term\"><code class=\"option\">--no-owner</code></span></dt>\n<dd>\n<p>Do not output commands to set ownership of objects to match the original database. By default, <span class=\"application\">pg_dumpall</span> issues <code class=\"command\">ALTER OWNER</code> or <code class=\"command\">SET SESSION AUTHORIZATION</code> 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 <code class=\"option\">-O</code>.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-r</code><br></span><span class=\"term\"><code class=\"option\">--roles-only</code></span></dt>\n<dd>\n<p>Dump only roles, no databases or tablespaces.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-s</code><br></span><span class=\"term\"><code class=\"option\">--schema-only</code></span></dt>\n<dd>\n<p>Dump only the object definitions (schema), not data.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-S <em class=\"replaceable\"><code>username</code></em></code><br></span><span class=\"term\"><code class=\"option\">--superuser=<em class=\"replaceable\"><code>username</code></em></code></span></dt>\n<dd>\n<p>Specify the superuser user name to use when disabling triggers. This is relevant only if <code class=\"option\">--disable-triggers</code> is used. (Usually, it's better to leave this out, and instead start the resulting script as superuser.)</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-t</code><br></span><span class=\"term\"><code class=\"option\">--tablespaces-only</code></span></dt>\n<dd>\n<p>Dump only tablespaces, no databases or roles.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-v</code><br></span><span class=\"term\"><code class=\"option\">--verbose</code></span></dt>\n<dd>\n<p>Specifies verbose mode. This will cause <span class=\"application\">pg_dumpall</span> 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 <span class=\"application\">pg_dump</span>.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-V</code><br></span><span class=\"term\"><code class=\"option\">--version</code></span></dt>\n<dd>\n<p>Print the <span class=\"application\">pg_dumpall</span> version and exit.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-x</code><br></span><span class=\"term\"><code class=\"option\">--no-privileges</code><br></span><span class=\"term\"><code class=\"option\">--no-acl</code></span></dt>\n<dd>\n<p>Prevent dumping of access privileges (grant/revoke commands).</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--binary-upgrade</code></span></dt>\n<dd>\n<p>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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--column-inserts</code><br></span><span class=\"term\"><code class=\"option\">--attribute-inserts</code></span></dt>\n<dd>\n<p>Dump data as <code class=\"command\">INSERT</code> commands with explicit column names (<code class=\"literal\">INSERT INTO <em class=\"replaceable\"><code>table</code></em> (<em class=\"replaceable\"><code>column</code></em>, ...) VALUES ...</code>). This will make restoration very slow; it is mainly useful for making dumps that can be loaded into non-<span class=\"productname\">PostgreSQL</span> databases.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--disable-dollar-quoting</code></span></dt>\n<dd>\n<p>This option disables the use of dollar quoting for function bodies, and forces them to be quoted using SQL standard string syntax.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--disable-triggers</code></span></dt>\n<dd>\n<p>This option is relevant only when creating a data-only dump. It instructs <span class=\"application\">pg_dumpall</span> 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.</p>\n<p>Presently, the commands emitted for <code class=\"option\">--disable-triggers</code> must be done as superuser. So, you should also specify a superuser name with <code class=\"option\">-S</code>, or preferably be careful to start the resulting script as a superuser.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--exclude-database=<em class=\"replaceable\"><code>pattern</code></em></code></span></dt>\n<dd>\n<p>Do not dump databases whose name matches <em class=\"replaceable\"><code>pattern</code></em>. Multiple patterns can be excluded by writing multiple <code class=\"option\">--exclude-database</code> switches. The <em class=\"replaceable\"><code>pattern</code></em> parameter is interpreted as a pattern according to the same rules used by <span class=\"application\">psql</span>'s <code class=\"literal\">\\d</code> commands (see <a class=\"xref\" href=\"/docs/14/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\">Patterns</a> below), 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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--extra-float-digits=<em class=\"replaceable\"><code>ndigits</code></em></code></span></dt>\n<dd>\n<p>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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--if-exists</code></span></dt>\n<dd>\n<p>Use <code class=\"literal\">DROP ... IF EXISTS</code> commands to drop objects in <code class=\"option\">--clean</code> mode. This suppresses <span class=\"quote\">\u201c<span class=\"quote\">does not exist</span>\u201d</span> errors that might otherwise be reported. This option is not valid unless <code class=\"option\">--clean</code> is also specified.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--inserts</code></span></dt>\n<dd>\n<p>Dump data as <code class=\"command\">INSERT</code> commands (rather than <code class=\"command\">COPY</code>). This will make restoration very slow; it is mainly useful for making dumps that can be loaded into non-<span class=\"productname\">PostgreSQL</span> databases. Note that the restore might fail altogether if you have rearranged column order. The <code class=\"option\">--column-inserts</code> option is safer, though even slower.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--load-via-partition-root</code></span></dt>\n<dd>\n<p>When dumping data for a table partition, make the <code class=\"command\">COPY</code> or <code class=\"command\">INSERT</code> 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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--lock-wait-timeout=<em class=\"replaceable\"><code>timeout</code></em></code></span></dt>\n<dd>\n<p>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 <em class=\"replaceable\"><code>timeout</code></em>. The timeout may be specified in any of the formats accepted by <code class=\"command\">SET statement_timeout</code>.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-comments</code></span></dt>\n<dd>\n<p>Do not dump comments.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-publications</code></span></dt>\n<dd>\n<p>Do not dump publications.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-role-passwords</code></span></dt>\n<dd>\n<p>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 <code class=\"structname\">pg_roles</code> instead of <code class=\"structname\">pg_authid</code>. Therefore, this option also helps if access to <code class=\"structname\">pg_authid</code> is restricted by some security policy.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-security-labels</code></span></dt>\n<dd>\n<p>Do not dump security labels.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-subscriptions</code></span></dt>\n<dd>\n<p>Do not dump subscriptions.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-sync</code></span></dt>\n<dd>\n<p>By default, <code class=\"command\">pg_dumpall</code> will wait for all files to be written safely to disk. This option causes <code class=\"command\">pg_dumpall</code> 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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-tablespaces</code></span></dt>\n<dd>\n<p>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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-toast-compression</code></span></dt>\n<dd>\n<p>Do not output commands to set TOAST compression methods. With this option, all columns will be restored with the default compression setting.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-unlogged-table-data</code></span></dt>\n<dd>\n<p>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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--on-conflict-do-nothing</code></span></dt>\n<dd>\n<p>Add <code class=\"literal\">ON CONFLICT DO NOTHING</code> to <code class=\"command\">INSERT</code> commands. This option is not valid unless <code class=\"option\">--inserts</code> or <code class=\"option\">--column-inserts</code> is also specified.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--quote-all-identifiers</code></span></dt>\n<dd>\n<p>Force quoting of all identifiers. This option is recommended when dumping a database from a server whose <span class=\"productname\">PostgreSQL</span> major version is different from <span class=\"application\">pg_dumpall</span>'s, or when the output is intended to be loaded into a server of a different major version. By default, <span class=\"application\">pg_dumpall</span> 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 <code class=\"option\">--quote-all-identifiers</code> prevents such issues, at the price of a harder-to-read dump script.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--restrict-key=<em class=\"replaceable\"><code>restrict_key</code></em></code></span></dt>\n<dd>\n<p>Use the provided string as the <span class=\"application\">psql</span> <code class=\"command\">\\restrict</code> key in the dump output. If no restrict key is specified, <span class=\"application\">pg_dumpall</span> will generate a random one as needed. Keys may contain only alphanumeric characters.</p>\n<p>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 <span class=\"application\">psql</span> with the dump output.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--rows-per-insert=<em class=\"replaceable\"><code>nrows</code></em></code></span></dt>\n<dd>\n<p>Dump data as <code class=\"command\">INSERT</code> commands (rather than <code class=\"command\">COPY</code>). Controls the maximum number of rows per <code class=\"command\">INSERT</code> 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 <code class=\"command\">INSERT</code> to be lost, rather than the entire table contents.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--use-set-session-authorization</code></span></dt>\n<dd>\n<p>Output SQL-standard <code class=\"command\">SET SESSION AUTHORIZATION</code> commands instead of <code class=\"command\">ALTER OWNER</code> 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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-?</code><br></span><span class=\"term\"><code class=\"option\">--help</code></span></dt>\n<dd>\n<p>Show help about <span class=\"application\">pg_dumpall</span> command line arguments, and exit.</p>\n</dd>\n</dl>\n</div>\n<p>The following command-line options control the database connection parameters.</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-d <em class=\"replaceable\"><code>connstr</code></em></code><br></span><span class=\"term\"><code class=\"option\">--dbname=<em class=\"replaceable\"><code>connstr</code></em></code></span></dt>\n<dd>\n<p>Specifies parameters used to connect to the server, as a <a class=\"link\" href=\"/docs/14/libpq-connect.html#LIBPQ-CONNSTRING\" title=\"34.1.1.\u00a0Connection Strings\">connection string</a>; these will override any conflicting command line options.</p>\n<p>The option is called <code class=\"literal\">--dbname</code> for consistency with other client applications, but because <span class=\"application\">pg_dumpall</span> needs to connect to many databases, the database name in the connection string will be ignored. Use the <code class=\"literal\">-l</code> 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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-h <em class=\"replaceable\"><code>host</code></em></code><br></span><span class=\"term\"><code class=\"option\">--host=<em class=\"replaceable\"><code>host</code></em></code></span></dt>\n<dd>\n<p>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 <code class=\"envar\">PGHOST</code> environment variable, if set, else a Unix domain socket connection is attempted.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-l <em class=\"replaceable\"><code>dbname</code></em></code><br></span><span class=\"term\"><code class=\"option\">--database=<em class=\"replaceable\"><code>dbname</code></em></code></span></dt>\n<dd>\n<p>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 <code class=\"literal\">postgres</code> database will be used, and if that does not exist, <code class=\"literal\">template1</code> will be used.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-p <em class=\"replaceable\"><code>port</code></em></code><br></span><span class=\"term\"><code class=\"option\">--port=<em class=\"replaceable\"><code>port</code></em></code></span></dt>\n<dd>\n<p>Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the <code class=\"envar\">PGPORT</code> environment variable, if set, or a compiled-in default.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-U <em class=\"replaceable\"><code>username</code></em></code><br></span><span class=\"term\"><code class=\"option\">--username=<em class=\"replaceable\"><code>username</code></em></code></span></dt>\n<dd>\n<p>User name to connect as.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-w</code><br></span><span class=\"term\"><code class=\"option\">--no-password</code></span></dt>\n<dd>\n<p>Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a <code class=\"filename\">.pgpass</code> 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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-W</code><br></span><span class=\"term\"><code class=\"option\">--password</code></span></dt>\n<dd>\n<p>Force <span class=\"application\">pg_dumpall</span> to prompt for a password before connecting to a database.</p>\n<p>This option is never essential, since <span class=\"application\">pg_dumpall</span> will automatically prompt for a password if the server demands password authentication. However, <span class=\"application\">pg_dumpall</span> will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing <code class=\"option\">-W</code> to avoid the extra connection attempt.</p>\n<p>Note that the password prompt will occur again for each database to be dumped. Usually, it's better to set up a <code class=\"filename\">~/.pgpass</code> file than to rely on manual password entry.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--role=<em class=\"replaceable\"><code>rolename</code></em></code></span></dt>\n<dd>\n<p>Specifies a role name to be used to create the dump. This option causes <span class=\"application\">pg_dumpall</span> to issue a <code class=\"command\">SET ROLE</code> <em class=\"replaceable\"><code>rolename</code></em> command after connecting to the database. It is useful when the authenticated user (specified by <code class=\"option\">-U</code>) lacks privileges needed by <span class=\"application\">pg_dumpall</span>, 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.</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.14.7\">\n<h2>Environment</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"envar\">PGHOST</code><br></span><span class=\"term\"><code class=\"envar\">PGOPTIONS</code><br></span><span class=\"term\"><code class=\"envar\">PGPORT</code><br></span><span class=\"term\"><code class=\"envar\">PGUSER</code></span></dt>\n<dd>\n<p>Default connection parameters</p>\n</dd>\n<dt><span class=\"term\"><code class=\"envar\">PG_COLOR</code></span></dt>\n<dd>\n<p>Specifies whether to use color in diagnostic messages. Possible values are <code class=\"literal\">always</code>, <code class=\"literal\">auto</code> and <code class=\"literal\">never</code>.</p>\n</dd>\n</dl>\n</div>\n<p>This utility, like most other <span class=\"productname\">PostgreSQL</span> utilities, also uses the environment variables supported by <span class=\"application\">libpq</span> (see <a class=\"xref\" href=\"/docs/14/libpq-envars.html\" title=\"34.15.\u00a0Environment Variables\">Section\u00a034.15</a>).</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.14.8\">\n<h2>Notes</h2>\n<p>Since <span class=\"application\">pg_dumpall</span> calls <span class=\"application\">pg_dump</span> internally, some diagnostic messages will refer to <span class=\"application\">pg_dump</span>.</p>\n<p>The <code class=\"option\">--clean</code> option can be useful even when your intention is to restore the dump script into a fresh cluster. Use of <code class=\"option\">--clean</code> authorizes the script to drop and re-create the built-in <code class=\"literal\">postgres</code> and <code class=\"literal\">template1</code> 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.</p>\n<p>Once restored, it is wise to run <code class=\"command\">ANALYZE</code> on each database so the optimizer has useful statistics. You can also run <code class=\"command\">vacuumdb -a -z</code> to analyze all databases.</p>\n<p>The dump script should not be expected to run completely without errors. In particular, because the script will issue <code class=\"command\">CREATE ROLE</code> for every role existing in the source cluster, it is certain to get a <span class=\"quote\">\u201c<span class=\"quote\">role already exists</span>\u201d</span> 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 <code class=\"option\">--clean</code> option is likely to produce additional harmless error messages about non-existent objects, although you can minimize those by adding <code class=\"option\">--if-exists</code>.</p>\n<p><span class=\"application\">pg_dumpall</span> requires all needed tablespace directories to exist before the restore; otherwise, database creation will fail for databases in non-default locations.</p>\n<p>It is generally recommended to use the <code class=\"option\">-X</code> (<code class=\"option\">--no-psqlrc</code>) option when restoring a database from a <span class=\"application\">pg_dumpall</span> script to ensure a clean restore process and prevent potential conflicts with non-default <span class=\"application\">psql</span> configurations. Additionally, because the <span class=\"application\">pg_dumpall</span> script may include <span class=\"application\">psql</span> meta-commands, it may be incompatible with clients other than <span class=\"application\">psql</span>.</p>\n</div>\n<div class=\"refsect1\" id=\"APP-PG-DUMPALL-EX\">\n<h2>Examples</h2>\n<p>To dump all databases:</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_dumpall &gt; db.out</code></strong>\n</pre>\n<p>To restore database(s) from this file, you can use:</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>psql -X -f db.out -d postgres</code></strong>\n</pre>\n<p>It is not important which database you connect to here since the script file created by <span class=\"application\">pg_dumpall</span> will contain the appropriate commands to create and connect to the saved databases. An exception is that if you specified <code class=\"option\">--clean</code>, you must connect to the <code class=\"literal\">postgres</code> database initially; the script will attempt to drop other databases immediately, and that will fail for the database you are connected to.</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.14.10\">\n<h2>See Also</h2>\n<p>Check <a class=\"xref\" href=\"/docs/14/app-pgdump.html\" title=\"pg_dump\"><span class=\"refentrytitle\"><span class=\"application\">pg_dump</span></span></a> for details on possible error conditions.</p>\n</div>\n</div></div>", "manual_path": "app-pg-dumpall.html", "comparison_data": {"options": [{"names": ["-a", "--data-only"], "signature": "-a --data-only", "description": "Dump only the data, not the schema (data definitions)."}, {"names": ["-c", "--clean"], "signature": "-c --clean", "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": ["-E encoding", "--encoding= encoding"], "signature": "-E encoding --encoding= encoding", "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": ["-f filename", "--file= filename"], "signature": "-f filename --file= filename", "description": "Send output to the specified file. If this is omitted, the standard output is used."}, {"names": ["-g", "--globals-only"], "signature": "-g --globals-only", "description": "Dump only global objects (roles and tablespaces), no databases."}, {"names": ["-O", "--no-owner"], "signature": "-O --no-owner", "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": ["-r", "--roles-only"], "signature": "-r --roles-only", "description": "Dump only roles, no databases or tablespaces."}, {"names": ["-s", "--schema-only"], "signature": "-s --schema-only", "description": "Dump only the object definitions (schema), not data."}, {"names": ["-S username", "--superuser= username"], "signature": "-S username --superuser= username", "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": ["-t", "--tablespaces-only"], "signature": "-t --tablespaces-only", "description": "Dump only tablespaces, no databases or roles."}, {"names": ["-v", "--verbose"], "signature": "-v --verbose", "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", "--version"], "signature": "-V --version", "description": "Print the pg_dumpall version and exit."}, {"names": ["-x", "--no-privileges", "--no-acl"], "signature": "-x --no-privileges --no-acl", "description": "Prevent dumping of access privileges (grant/revoke commands)."}, {"names": ["--binary-upgrade"], "signature": "--binary-upgrade", "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": ["--column-inserts", "--attribute-inserts"], "signature": "--column-inserts --attribute-inserts", "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": ["--disable-dollar-quoting"], "signature": "--disable-dollar-quoting", "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-triggers"], "signature": "--disable-triggers", "description": "This option is relevant only when creating a data-only dump. 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": ["--exclude-database= pattern"], "signature": "--exclude-database= pattern", "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 below), 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": ["--extra-float-digits= ndigits"], "signature": "--extra-float-digits= ndigits", "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": ["--if-exists"], "signature": "--if-exists", "description": "Use DROP ... IF EXISTS commands to drop objects in --clean mode. This suppresses \u201c does not exist \u201d errors that might otherwise be reported. This option is not valid unless --clean is also specified."}, {"names": ["--inserts"], "signature": "--inserts", "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": ["--load-via-partition-root"], "signature": "--load-via-partition-root", "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": ["--lock-wait-timeout= timeout"], "signature": "--lock-wait-timeout= timeout", "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": ["--no-comments"], "signature": "--no-comments", "description": "Do not dump comments."}, {"names": ["--no-publications"], "signature": "--no-publications", "description": "Do not dump publications."}, {"names": ["--no-role-passwords"], "signature": "--no-role-passwords", "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-security-labels"], "signature": "--no-security-labels", "description": "Do not dump security labels."}, {"names": ["--no-subscriptions"], "signature": "--no-subscriptions", "description": "Do not dump subscriptions."}, {"names": ["--no-sync"], "signature": "--no-sync", "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-tablespaces"], "signature": "--no-tablespaces", "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-toast-compression"], "signature": "--no-toast-compression", "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-unlogged-table-data"], "signature": "--no-unlogged-table-data", "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": ["--on-conflict-do-nothing"], "signature": "--on-conflict-do-nothing", "description": "Add ON CONFLICT DO NOTHING to INSERT commands. This option is not valid unless --inserts or --column-inserts is also specified."}, {"names": ["--quote-all-identifiers"], "signature": "--quote-all-identifiers", "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": ["--restrict-key= restrict_key"], "signature": "--restrict-key= restrict_key", "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": ["--rows-per-insert= nrows"], "signature": "--rows-per-insert= nrows", "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": ["--use-set-session-authorization"], "signature": "--use-set-session-authorization", "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": ["-?", "--help"], "signature": "-? --help", "description": "Show help about pg_dumpall command line arguments, and exit."}, {"names": ["-d connstr", "--dbname= connstr"], "signature": "-d connstr --dbname= connstr", "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": ["-h host", "--host= host"], "signature": "-h host --host= host", "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": ["-l dbname", "--database= dbname"], "signature": "-l dbname --database= dbname", "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": ["-p port", "--port= port"], "signature": "-p port --port= port", "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": ["-U username", "--username= username"], "signature": "-U username --username= username", "description": "User name to connect as."}, {"names": ["-w", "--no-password"], "signature": "-w --no-password", "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", "--password"], "signature": "-W --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": ["--role= rolename"], "signature": "--role= rolename", "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."}], "synopsis": ["pg_dumpall [ connection-option ...] [ option ...]"], "environment": [{"name": "PGHOST PGOPTIONS PGPORT PGUSER", "description": "Default connection parameters"}, {"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}]}, "comparison_hash": "97da95cfcd71e7faf092eef446199e6ee235fded354e0bae88f3a15f711d71c6"}, "15": {"facts": [{"label": "Documented executable", "value": "pg_dumpall"}, {"label": "Executable version", "value": "15.19"}, {"label": "Reference inventory", "value": "Client applications"}, {"label": "Option definition groups", "value": "47"}], "tables": [{"key": "options", "rows": [{"summary": "Dump only the data, not the schema (data definitions).", "signature": {"url": "/docs/15/app-pg-dumpall.html", "text": "-a --data-only"}}, {"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": {"url": "/docs/15/app-pg-dumpall.html", "text": "-c --clean"}}, {"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": {"url": "/docs/15/app-pg-dumpall.html", "text": "-E encoding --encoding= encoding"}}, {"summary": "Send output to the specified file. If this is omitted, the standard output is used.", "signature": {"url": "/docs/15/app-pg-dumpall.html", "text": "-f filename --file= filename"}}, {"summary": "Dump only global objects (roles and tablespaces), no databases.", "signature": {"url": "/docs/15/app-pg-dumpall.html", "text": "-g --globals-only"}}, {"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": {"url": "/docs/15/app-pg-dumpall.html", "text": "-O --no-owner"}}, {"summary": "Dump only roles, no databases or tablespaces.", "signature": {"url": "/docs/15/app-pg-dumpall.html", "text": "-r --roles-only"}}, {"summary": "Dump only the object definitions (schema), not data.", "signature": {"url": "/docs/15/app-pg-dumpall.html", "text": "-s --schema-only"}}, {"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": {"url": "/docs/15/app-pg-dumpall.html", "text": "-S username --superuser= username"}}, {"summary": "Dump only tablespaces, no databases or roles.", "signature": {"url": "/docs/15/app-pg-dumpall.html", "text": "-t --tablespaces-only"}}, {"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": {"url": "/docs/15/app-pg-dumpall.html", "text": "-v --verbose"}}, {"summary": "Print the pg_dumpall version and exit.", "signature": {"url": "/docs/15/app-pg-dumpall.html", "text": "-V --version"}}, {"summary": "Prevent dumping of access privileges (grant/revoke commands).", "signature": {"url": "/docs/15/app-pg-dumpall.html", "text": "-x --no-privileges --no-acl"}}, {"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": {"url": "/docs/15/app-pg-dumpall.html", "text": "--binary-upgrade"}}, {"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": {"url": "/docs/15/app-pg-dumpall.html", "text": "--column-inserts --attribute-inserts"}}, {"summary": "This option disables the use of dollar quoting for function bodies, and forces them to be quoted using SQL standard string syntax.", "signature": {"url": "/docs/15/app-pg-dumpall.html", "text": "--disable-dollar-quoting"}}, {"summary": "This option is relevant only when creating a data-only dump. 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": {"url": "/docs/15/app-pg-dumpall.html", "text": "--disable-triggers"}}, {"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 below), 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": {"url": "/docs/15/app-pg-dumpall.html", "text": "--exclude-database= pattern"}}, {"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": {"url": "/docs/15/app-pg-dumpall.html", "text": "--extra-float-digits= ndigits"}}, {"summary": "Use DROP ... IF EXISTS commands to drop objects in --clean mode. This suppresses \u201c does not exist \u201d errors that might otherwise be reported. This option is not valid unless --clean is also specified.", "signature": {"url": "/docs/15/app-pg-dumpall.html", "text": "--if-exists"}}, {"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": {"url": "/docs/15/app-pg-dumpall.html", "text": "--inserts"}}, {"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": {"url": "/docs/15/app-pg-dumpall.html", "text": "--load-via-partition-root"}}, {"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": {"url": "/docs/15/app-pg-dumpall.html", "text": "--lock-wait-timeout= timeout"}}, {"summary": "Do not dump comments.", "signature": {"url": "/docs/15/app-pg-dumpall.html", "text": "--no-comments"}}, {"summary": "Do not dump publications.", "signature": {"url": "/docs/15/app-pg-dumpall.html", "text": "--no-publications"}}, {"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": {"url": "/docs/15/app-pg-dumpall.html", "text": "--no-role-passwords"}}, {"summary": "Do not dump security labels.", "signature": {"url": "/docs/15/app-pg-dumpall.html", "text": "--no-security-labels"}}, {"summary": "Do not dump subscriptions.", "signature": {"url": "/docs/15/app-pg-dumpall.html", "text": "--no-subscriptions"}}, {"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": {"url": "/docs/15/app-pg-dumpall.html", "text": "--no-sync"}}, {"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": {"url": "/docs/15/app-pg-dumpall.html", "text": "--no-table-access-method"}}, {"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": {"url": "/docs/15/app-pg-dumpall.html", "text": "--no-tablespaces"}}, {"summary": "Do not output commands to set TOAST compression methods. With this option, all columns will be restored with the default compression setting.", "signature": {"url": "/docs/15/app-pg-dumpall.html", "text": "--no-toast-compression"}}, {"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": {"url": "/docs/15/app-pg-dumpall.html", "text": "--no-unlogged-table-data"}}, {"summary": "Add ON CONFLICT DO NOTHING to INSERT commands. This option is not valid unless --inserts or --column-inserts is also specified.", "signature": {"url": "/docs/15/app-pg-dumpall.html", "text": "--on-conflict-do-nothing"}}, {"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": {"url": "/docs/15/app-pg-dumpall.html", "text": "--quote-all-identifiers"}}, {"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": {"url": "/docs/15/app-pg-dumpall.html", "text": "--restrict-key= restrict_key"}}, {"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": {"url": "/docs/15/app-pg-dumpall.html", "text": "--rows-per-insert= nrows"}}, {"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": {"url": "/docs/15/app-pg-dumpall.html", "text": "--use-set-session-authorization"}}, {"summary": "Show help about pg_dumpall command line arguments, and exit.", "signature": {"url": "/docs/15/app-pg-dumpall.html", "text": "-? --help"}}, {"summary": "Specifies parameters used to connect to the server, as a connection string ; these will override any conflicting command line options.", "signature": {"url": "/docs/15/app-pg-dumpall.html", "text": "-d connstr --dbname= connstr"}}, {"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": {"url": "/docs/15/app-pg-dumpall.html", "text": "-h host --host= host"}}, {"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": {"url": "/docs/15/app-pg-dumpall.html", "text": "-l dbname --database= dbname"}}, {"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": {"url": "/docs/15/app-pg-dumpall.html", "text": "-p port --port= port"}}, {"summary": "User name to connect as.", "signature": {"url": "/docs/15/app-pg-dumpall.html", "text": "-U username --username= username"}}, {"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": {"url": "/docs/15/app-pg-dumpall.html", "text": "-w --no-password"}}, {"summary": "Force pg_dumpall to prompt for a password before connecting to a database.", "signature": {"url": "/docs/15/app-pg-dumpall.html", "text": "-W --password"}}, {"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.", "signature": {"url": "/docs/15/app-pg-dumpall.html", "text": "--role= rolename"}}], "title": "Documented options", "columns": [{"key": "signature", "label": "Option and arguments"}, {"key": "summary", "label": "Description"}]}, {"key": "environment", "rows": [{"name": "PGHOST PGOPTIONS PGPORT PGUSER", "description": "Default connection parameters"}, {"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}], "title": "Environment variables", "columns": [{"key": "name", "label": "Variable"}, {"key": "description", "label": "Meaning"}]}], "options": [{"names": ["-a", "--data-only"], "summary": "Dump only the data, not the schema (data definitions).", "signature": "-a --data-only", "source_url": "/docs/15/app-pg-dumpall.html", "description": "Dump only the data, not the schema (data definitions)."}, {"names": ["-c", "--clean"], "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": "-c --clean", "source_url": "/docs/15/app-pg-dumpall.html", "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": ["-E encoding", "--encoding= encoding"], "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": "-E encoding --encoding= encoding", "source_url": "/docs/15/app-pg-dumpall.html", "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": ["-f filename", "--file= filename"], "summary": "Send output to the specified file. If this is omitted, the standard output is used.", "signature": "-f filename --file= filename", "source_url": "/docs/15/app-pg-dumpall.html", "description": "Send output to the specified file. If this is omitted, the standard output is used."}, {"names": ["-g", "--globals-only"], "summary": "Dump only global objects (roles and tablespaces), no databases.", "signature": "-g --globals-only", "source_url": "/docs/15/app-pg-dumpall.html", "description": "Dump only global objects (roles and tablespaces), no databases."}, {"names": ["-O", "--no-owner"], "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": "-O --no-owner", "source_url": "/docs/15/app-pg-dumpall.html", "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": ["-r", "--roles-only"], "summary": "Dump only roles, no databases or tablespaces.", "signature": "-r --roles-only", "source_url": "/docs/15/app-pg-dumpall.html", "description": "Dump only roles, no databases or tablespaces."}, {"names": ["-s", "--schema-only"], "summary": "Dump only the object definitions (schema), not data.", "signature": "-s --schema-only", "source_url": "/docs/15/app-pg-dumpall.html", "description": "Dump only the object definitions (schema), not data."}, {"names": ["-S username", "--superuser= username"], "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": "-S username --superuser= username", "source_url": "/docs/15/app-pg-dumpall.html", "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": ["-t", "--tablespaces-only"], "summary": "Dump only tablespaces, no databases or roles.", "signature": "-t --tablespaces-only", "source_url": "/docs/15/app-pg-dumpall.html", "description": "Dump only tablespaces, no databases or roles."}, {"names": ["-v", "--verbose"], "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": "-v --verbose", "source_url": "/docs/15/app-pg-dumpall.html", "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", "--version"], "summary": "Print the pg_dumpall version and exit.", "signature": "-V --version", "source_url": "/docs/15/app-pg-dumpall.html", "description": "Print the pg_dumpall version and exit."}, {"names": ["-x", "--no-privileges", "--no-acl"], "summary": "Prevent dumping of access privileges (grant/revoke commands).", "signature": "-x --no-privileges --no-acl", "source_url": "/docs/15/app-pg-dumpall.html", "description": "Prevent dumping of access privileges (grant/revoke commands)."}, {"names": ["--binary-upgrade"], "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": "--binary-upgrade", "source_url": "/docs/15/app-pg-dumpall.html", "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": ["--column-inserts", "--attribute-inserts"], "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": "--column-inserts --attribute-inserts", "source_url": "/docs/15/app-pg-dumpall.html", "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": ["--disable-dollar-quoting"], "summary": "This option disables the use of dollar quoting for function bodies, and forces them to be quoted using SQL standard string syntax.", "signature": "--disable-dollar-quoting", "source_url": "/docs/15/app-pg-dumpall.html", "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-triggers"], "summary": "This option is relevant only when creating a data-only dump. 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": "--disable-triggers", "source_url": "/docs/15/app-pg-dumpall.html", "description": "This option is relevant only when creating a data-only dump. 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": ["--exclude-database= pattern"], "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 below), 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": "--exclude-database= pattern", "source_url": "/docs/15/app-pg-dumpall.html", "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 below), 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": ["--extra-float-digits= ndigits"], "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": "--extra-float-digits= ndigits", "source_url": "/docs/15/app-pg-dumpall.html", "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": ["--if-exists"], "summary": "Use DROP ... IF EXISTS commands to drop objects in --clean mode. This suppresses \u201c does not exist \u201d errors that might otherwise be reported. This option is not valid unless --clean is also specified.", "signature": "--if-exists", "source_url": "/docs/15/app-pg-dumpall.html", "description": "Use DROP ... IF EXISTS commands to drop objects in --clean mode. This suppresses \u201c does not exist \u201d errors that might otherwise be reported. This option is not valid unless --clean is also specified."}, {"names": ["--inserts"], "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": "--inserts", "source_url": "/docs/15/app-pg-dumpall.html", "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": ["--load-via-partition-root"], "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": "--load-via-partition-root", "source_url": "/docs/15/app-pg-dumpall.html", "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": ["--lock-wait-timeout= timeout"], "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": "--lock-wait-timeout= timeout", "source_url": "/docs/15/app-pg-dumpall.html", "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": ["--no-comments"], "summary": "Do not dump comments.", "signature": "--no-comments", "source_url": "/docs/15/app-pg-dumpall.html", "description": "Do not dump comments."}, {"names": ["--no-publications"], "summary": "Do not dump publications.", "signature": "--no-publications", "source_url": "/docs/15/app-pg-dumpall.html", "description": "Do not dump publications."}, {"names": ["--no-role-passwords"], "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": "--no-role-passwords", "source_url": "/docs/15/app-pg-dumpall.html", "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-security-labels"], "summary": "Do not dump security labels.", "signature": "--no-security-labels", "source_url": "/docs/15/app-pg-dumpall.html", "description": "Do not dump security labels."}, {"names": ["--no-subscriptions"], "summary": "Do not dump subscriptions.", "signature": "--no-subscriptions", "source_url": "/docs/15/app-pg-dumpall.html", "description": "Do not dump subscriptions."}, {"names": ["--no-sync"], "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": "--no-sync", "source_url": "/docs/15/app-pg-dumpall.html", "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-table-access-method"], "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": "--no-table-access-method", "source_url": "/docs/15/app-pg-dumpall.html", "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-tablespaces"], "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": "--no-tablespaces", "source_url": "/docs/15/app-pg-dumpall.html", "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-toast-compression"], "summary": "Do not output commands to set TOAST compression methods. With this option, all columns will be restored with the default compression setting.", "signature": "--no-toast-compression", "source_url": "/docs/15/app-pg-dumpall.html", "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-unlogged-table-data"], "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": "--no-unlogged-table-data", "source_url": "/docs/15/app-pg-dumpall.html", "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": ["--on-conflict-do-nothing"], "summary": "Add ON CONFLICT DO NOTHING to INSERT commands. This option is not valid unless --inserts or --column-inserts is also specified.", "signature": "--on-conflict-do-nothing", "source_url": "/docs/15/app-pg-dumpall.html", "description": "Add ON CONFLICT DO NOTHING to INSERT commands. This option is not valid unless --inserts or --column-inserts is also specified."}, {"names": ["--quote-all-identifiers"], "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": "--quote-all-identifiers", "source_url": "/docs/15/app-pg-dumpall.html", "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": ["--restrict-key= restrict_key"], "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": "--restrict-key= restrict_key", "source_url": "/docs/15/app-pg-dumpall.html", "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": ["--rows-per-insert= nrows"], "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": "--rows-per-insert= nrows", "source_url": "/docs/15/app-pg-dumpall.html", "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": ["--use-set-session-authorization"], "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": "--use-set-session-authorization", "source_url": "/docs/15/app-pg-dumpall.html", "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": ["-?", "--help"], "summary": "Show help about pg_dumpall command line arguments, and exit.", "signature": "-? --help", "source_url": "/docs/15/app-pg-dumpall.html", "description": "Show help about pg_dumpall command line arguments, and exit."}, {"names": ["-d connstr", "--dbname= connstr"], "summary": "Specifies parameters used to connect to the server, as a connection string ; these will override any conflicting command line options.", "signature": "-d connstr --dbname= connstr", "source_url": "/docs/15/app-pg-dumpall.html", "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": ["-h host", "--host= host"], "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": "-h host --host= host", "source_url": "/docs/15/app-pg-dumpall.html", "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": ["-l dbname", "--database= dbname"], "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": "-l dbname --database= dbname", "source_url": "/docs/15/app-pg-dumpall.html", "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": ["-p port", "--port= port"], "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": "-p port --port= port", "source_url": "/docs/15/app-pg-dumpall.html", "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": ["-U username", "--username= username"], "summary": "User name to connect as.", "signature": "-U username --username= username", "source_url": "/docs/15/app-pg-dumpall.html", "description": "User name to connect as."}, {"names": ["-w", "--no-password"], "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": "-w --no-password", "source_url": "/docs/15/app-pg-dumpall.html", "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", "--password"], "summary": "Force pg_dumpall to prompt for a password before connecting to a database.", "signature": "-W --password", "source_url": "/docs/15/app-pg-dumpall.html", "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": ["--role= rolename"], "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.", "signature": "--role= rolename", "source_url": "/docs/15/app-pg-dumpall.html", "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."}], "related": [{"url": "/wiki/conn/?v=15", "label": "libpq connection parameters"}], "release": {"ref": "https://ftp.postgresql.org/pub/source/v15.19/postgresql-15.19.tar.bz2", "label": "15.19", "major": "15", "channel": "stable", "manifest": {"pdf": {"A4": {"url": "/files/documentation/pdf/15/postgresql-15-A4.pdf", "bytes": 14609140, "pages": 2987, "sha256": "66228564a4d16efb47d6a914085716ecfe22ca1566db56bc7c3d82f790646d72", "built_at": "2026-09-26"}, "US": {"url": "/files/documentation/pdf/15/postgresql-15-US.pdf", "bytes": 14495690, "pages": 3153, "sha256": "645a498c2390d47a6223ec74770631185807a19c484edb0fc5a295d9f460bc02", "built_at": "2026-09-26"}}, "tree": "15", "index": "index.html", "major": "15", "pages": 1168, "release": "15.19", "source_url": "https://ftp.postgresql.org/pub/source/v15.19/postgresql-15.19.tar.bz2", "svg_assets": 3, "source_mode": "en HTML verified against the pinned official archive", "source_sha256": "e1a64a87a46b825b88c082e4518161a47aab53c45694964f8ba1df28f7859f89"}, "revision": "6af958c6520151fc7697d56e0616b03fb00522c4568158674d452ae0644ba545", "evidence_kind": "English manual and source declarations", "source_sha256": "e1a64a87a46b825b88c082e4518161a47aab53c45694964f8ba1df28f7859f89"}, "sources": [{"url": "/docs/15/app-pg-dumpall.html", "file": "app-pg-dumpall.html", "label": "15.19 English manual \u00b7 app-pg-dumpall.html", "anchor": "", "sha256": "60cbac2bd4a1dedac467898a5ec8828e42c66de8a9087761230f041090d69713"}, {"url": "/docs/15/reference-client.html", "file": "reference-client.html", "label": "Client applications inventory", "anchor": "", "sha256": "015b2ea2bd205946a55a1b837e735570631bac831c92074a6bf58444f9a3cb98"}], "sections": [], "synopsis": ["pg_dumpall [ connection-option ...] [ option ...]"], "signature": "pg_dumpall [ connection-option ...] [ option ...]", "description": ["pg_dumpall \u2014 extract a PostgreSQL database cluster into a script file"], "environment": [{"name": "PGHOST PGOPTIONS PGPORT PGUSER", "description": "Default connection parameters"}, {"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}], "manual_html": "<div><div class=\"refentry\" id=\"APP-PG-DUMPALL\">\n<div class=\"titlepage\"></div>\n<div class=\"refnamediv\">\n<h2><span class=\"refentrytitle\"><span class=\"application\">pg_dumpall</span></span></h2>\n<p>pg_dumpall \u2014 extract a <span class=\"productname\">PostgreSQL</span> database cluster into a script file</p>\n</div>\n<div class=\"refsynopsisdiv\">\n<h2>Synopsis</h2>\n<div class=\"cmdsynopsis\">\n<p id=\"id-1.9.4.14.4.1\"><code class=\"command\">pg_dumpall</code> [<em class=\"replaceable\"><code>connection-option</code></em>...] [<em class=\"replaceable\"><code>option</code></em>...]</p>\n</div>\n</div>\n<div class=\"refsect1\" id=\"APP-PG-DUMPALL-DESCRIPTION\">\n<h2>Description</h2>\n<p><span class=\"application\">pg_dumpall</span> is a utility for writing out (<span class=\"quote\">\u201c<span class=\"quote\">dumping</span>\u201d</span>) all <span class=\"productname\">PostgreSQL</span> databases of a cluster into one script file. The script file contains SQL commands that can be used as input to <a class=\"xref\" href=\"/docs/15/app-psql.html\" title=\"psql\"><span class=\"refentrytitle\"><span class=\"application\">psql</span></span></a> to restore the databases. It does this by calling <a class=\"xref\" href=\"/docs/15/app-pgdump.html\" title=\"pg_dump\"><span class=\"refentrytitle\"><span class=\"application\">pg_dump</span></span></a> for each database in the cluster. <span class=\"application\">pg_dumpall</span> also dumps global objects that are common to all databases, namely database roles, tablespaces, and privilege grants for configuration parameters. (<span class=\"application\">pg_dump</span> does not save these objects.)</p>\n<p>Since <span class=\"application\">pg_dumpall</span> 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.</p>\n<p>The SQL script will be written to the standard output. Use the <code class=\"option\">-f</code>/<code class=\"option\">--file</code> option or shell operators to redirect it into a file.</p>\n<p><span class=\"application\">pg_dumpall</span> needs to connect several times to the <span class=\"productname\">PostgreSQL</span> server (once per database). If you use password authentication it will ask for a password each time. It is convenient to have a <code class=\"filename\">~/.pgpass</code> file in such cases. See <a class=\"xref\" href=\"/docs/15/libpq-pgpass.html\" title=\"34.16.\u00a0The Password File\">Section\u00a034.16</a> for more information.</p>\n<div class=\"warning\">\n<h3 class=\"title\">Warning</h3>\n<p>Restoring 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.</p>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.14.6\">\n<h2>Options</h2>\n<p>The following command-line options control the content and format of the output.</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-a</code><br></span><span class=\"term\"><code class=\"option\">--data-only</code></span></dt>\n<dd>\n<p>Dump only the data, not the schema (data definitions).</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-c</code><br></span><span class=\"term\"><code class=\"option\">--clean</code></span></dt>\n<dd>\n<p>Emit SQL commands to <code class=\"command\">DROP</code> 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 <code class=\"option\">--if-exists</code> is also specified.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-E <em class=\"replaceable\"><code>encoding</code></em></code><br></span><span class=\"term\"><code class=\"option\">--encoding=<em class=\"replaceable\"><code>encoding</code></em></code></span></dt>\n<dd>\n<p>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 <code class=\"envar\">PGCLIENTENCODING</code> environment variable to the desired dump encoding.)</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-f <em class=\"replaceable\"><code>filename</code></em></code><br></span><span class=\"term\"><code class=\"option\">--file=<em class=\"replaceable\"><code>filename</code></em></code></span></dt>\n<dd>\n<p>Send output to the specified file. If this is omitted, the standard output is used.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-g</code><br></span><span class=\"term\"><code class=\"option\">--globals-only</code></span></dt>\n<dd>\n<p>Dump only global objects (roles and tablespaces), no databases.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-O</code><br></span><span class=\"term\"><code class=\"option\">--no-owner</code></span></dt>\n<dd>\n<p>Do not output commands to set ownership of objects to match the original database. By default, <span class=\"application\">pg_dumpall</span> issues <code class=\"command\">ALTER OWNER</code> or <code class=\"command\">SET SESSION AUTHORIZATION</code> 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 <code class=\"option\">-O</code>.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-r</code><br></span><span class=\"term\"><code class=\"option\">--roles-only</code></span></dt>\n<dd>\n<p>Dump only roles, no databases or tablespaces.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-s</code><br></span><span class=\"term\"><code class=\"option\">--schema-only</code></span></dt>\n<dd>\n<p>Dump only the object definitions (schema), not data.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-S <em class=\"replaceable\"><code>username</code></em></code><br></span><span class=\"term\"><code class=\"option\">--superuser=<em class=\"replaceable\"><code>username</code></em></code></span></dt>\n<dd>\n<p>Specify the superuser user name to use when disabling triggers. This is relevant only if <code class=\"option\">--disable-triggers</code> is used. (Usually, it's better to leave this out, and instead start the resulting script as superuser.)</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-t</code><br></span><span class=\"term\"><code class=\"option\">--tablespaces-only</code></span></dt>\n<dd>\n<p>Dump only tablespaces, no databases or roles.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-v</code><br></span><span class=\"term\"><code class=\"option\">--verbose</code></span></dt>\n<dd>\n<p>Specifies verbose mode. This will cause <span class=\"application\">pg_dumpall</span> 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 <span class=\"application\">pg_dump</span>.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-V</code><br></span><span class=\"term\"><code class=\"option\">--version</code></span></dt>\n<dd>\n<p>Print the <span class=\"application\">pg_dumpall</span> version and exit.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-x</code><br></span><span class=\"term\"><code class=\"option\">--no-privileges</code><br></span><span class=\"term\"><code class=\"option\">--no-acl</code></span></dt>\n<dd>\n<p>Prevent dumping of access privileges (grant/revoke commands).</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--binary-upgrade</code></span></dt>\n<dd>\n<p>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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--column-inserts</code><br></span><span class=\"term\"><code class=\"option\">--attribute-inserts</code></span></dt>\n<dd>\n<p>Dump data as <code class=\"command\">INSERT</code> commands with explicit column names (<code class=\"literal\">INSERT INTO <em class=\"replaceable\"><code>table</code></em> (<em class=\"replaceable\"><code>column</code></em>, ...) VALUES ...</code>). This will make restoration very slow; it is mainly useful for making dumps that can be loaded into non-<span class=\"productname\">PostgreSQL</span> databases.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--disable-dollar-quoting</code></span></dt>\n<dd>\n<p>This option disables the use of dollar quoting for function bodies, and forces them to be quoted using SQL standard string syntax.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--disable-triggers</code></span></dt>\n<dd>\n<p>This option is relevant only when creating a data-only dump. It instructs <span class=\"application\">pg_dumpall</span> 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.</p>\n<p>Presently, the commands emitted for <code class=\"option\">--disable-triggers</code> must be done as superuser. So, you should also specify a superuser name with <code class=\"option\">-S</code>, or preferably be careful to start the resulting script as a superuser.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--exclude-database=<em class=\"replaceable\"><code>pattern</code></em></code></span></dt>\n<dd>\n<p>Do not dump databases whose name matches <em class=\"replaceable\"><code>pattern</code></em>. Multiple patterns can be excluded by writing multiple <code class=\"option\">--exclude-database</code> switches. The <em class=\"replaceable\"><code>pattern</code></em> parameter is interpreted as a pattern according to the same rules used by <span class=\"application\">psql</span>'s <code class=\"literal\">\\d</code> commands (see <a class=\"xref\" href=\"/docs/15/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\">Patterns</a> below), 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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--extra-float-digits=<em class=\"replaceable\"><code>ndigits</code></em></code></span></dt>\n<dd>\n<p>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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--if-exists</code></span></dt>\n<dd>\n<p>Use <code class=\"literal\">DROP ... IF EXISTS</code> commands to drop objects in <code class=\"option\">--clean</code> mode. This suppresses <span class=\"quote\">\u201c<span class=\"quote\">does not exist</span>\u201d</span> errors that might otherwise be reported. This option is not valid unless <code class=\"option\">--clean</code> is also specified.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--inserts</code></span></dt>\n<dd>\n<p>Dump data as <code class=\"command\">INSERT</code> commands (rather than <code class=\"command\">COPY</code>). This will make restoration very slow; it is mainly useful for making dumps that can be loaded into non-<span class=\"productname\">PostgreSQL</span> databases. Note that the restore might fail altogether if you have rearranged column order. The <code class=\"option\">--column-inserts</code> option is safer, though even slower.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--load-via-partition-root</code></span></dt>\n<dd>\n<p>When dumping data for a table partition, make the <code class=\"command\">COPY</code> or <code class=\"command\">INSERT</code> 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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--lock-wait-timeout=<em class=\"replaceable\"><code>timeout</code></em></code></span></dt>\n<dd>\n<p>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 <em class=\"replaceable\"><code>timeout</code></em>. The timeout may be specified in any of the formats accepted by <code class=\"command\">SET statement_timeout</code>.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-comments</code></span></dt>\n<dd>\n<p>Do not dump comments.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-publications</code></span></dt>\n<dd>\n<p>Do not dump publications.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-role-passwords</code></span></dt>\n<dd>\n<p>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 <code class=\"structname\">pg_roles</code> instead of <code class=\"structname\">pg_authid</code>. Therefore, this option also helps if access to <code class=\"structname\">pg_authid</code> is restricted by some security policy.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-security-labels</code></span></dt>\n<dd>\n<p>Do not dump security labels.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-subscriptions</code></span></dt>\n<dd>\n<p>Do not dump subscriptions.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-sync</code></span></dt>\n<dd>\n<p>By default, <code class=\"command\">pg_dumpall</code> will wait for all files to be written safely to disk. This option causes <code class=\"command\">pg_dumpall</code> 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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-table-access-method</code></span></dt>\n<dd>\n<p>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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-tablespaces</code></span></dt>\n<dd>\n<p>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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-toast-compression</code></span></dt>\n<dd>\n<p>Do not output commands to set TOAST compression methods. With this option, all columns will be restored with the default compression setting.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-unlogged-table-data</code></span></dt>\n<dd>\n<p>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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--on-conflict-do-nothing</code></span></dt>\n<dd>\n<p>Add <code class=\"literal\">ON CONFLICT DO NOTHING</code> to <code class=\"command\">INSERT</code> commands. This option is not valid unless <code class=\"option\">--inserts</code> or <code class=\"option\">--column-inserts</code> is also specified.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--quote-all-identifiers</code></span></dt>\n<dd>\n<p>Force quoting of all identifiers. This option is recommended when dumping a database from a server whose <span class=\"productname\">PostgreSQL</span> major version is different from <span class=\"application\">pg_dumpall</span>'s, or when the output is intended to be loaded into a server of a different major version. By default, <span class=\"application\">pg_dumpall</span> 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 <code class=\"option\">--quote-all-identifiers</code> prevents such issues, at the price of a harder-to-read dump script.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--restrict-key=<em class=\"replaceable\"><code>restrict_key</code></em></code></span></dt>\n<dd>\n<p>Use the provided string as the <span class=\"application\">psql</span> <code class=\"command\">\\restrict</code> key in the dump output. If no restrict key is specified, <span class=\"application\">pg_dumpall</span> will generate a random one as needed. Keys may contain only alphanumeric characters.</p>\n<p>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 <span class=\"application\">psql</span> with the dump output.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--rows-per-insert=<em class=\"replaceable\"><code>nrows</code></em></code></span></dt>\n<dd>\n<p>Dump data as <code class=\"command\">INSERT</code> commands (rather than <code class=\"command\">COPY</code>). Controls the maximum number of rows per <code class=\"command\">INSERT</code> 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 <code class=\"command\">INSERT</code> to be lost, rather than the entire table contents.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--use-set-session-authorization</code></span></dt>\n<dd>\n<p>Output SQL-standard <code class=\"command\">SET SESSION AUTHORIZATION</code> commands instead of <code class=\"command\">ALTER OWNER</code> 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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-?</code><br></span><span class=\"term\"><code class=\"option\">--help</code></span></dt>\n<dd>\n<p>Show help about <span class=\"application\">pg_dumpall</span> command line arguments, and exit.</p>\n</dd>\n</dl>\n</div>\n<p>The following command-line options control the database connection parameters.</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-d <em class=\"replaceable\"><code>connstr</code></em></code><br></span><span class=\"term\"><code class=\"option\">--dbname=<em class=\"replaceable\"><code>connstr</code></em></code></span></dt>\n<dd>\n<p>Specifies parameters used to connect to the server, as a <a class=\"link\" href=\"/docs/15/libpq-connect.html#LIBPQ-CONNSTRING\" title=\"34.1.1.\u00a0Connection Strings\">connection string</a>; these will override any conflicting command line options.</p>\n<p>The option is called <code class=\"literal\">--dbname</code> for consistency with other client applications, but because <span class=\"application\">pg_dumpall</span> needs to connect to many databases, the database name in the connection string will be ignored. Use the <code class=\"literal\">-l</code> 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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-h <em class=\"replaceable\"><code>host</code></em></code><br></span><span class=\"term\"><code class=\"option\">--host=<em class=\"replaceable\"><code>host</code></em></code></span></dt>\n<dd>\n<p>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 <code class=\"envar\">PGHOST</code> environment variable, if set, else a Unix domain socket connection is attempted.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-l <em class=\"replaceable\"><code>dbname</code></em></code><br></span><span class=\"term\"><code class=\"option\">--database=<em class=\"replaceable\"><code>dbname</code></em></code></span></dt>\n<dd>\n<p>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 <code class=\"literal\">postgres</code> database will be used, and if that does not exist, <code class=\"literal\">template1</code> will be used.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-p <em class=\"replaceable\"><code>port</code></em></code><br></span><span class=\"term\"><code class=\"option\">--port=<em class=\"replaceable\"><code>port</code></em></code></span></dt>\n<dd>\n<p>Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the <code class=\"envar\">PGPORT</code> environment variable, if set, or a compiled-in default.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-U <em class=\"replaceable\"><code>username</code></em></code><br></span><span class=\"term\"><code class=\"option\">--username=<em class=\"replaceable\"><code>username</code></em></code></span></dt>\n<dd>\n<p>User name to connect as.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-w</code><br></span><span class=\"term\"><code class=\"option\">--no-password</code></span></dt>\n<dd>\n<p>Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a <code class=\"filename\">.pgpass</code> 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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-W</code><br></span><span class=\"term\"><code class=\"option\">--password</code></span></dt>\n<dd>\n<p>Force <span class=\"application\">pg_dumpall</span> to prompt for a password before connecting to a database.</p>\n<p>This option is never essential, since <span class=\"application\">pg_dumpall</span> will automatically prompt for a password if the server demands password authentication. However, <span class=\"application\">pg_dumpall</span> will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing <code class=\"option\">-W</code> to avoid the extra connection attempt.</p>\n<p>Note that the password prompt will occur again for each database to be dumped. Usually, it's better to set up a <code class=\"filename\">~/.pgpass</code> file than to rely on manual password entry.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--role=<em class=\"replaceable\"><code>rolename</code></em></code></span></dt>\n<dd>\n<p>Specifies a role name to be used to create the dump. This option causes <span class=\"application\">pg_dumpall</span> to issue a <code class=\"command\">SET ROLE</code> <em class=\"replaceable\"><code>rolename</code></em> command after connecting to the database. It is useful when the authenticated user (specified by <code class=\"option\">-U</code>) lacks privileges needed by <span class=\"application\">pg_dumpall</span>, 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.</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.14.7\">\n<h2>Environment</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"envar\">PGHOST</code><br></span><span class=\"term\"><code class=\"envar\">PGOPTIONS</code><br></span><span class=\"term\"><code class=\"envar\">PGPORT</code><br></span><span class=\"term\"><code class=\"envar\">PGUSER</code></span></dt>\n<dd>\n<p>Default connection parameters</p>\n</dd>\n<dt><span class=\"term\"><code class=\"envar\">PG_COLOR</code></span></dt>\n<dd>\n<p>Specifies whether to use color in diagnostic messages. Possible values are <code class=\"literal\">always</code>, <code class=\"literal\">auto</code> and <code class=\"literal\">never</code>.</p>\n</dd>\n</dl>\n</div>\n<p>This utility, like most other <span class=\"productname\">PostgreSQL</span> utilities, also uses the environment variables supported by <span class=\"application\">libpq</span> (see <a class=\"xref\" href=\"/docs/15/libpq-envars.html\" title=\"34.15.\u00a0Environment Variables\">Section\u00a034.15</a>).</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.14.8\">\n<h2>Notes</h2>\n<p>Since <span class=\"application\">pg_dumpall</span> calls <span class=\"application\">pg_dump</span> internally, some diagnostic messages will refer to <span class=\"application\">pg_dump</span>.</p>\n<p>The <code class=\"option\">--clean</code> option can be useful even when your intention is to restore the dump script into a fresh cluster. Use of <code class=\"option\">--clean</code> authorizes the script to drop and re-create the built-in <code class=\"literal\">postgres</code> and <code class=\"literal\">template1</code> 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.</p>\n<p>Once restored, it is wise to run <code class=\"command\">ANALYZE</code> on each database so the optimizer has useful statistics. You can also run <code class=\"command\">vacuumdb -a -z</code> to analyze all databases.</p>\n<p>The dump script should not be expected to run completely without errors. In particular, because the script will issue <code class=\"command\">CREATE ROLE</code> for every role existing in the source cluster, it is certain to get a <span class=\"quote\">\u201c<span class=\"quote\">role already exists</span>\u201d</span> 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 <code class=\"option\">--clean</code> option is likely to produce additional harmless error messages about non-existent objects, although you can minimize those by adding <code class=\"option\">--if-exists</code>.</p>\n<p><span class=\"application\">pg_dumpall</span> requires all needed tablespace directories to exist before the restore; otherwise, database creation will fail for databases in non-default locations.</p>\n<p>It is generally recommended to use the <code class=\"option\">-X</code> (<code class=\"option\">--no-psqlrc</code>) option when restoring a database from a <span class=\"application\">pg_dumpall</span> script to ensure a clean restore process and prevent potential conflicts with non-default <span class=\"application\">psql</span> configurations. Additionally, because the <span class=\"application\">pg_dumpall</span> script may include <span class=\"application\">psql</span> meta-commands, it may be incompatible with clients other than <span class=\"application\">psql</span>.</p>\n</div>\n<div class=\"refsect1\" id=\"APP-PG-DUMPALL-EX\">\n<h2>Examples</h2>\n<p>To dump all databases:</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_dumpall &gt; db.out</code></strong>\n</pre>\n<p>To restore database(s) from this file, you can use:</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>psql -X -f db.out -d postgres</code></strong>\n</pre>\n<p>It is not important which database you connect to here since the script file created by <span class=\"application\">pg_dumpall</span> will contain the appropriate commands to create and connect to the saved databases. An exception is that if you specified <code class=\"option\">--clean</code>, you must connect to the <code class=\"literal\">postgres</code> database initially; the script will attempt to drop other databases immediately, and that will fail for the database you are connected to.</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.14.10\">\n<h2>See Also</h2>\n<p>Check <a class=\"xref\" href=\"/docs/15/app-pgdump.html\" title=\"pg_dump\"><span class=\"refentrytitle\"><span class=\"application\">pg_dump</span></span></a> for details on possible error conditions.</p>\n</div>\n</div></div>", "manual_path": "app-pg-dumpall.html", "comparison_data": {"options": [{"names": ["-a", "--data-only"], "signature": "-a --data-only", "description": "Dump only the data, not the schema (data definitions)."}, {"names": ["-c", "--clean"], "signature": "-c --clean", "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": ["-E encoding", "--encoding= encoding"], "signature": "-E encoding --encoding= encoding", "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": ["-f filename", "--file= filename"], "signature": "-f filename --file= filename", "description": "Send output to the specified file. If this is omitted, the standard output is used."}, {"names": ["-g", "--globals-only"], "signature": "-g --globals-only", "description": "Dump only global objects (roles and tablespaces), no databases."}, {"names": ["-O", "--no-owner"], "signature": "-O --no-owner", "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": ["-r", "--roles-only"], "signature": "-r --roles-only", "description": "Dump only roles, no databases or tablespaces."}, {"names": ["-s", "--schema-only"], "signature": "-s --schema-only", "description": "Dump only the object definitions (schema), not data."}, {"names": ["-S username", "--superuser= username"], "signature": "-S username --superuser= username", "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": ["-t", "--tablespaces-only"], "signature": "-t --tablespaces-only", "description": "Dump only tablespaces, no databases or roles."}, {"names": ["-v", "--verbose"], "signature": "-v --verbose", "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", "--version"], "signature": "-V --version", "description": "Print the pg_dumpall version and exit."}, {"names": ["-x", "--no-privileges", "--no-acl"], "signature": "-x --no-privileges --no-acl", "description": "Prevent dumping of access privileges (grant/revoke commands)."}, {"names": ["--binary-upgrade"], "signature": "--binary-upgrade", "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": ["--column-inserts", "--attribute-inserts"], "signature": "--column-inserts --attribute-inserts", "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": ["--disable-dollar-quoting"], "signature": "--disable-dollar-quoting", "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-triggers"], "signature": "--disable-triggers", "description": "This option is relevant only when creating a data-only dump. 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": ["--exclude-database= pattern"], "signature": "--exclude-database= pattern", "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 below), 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": ["--extra-float-digits= ndigits"], "signature": "--extra-float-digits= ndigits", "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": ["--if-exists"], "signature": "--if-exists", "description": "Use DROP ... IF EXISTS commands to drop objects in --clean mode. This suppresses \u201c does not exist \u201d errors that might otherwise be reported. This option is not valid unless --clean is also specified."}, {"names": ["--inserts"], "signature": "--inserts", "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": ["--load-via-partition-root"], "signature": "--load-via-partition-root", "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": ["--lock-wait-timeout= timeout"], "signature": "--lock-wait-timeout= timeout", "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": ["--no-comments"], "signature": "--no-comments", "description": "Do not dump comments."}, {"names": ["--no-publications"], "signature": "--no-publications", "description": "Do not dump publications."}, {"names": ["--no-role-passwords"], "signature": "--no-role-passwords", "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-security-labels"], "signature": "--no-security-labels", "description": "Do not dump security labels."}, {"names": ["--no-subscriptions"], "signature": "--no-subscriptions", "description": "Do not dump subscriptions."}, {"names": ["--no-sync"], "signature": "--no-sync", "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-table-access-method"], "signature": "--no-table-access-method", "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-tablespaces"], "signature": "--no-tablespaces", "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-toast-compression"], "signature": "--no-toast-compression", "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-unlogged-table-data"], "signature": "--no-unlogged-table-data", "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": ["--on-conflict-do-nothing"], "signature": "--on-conflict-do-nothing", "description": "Add ON CONFLICT DO NOTHING to INSERT commands. This option is not valid unless --inserts or --column-inserts is also specified."}, {"names": ["--quote-all-identifiers"], "signature": "--quote-all-identifiers", "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": ["--restrict-key= restrict_key"], "signature": "--restrict-key= restrict_key", "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": ["--rows-per-insert= nrows"], "signature": "--rows-per-insert= nrows", "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": ["--use-set-session-authorization"], "signature": "--use-set-session-authorization", "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": ["-?", "--help"], "signature": "-? --help", "description": "Show help about pg_dumpall command line arguments, and exit."}, {"names": ["-d connstr", "--dbname= connstr"], "signature": "-d connstr --dbname= connstr", "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": ["-h host", "--host= host"], "signature": "-h host --host= host", "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": ["-l dbname", "--database= dbname"], "signature": "-l dbname --database= dbname", "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": ["-p port", "--port= port"], "signature": "-p port --port= port", "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": ["-U username", "--username= username"], "signature": "-U username --username= username", "description": "User name to connect as."}, {"names": ["-w", "--no-password"], "signature": "-w --no-password", "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", "--password"], "signature": "-W --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": ["--role= rolename"], "signature": "--role= rolename", "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."}], "synopsis": ["pg_dumpall [ connection-option ...] [ option ...]"], "environment": [{"name": "PGHOST PGOPTIONS PGPORT PGUSER", "description": "Default connection parameters"}, {"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}]}, "comparison_hash": "42d1bd35e7f72b0aaec50129e9e2047d1ab2c695a0bb45eb7cd6d12c7a894cfc"}, "16": {"facts": [{"label": "Documented executable", "value": "pg_dumpall"}, {"label": "Executable version", "value": "16.15"}, {"label": "Reference inventory", "value": "Client applications"}, {"label": "Option definition groups", "value": "47"}], "tables": [{"key": "options", "rows": [{"summary": "Dump only the data, not the schema (data definitions).", "signature": {"url": "/docs/16/app-pg-dumpall.html", "text": "-a --data-only"}}, {"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": {"url": "/docs/16/app-pg-dumpall.html", "text": "-c --clean"}}, {"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": {"url": "/docs/16/app-pg-dumpall.html", "text": "-E encoding --encoding= encoding"}}, {"summary": "Send output to the specified file. If this is omitted, the standard output is used.", "signature": {"url": "/docs/16/app-pg-dumpall.html", "text": "-f filename --file= filename"}}, {"summary": "Dump only global objects (roles and tablespaces), no databases.", "signature": {"url": "/docs/16/app-pg-dumpall.html", "text": "-g --globals-only"}}, {"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": {"url": "/docs/16/app-pg-dumpall.html", "text": "-O --no-owner"}}, {"summary": "Dump only roles, no databases or tablespaces.", "signature": {"url": "/docs/16/app-pg-dumpall.html", "text": "-r --roles-only"}}, {"summary": "Dump only the object definitions (schema), not data.", "signature": {"url": "/docs/16/app-pg-dumpall.html", "text": "-s --schema-only"}}, {"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": {"url": "/docs/16/app-pg-dumpall.html", "text": "-S username --superuser= username"}}, {"summary": "Dump only tablespaces, no databases or roles.", "signature": {"url": "/docs/16/app-pg-dumpall.html", "text": "-t --tablespaces-only"}}, {"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": {"url": "/docs/16/app-pg-dumpall.html", "text": "-v --verbose"}}, {"summary": "Print the pg_dumpall version and exit.", "signature": {"url": "/docs/16/app-pg-dumpall.html", "text": "-V --version"}}, {"summary": "Prevent dumping of access privileges (grant/revoke commands).", "signature": {"url": "/docs/16/app-pg-dumpall.html", "text": "-x --no-privileges --no-acl"}}, {"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": {"url": "/docs/16/app-pg-dumpall.html", "text": "--binary-upgrade"}}, {"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": {"url": "/docs/16/app-pg-dumpall.html", "text": "--column-inserts --attribute-inserts"}}, {"summary": "This option disables the use of dollar quoting for function bodies, and forces them to be quoted using SQL standard string syntax.", "signature": {"url": "/docs/16/app-pg-dumpall.html", "text": "--disable-dollar-quoting"}}, {"summary": "This option is relevant only when creating a data-only dump. 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": {"url": "/docs/16/app-pg-dumpall.html", "text": "--disable-triggers"}}, {"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": {"url": "/docs/16/app-pg-dumpall.html", "text": "--exclude-database= pattern"}}, {"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": {"url": "/docs/16/app-pg-dumpall.html", "text": "--extra-float-digits= ndigits"}}, {"summary": "Use DROP ... IF EXISTS commands to drop objects in --clean mode. This suppresses \u201c does not exist \u201d errors that might otherwise be reported. This option is not valid unless --clean is also specified.", "signature": {"url": "/docs/16/app-pg-dumpall.html", "text": "--if-exists"}}, {"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": {"url": "/docs/16/app-pg-dumpall.html", "text": "--inserts"}}, {"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": {"url": "/docs/16/app-pg-dumpall.html", "text": "--load-via-partition-root"}}, {"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": {"url": "/docs/16/app-pg-dumpall.html", "text": "--lock-wait-timeout= timeout"}}, {"summary": "Do not dump comments.", "signature": {"url": "/docs/16/app-pg-dumpall.html", "text": "--no-comments"}}, {"summary": "Do not dump publications.", "signature": {"url": "/docs/16/app-pg-dumpall.html", "text": "--no-publications"}}, {"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": {"url": "/docs/16/app-pg-dumpall.html", "text": "--no-role-passwords"}}, {"summary": "Do not dump security labels.", "signature": {"url": "/docs/16/app-pg-dumpall.html", "text": "--no-security-labels"}}, {"summary": "Do not dump subscriptions.", "signature": {"url": "/docs/16/app-pg-dumpall.html", "text": "--no-subscriptions"}}, {"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": {"url": "/docs/16/app-pg-dumpall.html", "text": "--no-sync"}}, {"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": {"url": "/docs/16/app-pg-dumpall.html", "text": "--no-table-access-method"}}, {"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": {"url": "/docs/16/app-pg-dumpall.html", "text": "--no-tablespaces"}}, {"summary": "Do not output commands to set TOAST compression methods. With this option, all columns will be restored with the default compression setting.", "signature": {"url": "/docs/16/app-pg-dumpall.html", "text": "--no-toast-compression"}}, {"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": {"url": "/docs/16/app-pg-dumpall.html", "text": "--no-unlogged-table-data"}}, {"summary": "Add ON CONFLICT DO NOTHING to INSERT commands. This option is not valid unless --inserts or --column-inserts is also specified.", "signature": {"url": "/docs/16/app-pg-dumpall.html", "text": "--on-conflict-do-nothing"}}, {"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": {"url": "/docs/16/app-pg-dumpall.html", "text": "--quote-all-identifiers"}}, {"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": {"url": "/docs/16/app-pg-dumpall.html", "text": "--restrict-key= restrict_key"}}, {"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": {"url": "/docs/16/app-pg-dumpall.html", "text": "--rows-per-insert= nrows"}}, {"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": {"url": "/docs/16/app-pg-dumpall.html", "text": "--use-set-session-authorization"}}, {"summary": "Show help about pg_dumpall command line arguments, and exit.", "signature": {"url": "/docs/16/app-pg-dumpall.html", "text": "-? --help"}}, {"summary": "Specifies parameters used to connect to the server, as a connection string ; these will override any conflicting command line options.", "signature": {"url": "/docs/16/app-pg-dumpall.html", "text": "-d connstr --dbname= connstr"}}, {"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": {"url": "/docs/16/app-pg-dumpall.html", "text": "-h host --host= host"}}, {"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": {"url": "/docs/16/app-pg-dumpall.html", "text": "-l dbname --database= dbname"}}, {"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": {"url": "/docs/16/app-pg-dumpall.html", "text": "-p port --port= port"}}, {"summary": "User name to connect as.", "signature": {"url": "/docs/16/app-pg-dumpall.html", "text": "-U username --username= username"}}, {"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": {"url": "/docs/16/app-pg-dumpall.html", "text": "-w --no-password"}}, {"summary": "Force pg_dumpall to prompt for a password before connecting to a database.", "signature": {"url": "/docs/16/app-pg-dumpall.html", "text": "-W --password"}}, {"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.", "signature": {"url": "/docs/16/app-pg-dumpall.html", "text": "--role= rolename"}}], "title": "Documented options", "columns": [{"key": "signature", "label": "Option and arguments"}, {"key": "summary", "label": "Description"}]}, {"key": "environment", "rows": [{"name": "PGHOST PGOPTIONS PGPORT PGUSER", "description": "Default connection parameters"}, {"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}], "title": "Environment variables", "columns": [{"key": "name", "label": "Variable"}, {"key": "description", "label": "Meaning"}]}], "options": [{"names": ["-a", "--data-only"], "summary": "Dump only the data, not the schema (data definitions).", "signature": "-a --data-only", "source_url": "/docs/16/app-pg-dumpall.html", "description": "Dump only the data, not the schema (data definitions)."}, {"names": ["-c", "--clean"], "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": "-c --clean", "source_url": "/docs/16/app-pg-dumpall.html", "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": ["-E encoding", "--encoding= encoding"], "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": "-E encoding --encoding= encoding", "source_url": "/docs/16/app-pg-dumpall.html", "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": ["-f filename", "--file= filename"], "summary": "Send output to the specified file. If this is omitted, the standard output is used.", "signature": "-f filename --file= filename", "source_url": "/docs/16/app-pg-dumpall.html", "description": "Send output to the specified file. If this is omitted, the standard output is used."}, {"names": ["-g", "--globals-only"], "summary": "Dump only global objects (roles and tablespaces), no databases.", "signature": "-g --globals-only", "source_url": "/docs/16/app-pg-dumpall.html", "description": "Dump only global objects (roles and tablespaces), no databases."}, {"names": ["-O", "--no-owner"], "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": "-O --no-owner", "source_url": "/docs/16/app-pg-dumpall.html", "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": ["-r", "--roles-only"], "summary": "Dump only roles, no databases or tablespaces.", "signature": "-r --roles-only", "source_url": "/docs/16/app-pg-dumpall.html", "description": "Dump only roles, no databases or tablespaces."}, {"names": ["-s", "--schema-only"], "summary": "Dump only the object definitions (schema), not data.", "signature": "-s --schema-only", "source_url": "/docs/16/app-pg-dumpall.html", "description": "Dump only the object definitions (schema), not data."}, {"names": ["-S username", "--superuser= username"], "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": "-S username --superuser= username", "source_url": "/docs/16/app-pg-dumpall.html", "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": ["-t", "--tablespaces-only"], "summary": "Dump only tablespaces, no databases or roles.", "signature": "-t --tablespaces-only", "source_url": "/docs/16/app-pg-dumpall.html", "description": "Dump only tablespaces, no databases or roles."}, {"names": ["-v", "--verbose"], "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": "-v --verbose", "source_url": "/docs/16/app-pg-dumpall.html", "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", "--version"], "summary": "Print the pg_dumpall version and exit.", "signature": "-V --version", "source_url": "/docs/16/app-pg-dumpall.html", "description": "Print the pg_dumpall version and exit."}, {"names": ["-x", "--no-privileges", "--no-acl"], "summary": "Prevent dumping of access privileges (grant/revoke commands).", "signature": "-x --no-privileges --no-acl", "source_url": "/docs/16/app-pg-dumpall.html", "description": "Prevent dumping of access privileges (grant/revoke commands)."}, {"names": ["--binary-upgrade"], "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": "--binary-upgrade", "source_url": "/docs/16/app-pg-dumpall.html", "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": ["--column-inserts", "--attribute-inserts"], "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": "--column-inserts --attribute-inserts", "source_url": "/docs/16/app-pg-dumpall.html", "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": ["--disable-dollar-quoting"], "summary": "This option disables the use of dollar quoting for function bodies, and forces them to be quoted using SQL standard string syntax.", "signature": "--disable-dollar-quoting", "source_url": "/docs/16/app-pg-dumpall.html", "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-triggers"], "summary": "This option is relevant only when creating a data-only dump. 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": "--disable-triggers", "source_url": "/docs/16/app-pg-dumpall.html", "description": "This option is relevant only when creating a data-only dump. 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": ["--exclude-database= pattern"], "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": "--exclude-database= pattern", "source_url": "/docs/16/app-pg-dumpall.html", "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": ["--extra-float-digits= ndigits"], "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": "--extra-float-digits= ndigits", "source_url": "/docs/16/app-pg-dumpall.html", "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": ["--if-exists"], "summary": "Use DROP ... IF EXISTS commands to drop objects in --clean mode. This suppresses \u201c does not exist \u201d errors that might otherwise be reported. This option is not valid unless --clean is also specified.", "signature": "--if-exists", "source_url": "/docs/16/app-pg-dumpall.html", "description": "Use DROP ... IF EXISTS commands to drop objects in --clean mode. This suppresses \u201c does not exist \u201d errors that might otherwise be reported. This option is not valid unless --clean is also specified."}, {"names": ["--inserts"], "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": "--inserts", "source_url": "/docs/16/app-pg-dumpall.html", "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": ["--load-via-partition-root"], "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": "--load-via-partition-root", "source_url": "/docs/16/app-pg-dumpall.html", "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": ["--lock-wait-timeout= timeout"], "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": "--lock-wait-timeout= timeout", "source_url": "/docs/16/app-pg-dumpall.html", "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": ["--no-comments"], "summary": "Do not dump comments.", "signature": "--no-comments", "source_url": "/docs/16/app-pg-dumpall.html", "description": "Do not dump comments."}, {"names": ["--no-publications"], "summary": "Do not dump publications.", "signature": "--no-publications", "source_url": "/docs/16/app-pg-dumpall.html", "description": "Do not dump publications."}, {"names": ["--no-role-passwords"], "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": "--no-role-passwords", "source_url": "/docs/16/app-pg-dumpall.html", "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-security-labels"], "summary": "Do not dump security labels.", "signature": "--no-security-labels", "source_url": "/docs/16/app-pg-dumpall.html", "description": "Do not dump security labels."}, {"names": ["--no-subscriptions"], "summary": "Do not dump subscriptions.", "signature": "--no-subscriptions", "source_url": "/docs/16/app-pg-dumpall.html", "description": "Do not dump subscriptions."}, {"names": ["--no-sync"], "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": "--no-sync", "source_url": "/docs/16/app-pg-dumpall.html", "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-table-access-method"], "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": "--no-table-access-method", "source_url": "/docs/16/app-pg-dumpall.html", "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-tablespaces"], "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": "--no-tablespaces", "source_url": "/docs/16/app-pg-dumpall.html", "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-toast-compression"], "summary": "Do not output commands to set TOAST compression methods. With this option, all columns will be restored with the default compression setting.", "signature": "--no-toast-compression", "source_url": "/docs/16/app-pg-dumpall.html", "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-unlogged-table-data"], "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": "--no-unlogged-table-data", "source_url": "/docs/16/app-pg-dumpall.html", "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": ["--on-conflict-do-nothing"], "summary": "Add ON CONFLICT DO NOTHING to INSERT commands. This option is not valid unless --inserts or --column-inserts is also specified.", "signature": "--on-conflict-do-nothing", "source_url": "/docs/16/app-pg-dumpall.html", "description": "Add ON CONFLICT DO NOTHING to INSERT commands. This option is not valid unless --inserts or --column-inserts is also specified."}, {"names": ["--quote-all-identifiers"], "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": "--quote-all-identifiers", "source_url": "/docs/16/app-pg-dumpall.html", "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": ["--restrict-key= restrict_key"], "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": "--restrict-key= restrict_key", "source_url": "/docs/16/app-pg-dumpall.html", "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": ["--rows-per-insert= nrows"], "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": "--rows-per-insert= nrows", "source_url": "/docs/16/app-pg-dumpall.html", "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": ["--use-set-session-authorization"], "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": "--use-set-session-authorization", "source_url": "/docs/16/app-pg-dumpall.html", "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": ["-?", "--help"], "summary": "Show help about pg_dumpall command line arguments, and exit.", "signature": "-? --help", "source_url": "/docs/16/app-pg-dumpall.html", "description": "Show help about pg_dumpall command line arguments, and exit."}, {"names": ["-d connstr", "--dbname= connstr"], "summary": "Specifies parameters used to connect to the server, as a connection string ; these will override any conflicting command line options.", "signature": "-d connstr --dbname= connstr", "source_url": "/docs/16/app-pg-dumpall.html", "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": ["-h host", "--host= host"], "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": "-h host --host= host", "source_url": "/docs/16/app-pg-dumpall.html", "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": ["-l dbname", "--database= dbname"], "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": "-l dbname --database= dbname", "source_url": "/docs/16/app-pg-dumpall.html", "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": ["-p port", "--port= port"], "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": "-p port --port= port", "source_url": "/docs/16/app-pg-dumpall.html", "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": ["-U username", "--username= username"], "summary": "User name to connect as.", "signature": "-U username --username= username", "source_url": "/docs/16/app-pg-dumpall.html", "description": "User name to connect as."}, {"names": ["-w", "--no-password"], "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": "-w --no-password", "source_url": "/docs/16/app-pg-dumpall.html", "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", "--password"], "summary": "Force pg_dumpall to prompt for a password before connecting to a database.", "signature": "-W --password", "source_url": "/docs/16/app-pg-dumpall.html", "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": ["--role= rolename"], "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.", "signature": "--role= rolename", "source_url": "/docs/16/app-pg-dumpall.html", "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."}], "related": [{"url": "/wiki/conn/?v=16", "label": "libpq connection parameters"}], "release": {"ref": "https://ftp.postgresql.org/pub/source/v16.15/postgresql-16.15.tar.bz2", "label": "16.15", "major": "16", "channel": "stable", "manifest": {"pdf": {"A4": {"url": "/files/documentation/pdf/16/postgresql-16-A4.pdf", "bytes": 15282337, "pages": 3055, "sha256": "4bb6c1f63deedac98736d8c4c7bc0fad0ac24e85b07e21ee10411872f06afd06", "built_at": "2026-09-26"}, "US": {"url": "/files/documentation/pdf/16/postgresql-16-US.pdf", "bytes": 15164148, "pages": 3220, "sha256": "5b6b6166c89991199e144bb0ae34c17a5f29826251dbf19db1abc0df3a3e771b", "built_at": "2026-09-26"}}, "tree": "16", "index": "index.html", "major": "16", "pages": 1169, "release": "16.15", "source_url": "https://ftp.postgresql.org/pub/source/v16.15/postgresql-16.15.tar.bz2", "svg_assets": 3, "source_mode": "en HTML verified against the pinned official archive", "source_sha256": "c1575341fa7bd40f5274ea465b34390f4dc64cdd0770af327005caaeb9f6b7ed"}, "revision": "3c21e58b35318021716440e67bb8bafd392b6a2b965a244d90e9e33c99e0bdef", "evidence_kind": "English manual and source declarations", "source_sha256": "c1575341fa7bd40f5274ea465b34390f4dc64cdd0770af327005caaeb9f6b7ed"}, "sources": [{"url": "/docs/16/app-pg-dumpall.html", "file": "app-pg-dumpall.html", "label": "16.15 English manual \u00b7 app-pg-dumpall.html", "anchor": "", "sha256": "25ba3efb15acbcb9d4eec4b4c2b14993eb0252118fcb9b8c6ddf78c3bfe41b63"}, {"url": "/docs/16/reference-client.html", "file": "reference-client.html", "label": "Client applications inventory", "anchor": "", "sha256": "a28c30c3c0f8783e16d56413a0b6fd39487e336da1683b29b60abf1c229cef26"}], "sections": [], "synopsis": ["pg_dumpall [ connection-option ...] [ option ...]"], "signature": "pg_dumpall [ connection-option ...] [ option ...]", "description": ["pg_dumpall \u2014 extract a PostgreSQL database cluster into a script file"], "environment": [{"name": "PGHOST PGOPTIONS PGPORT PGUSER", "description": "Default connection parameters"}, {"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}], "manual_html": "<div><div class=\"refentry\" id=\"APP-PG-DUMPALL\">\n<div class=\"titlepage\"></div>\n<div class=\"refnamediv\">\n<h2><span class=\"refentrytitle\"><span class=\"application\">pg_dumpall</span></span></h2>\n<p>pg_dumpall \u2014 extract a <span class=\"productname\">PostgreSQL</span> database cluster into a script file</p>\n</div>\n<div class=\"refsynopsisdiv\">\n<h2>Synopsis</h2>\n<div class=\"cmdsynopsis\">\n<p id=\"id-1.9.4.14.4.1\"><code class=\"command\">pg_dumpall</code> [<em class=\"replaceable\"><code>connection-option</code></em>...] [<em class=\"replaceable\"><code>option</code></em>...]</p>\n</div>\n</div>\n<div class=\"refsect1\" id=\"APP-PG-DUMPALL-DESCRIPTION\">\n<h2>Description</h2>\n<p><span class=\"application\">pg_dumpall</span> is a utility for writing out (<span class=\"quote\">\u201c<span class=\"quote\">dumping</span>\u201d</span>) all <span class=\"productname\">PostgreSQL</span> databases of a cluster into one script file. The script file contains SQL commands that can be used as input to <a class=\"xref\" href=\"/docs/16/app-psql.html\" title=\"psql\"><span class=\"refentrytitle\"><span class=\"application\">psql</span></span></a> to restore the databases. It does this by calling <a class=\"xref\" href=\"/docs/16/app-pgdump.html\" title=\"pg_dump\"><span class=\"refentrytitle\"><span class=\"application\">pg_dump</span></span></a> for each database in the cluster. <span class=\"application\">pg_dumpall</span> also dumps global objects that are common to all databases, namely database roles, tablespaces, and privilege grants for configuration parameters. (<span class=\"application\">pg_dump</span> does not save these objects.)</p>\n<p>Since <span class=\"application\">pg_dumpall</span> 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.</p>\n<p>The SQL script will be written to the standard output. Use the <code class=\"option\">-f</code>/<code class=\"option\">--file</code> option or shell operators to redirect it into a file.</p>\n<p><span class=\"application\">pg_dumpall</span> needs to connect several times to the <span class=\"productname\">PostgreSQL</span> server (once per database). If you use password authentication it will ask for a password each time. It is convenient to have a <code class=\"filename\">~/.pgpass</code> file in such cases. See <a class=\"xref\" href=\"/docs/16/libpq-pgpass.html\" title=\"34.16.\u00a0The Password File\">Section\u00a034.16</a> for more information.</p>\n<div class=\"warning\">\n<h3 class=\"title\">Warning</h3>\n<p>Restoring 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.</p>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.14.6\">\n<h2>Options</h2>\n<p>The following command-line options control the content and format of the output.</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-a</code><br></span><span class=\"term\"><code class=\"option\">--data-only</code></span></dt>\n<dd>\n<p>Dump only the data, not the schema (data definitions).</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-c</code><br></span><span class=\"term\"><code class=\"option\">--clean</code></span></dt>\n<dd>\n<p>Emit SQL commands to <code class=\"command\">DROP</code> 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 <code class=\"option\">--if-exists</code> is also specified.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-E <em class=\"replaceable\"><code>encoding</code></em></code><br></span><span class=\"term\"><code class=\"option\">--encoding=<em class=\"replaceable\"><code>encoding</code></em></code></span></dt>\n<dd>\n<p>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 <code class=\"envar\">PGCLIENTENCODING</code> environment variable to the desired dump encoding.)</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-f <em class=\"replaceable\"><code>filename</code></em></code><br></span><span class=\"term\"><code class=\"option\">--file=<em class=\"replaceable\"><code>filename</code></em></code></span></dt>\n<dd>\n<p>Send output to the specified file. If this is omitted, the standard output is used.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-g</code><br></span><span class=\"term\"><code class=\"option\">--globals-only</code></span></dt>\n<dd>\n<p>Dump only global objects (roles and tablespaces), no databases.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-O</code><br></span><span class=\"term\"><code class=\"option\">--no-owner</code></span></dt>\n<dd>\n<p>Do not output commands to set ownership of objects to match the original database. By default, <span class=\"application\">pg_dumpall</span> issues <code class=\"command\">ALTER OWNER</code> or <code class=\"command\">SET SESSION AUTHORIZATION</code> 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 <code class=\"option\">-O</code>.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-r</code><br></span><span class=\"term\"><code class=\"option\">--roles-only</code></span></dt>\n<dd>\n<p>Dump only roles, no databases or tablespaces.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-s</code><br></span><span class=\"term\"><code class=\"option\">--schema-only</code></span></dt>\n<dd>\n<p>Dump only the object definitions (schema), not data.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-S <em class=\"replaceable\"><code>username</code></em></code><br></span><span class=\"term\"><code class=\"option\">--superuser=<em class=\"replaceable\"><code>username</code></em></code></span></dt>\n<dd>\n<p>Specify the superuser user name to use when disabling triggers. This is relevant only if <code class=\"option\">--disable-triggers</code> is used. (Usually, it's better to leave this out, and instead start the resulting script as superuser.)</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-t</code><br></span><span class=\"term\"><code class=\"option\">--tablespaces-only</code></span></dt>\n<dd>\n<p>Dump only tablespaces, no databases or roles.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-v</code><br></span><span class=\"term\"><code class=\"option\">--verbose</code></span></dt>\n<dd>\n<p>Specifies verbose mode. This will cause <span class=\"application\">pg_dumpall</span> 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 <span class=\"application\">pg_dump</span>.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-V</code><br></span><span class=\"term\"><code class=\"option\">--version</code></span></dt>\n<dd>\n<p>Print the <span class=\"application\">pg_dumpall</span> version and exit.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-x</code><br></span><span class=\"term\"><code class=\"option\">--no-privileges</code><br></span><span class=\"term\"><code class=\"option\">--no-acl</code></span></dt>\n<dd>\n<p>Prevent dumping of access privileges (grant/revoke commands).</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--binary-upgrade</code></span></dt>\n<dd>\n<p>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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--column-inserts</code><br></span><span class=\"term\"><code class=\"option\">--attribute-inserts</code></span></dt>\n<dd>\n<p>Dump data as <code class=\"command\">INSERT</code> commands with explicit column names (<code class=\"literal\">INSERT INTO <em class=\"replaceable\"><code>table</code></em> (<em class=\"replaceable\"><code>column</code></em>, ...) VALUES ...</code>). This will make restoration very slow; it is mainly useful for making dumps that can be loaded into non-<span class=\"productname\">PostgreSQL</span> databases.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--disable-dollar-quoting</code></span></dt>\n<dd>\n<p>This option disables the use of dollar quoting for function bodies, and forces them to be quoted using SQL standard string syntax.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--disable-triggers</code></span></dt>\n<dd>\n<p>This option is relevant only when creating a data-only dump. It instructs <span class=\"application\">pg_dumpall</span> 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.</p>\n<p>Presently, the commands emitted for <code class=\"option\">--disable-triggers</code> must be done as superuser. So, you should also specify a superuser name with <code class=\"option\">-S</code>, or preferably be careful to start the resulting script as a superuser.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--exclude-database=<em class=\"replaceable\"><code>pattern</code></em></code></span></dt>\n<dd>\n<p>Do not dump databases whose name matches <em class=\"replaceable\"><code>pattern</code></em>. Multiple patterns can be excluded by writing multiple <code class=\"option\">--exclude-database</code> switches. The <em class=\"replaceable\"><code>pattern</code></em> parameter is interpreted as a pattern according to the same rules used by <span class=\"application\">psql</span>'s <code class=\"literal\">\\d</code> commands (see <a class=\"xref\" href=\"/docs/16/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\">Patterns</a>), 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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--extra-float-digits=<em class=\"replaceable\"><code>ndigits</code></em></code></span></dt>\n<dd>\n<p>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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--if-exists</code></span></dt>\n<dd>\n<p>Use <code class=\"literal\">DROP ... IF EXISTS</code> commands to drop objects in <code class=\"option\">--clean</code> mode. This suppresses <span class=\"quote\">\u201c<span class=\"quote\">does not exist</span>\u201d</span> errors that might otherwise be reported. This option is not valid unless <code class=\"option\">--clean</code> is also specified.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--inserts</code></span></dt>\n<dd>\n<p>Dump data as <code class=\"command\">INSERT</code> commands (rather than <code class=\"command\">COPY</code>). This will make restoration very slow; it is mainly useful for making dumps that can be loaded into non-<span class=\"productname\">PostgreSQL</span> databases. Note that the restore might fail altogether if you have rearranged column order. The <code class=\"option\">--column-inserts</code> option is safer, though even slower.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--load-via-partition-root</code></span></dt>\n<dd>\n<p>When dumping data for a table partition, make the <code class=\"command\">COPY</code> or <code class=\"command\">INSERT</code> 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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--lock-wait-timeout=<em class=\"replaceable\"><code>timeout</code></em></code></span></dt>\n<dd>\n<p>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 <em class=\"replaceable\"><code>timeout</code></em>. The timeout may be specified in any of the formats accepted by <code class=\"command\">SET statement_timeout</code>.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-comments</code></span></dt>\n<dd>\n<p>Do not dump comments.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-publications</code></span></dt>\n<dd>\n<p>Do not dump publications.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-role-passwords</code></span></dt>\n<dd>\n<p>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 <code class=\"structname\">pg_roles</code> instead of <code class=\"structname\">pg_authid</code>. Therefore, this option also helps if access to <code class=\"structname\">pg_authid</code> is restricted by some security policy.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-security-labels</code></span></dt>\n<dd>\n<p>Do not dump security labels.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-subscriptions</code></span></dt>\n<dd>\n<p>Do not dump subscriptions.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-sync</code></span></dt>\n<dd>\n<p>By default, <code class=\"command\">pg_dumpall</code> will wait for all files to be written safely to disk. This option causes <code class=\"command\">pg_dumpall</code> 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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-table-access-method</code></span></dt>\n<dd>\n<p>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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-tablespaces</code></span></dt>\n<dd>\n<p>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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-toast-compression</code></span></dt>\n<dd>\n<p>Do not output commands to set TOAST compression methods. With this option, all columns will be restored with the default compression setting.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-unlogged-table-data</code></span></dt>\n<dd>\n<p>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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--on-conflict-do-nothing</code></span></dt>\n<dd>\n<p>Add <code class=\"literal\">ON CONFLICT DO NOTHING</code> to <code class=\"command\">INSERT</code> commands. This option is not valid unless <code class=\"option\">--inserts</code> or <code class=\"option\">--column-inserts</code> is also specified.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--quote-all-identifiers</code></span></dt>\n<dd>\n<p>Force quoting of all identifiers. This option is recommended when dumping a database from a server whose <span class=\"productname\">PostgreSQL</span> major version is different from <span class=\"application\">pg_dumpall</span>'s, or when the output is intended to be loaded into a server of a different major version. By default, <span class=\"application\">pg_dumpall</span> 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 <code class=\"option\">--quote-all-identifiers</code> prevents such issues, at the price of a harder-to-read dump script.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--restrict-key=<em class=\"replaceable\"><code>restrict_key</code></em></code></span></dt>\n<dd>\n<p>Use the provided string as the <span class=\"application\">psql</span> <code class=\"command\">\\restrict</code> key in the dump output. If no restrict key is specified, <span class=\"application\">pg_dumpall</span> will generate a random one as needed. Keys may contain only alphanumeric characters.</p>\n<p>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 <span class=\"application\">psql</span> with the dump output.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--rows-per-insert=<em class=\"replaceable\"><code>nrows</code></em></code></span></dt>\n<dd>\n<p>Dump data as <code class=\"command\">INSERT</code> commands (rather than <code class=\"command\">COPY</code>). Controls the maximum number of rows per <code class=\"command\">INSERT</code> 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 <code class=\"command\">INSERT</code> to be lost, rather than the entire table contents.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--use-set-session-authorization</code></span></dt>\n<dd>\n<p>Output SQL-standard <code class=\"command\">SET SESSION AUTHORIZATION</code> commands instead of <code class=\"command\">ALTER OWNER</code> 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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-?</code><br></span><span class=\"term\"><code class=\"option\">--help</code></span></dt>\n<dd>\n<p>Show help about <span class=\"application\">pg_dumpall</span> command line arguments, and exit.</p>\n</dd>\n</dl>\n</div>\n<p>The following command-line options control the database connection parameters.</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-d <em class=\"replaceable\"><code>connstr</code></em></code><br></span><span class=\"term\"><code class=\"option\">--dbname=<em class=\"replaceable\"><code>connstr</code></em></code></span></dt>\n<dd>\n<p>Specifies parameters used to connect to the server, as a <a class=\"link\" href=\"/docs/16/libpq-connect.html#LIBPQ-CONNSTRING\" title=\"34.1.1.\u00a0Connection Strings\">connection string</a>; these will override any conflicting command line options.</p>\n<p>The option is called <code class=\"literal\">--dbname</code> for consistency with other client applications, but because <span class=\"application\">pg_dumpall</span> needs to connect to many databases, the database name in the connection string will be ignored. Use the <code class=\"literal\">-l</code> 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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-h <em class=\"replaceable\"><code>host</code></em></code><br></span><span class=\"term\"><code class=\"option\">--host=<em class=\"replaceable\"><code>host</code></em></code></span></dt>\n<dd>\n<p>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 <code class=\"envar\">PGHOST</code> environment variable, if set, else a Unix domain socket connection is attempted.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-l <em class=\"replaceable\"><code>dbname</code></em></code><br></span><span class=\"term\"><code class=\"option\">--database=<em class=\"replaceable\"><code>dbname</code></em></code></span></dt>\n<dd>\n<p>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 <code class=\"literal\">postgres</code> database will be used, and if that does not exist, <code class=\"literal\">template1</code> will be used.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-p <em class=\"replaceable\"><code>port</code></em></code><br></span><span class=\"term\"><code class=\"option\">--port=<em class=\"replaceable\"><code>port</code></em></code></span></dt>\n<dd>\n<p>Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the <code class=\"envar\">PGPORT</code> environment variable, if set, or a compiled-in default.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-U <em class=\"replaceable\"><code>username</code></em></code><br></span><span class=\"term\"><code class=\"option\">--username=<em class=\"replaceable\"><code>username</code></em></code></span></dt>\n<dd>\n<p>User name to connect as.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-w</code><br></span><span class=\"term\"><code class=\"option\">--no-password</code></span></dt>\n<dd>\n<p>Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a <code class=\"filename\">.pgpass</code> 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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-W</code><br></span><span class=\"term\"><code class=\"option\">--password</code></span></dt>\n<dd>\n<p>Force <span class=\"application\">pg_dumpall</span> to prompt for a password before connecting to a database.</p>\n<p>This option is never essential, since <span class=\"application\">pg_dumpall</span> will automatically prompt for a password if the server demands password authentication. However, <span class=\"application\">pg_dumpall</span> will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing <code class=\"option\">-W</code> to avoid the extra connection attempt.</p>\n<p>Note that the password prompt will occur again for each database to be dumped. Usually, it's better to set up a <code class=\"filename\">~/.pgpass</code> file than to rely on manual password entry.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--role=<em class=\"replaceable\"><code>rolename</code></em></code></span></dt>\n<dd>\n<p>Specifies a role name to be used to create the dump. This option causes <span class=\"application\">pg_dumpall</span> to issue a <code class=\"command\">SET ROLE</code> <em class=\"replaceable\"><code>rolename</code></em> command after connecting to the database. It is useful when the authenticated user (specified by <code class=\"option\">-U</code>) lacks privileges needed by <span class=\"application\">pg_dumpall</span>, 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.</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.14.7\">\n<h2>Environment</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"envar\">PGHOST</code><br></span><span class=\"term\"><code class=\"envar\">PGOPTIONS</code><br></span><span class=\"term\"><code class=\"envar\">PGPORT</code><br></span><span class=\"term\"><code class=\"envar\">PGUSER</code></span></dt>\n<dd>\n<p>Default connection parameters</p>\n</dd>\n<dt><span class=\"term\"><code class=\"envar\">PG_COLOR</code></span></dt>\n<dd>\n<p>Specifies whether to use color in diagnostic messages. Possible values are <code class=\"literal\">always</code>, <code class=\"literal\">auto</code> and <code class=\"literal\">never</code>.</p>\n</dd>\n</dl>\n</div>\n<p>This utility, like most other <span class=\"productname\">PostgreSQL</span> utilities, also uses the environment variables supported by <span class=\"application\">libpq</span> (see <a class=\"xref\" href=\"/docs/16/libpq-envars.html\" title=\"34.15.\u00a0Environment Variables\">Section\u00a034.15</a>).</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.14.8\">\n<h2>Notes</h2>\n<p>Since <span class=\"application\">pg_dumpall</span> calls <span class=\"application\">pg_dump</span> internally, some diagnostic messages will refer to <span class=\"application\">pg_dump</span>.</p>\n<p>The <code class=\"option\">--clean</code> option can be useful even when your intention is to restore the dump script into a fresh cluster. Use of <code class=\"option\">--clean</code> authorizes the script to drop and re-create the built-in <code class=\"literal\">postgres</code> and <code class=\"literal\">template1</code> 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.</p>\n<p>Once restored, it is wise to run <code class=\"command\">ANALYZE</code> on each database so the optimizer has useful statistics. You can also run <code class=\"command\">vacuumdb -a -z</code> to analyze all databases.</p>\n<p>The dump script should not be expected to run completely without errors. In particular, because the script will issue <code class=\"command\">CREATE ROLE</code> for every role existing in the source cluster, it is certain to get a <span class=\"quote\">\u201c<span class=\"quote\">role already exists</span>\u201d</span> 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 <code class=\"option\">--clean</code> option is likely to produce additional harmless error messages about non-existent objects, although you can minimize those by adding <code class=\"option\">--if-exists</code>.</p>\n<p><span class=\"application\">pg_dumpall</span> requires all needed tablespace directories to exist before the restore; otherwise, database creation will fail for databases in non-default locations.</p>\n<p>It is generally recommended to use the <code class=\"option\">-X</code> (<code class=\"option\">--no-psqlrc</code>) option when restoring a database from a <span class=\"application\">pg_dumpall</span> script to ensure a clean restore process and prevent potential conflicts with non-default <span class=\"application\">psql</span> configurations. Additionally, because the <span class=\"application\">pg_dumpall</span> script may include <span class=\"application\">psql</span> meta-commands, it may be incompatible with clients other than <span class=\"application\">psql</span>.</p>\n</div>\n<div class=\"refsect1\" id=\"APP-PG-DUMPALL-EX\">\n<h2>Examples</h2>\n<p>To dump all databases:</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_dumpall &gt; db.out</code></strong>\n</pre>\n<p>To restore database(s) from this file, you can use:</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>psql -X -f db.out -d postgres</code></strong>\n</pre>\n<p>It is not important which database you connect to here since the script file created by <span class=\"application\">pg_dumpall</span> will contain the appropriate commands to create and connect to the saved databases. An exception is that if you specified <code class=\"option\">--clean</code>, you must connect to the <code class=\"literal\">postgres</code> database initially; the script will attempt to drop other databases immediately, and that will fail for the database you are connected to.</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.14.10\">\n<h2>See Also</h2>\n<p>Check <a class=\"xref\" href=\"/docs/16/app-pgdump.html\" title=\"pg_dump\"><span class=\"refentrytitle\"><span class=\"application\">pg_dump</span></span></a> for details on possible error conditions.</p>\n</div>\n</div></div>", "manual_path": "app-pg-dumpall.html", "comparison_data": {"options": [{"names": ["-a", "--data-only"], "signature": "-a --data-only", "description": "Dump only the data, not the schema (data definitions)."}, {"names": ["-c", "--clean"], "signature": "-c --clean", "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": ["-E encoding", "--encoding= encoding"], "signature": "-E encoding --encoding= encoding", "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": ["-f filename", "--file= filename"], "signature": "-f filename --file= filename", "description": "Send output to the specified file. If this is omitted, the standard output is used."}, {"names": ["-g", "--globals-only"], "signature": "-g --globals-only", "description": "Dump only global objects (roles and tablespaces), no databases."}, {"names": ["-O", "--no-owner"], "signature": "-O --no-owner", "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": ["-r", "--roles-only"], "signature": "-r --roles-only", "description": "Dump only roles, no databases or tablespaces."}, {"names": ["-s", "--schema-only"], "signature": "-s --schema-only", "description": "Dump only the object definitions (schema), not data."}, {"names": ["-S username", "--superuser= username"], "signature": "-S username --superuser= username", "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": ["-t", "--tablespaces-only"], "signature": "-t --tablespaces-only", "description": "Dump only tablespaces, no databases or roles."}, {"names": ["-v", "--verbose"], "signature": "-v --verbose", "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", "--version"], "signature": "-V --version", "description": "Print the pg_dumpall version and exit."}, {"names": ["-x", "--no-privileges", "--no-acl"], "signature": "-x --no-privileges --no-acl", "description": "Prevent dumping of access privileges (grant/revoke commands)."}, {"names": ["--binary-upgrade"], "signature": "--binary-upgrade", "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": ["--column-inserts", "--attribute-inserts"], "signature": "--column-inserts --attribute-inserts", "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": ["--disable-dollar-quoting"], "signature": "--disable-dollar-quoting", "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-triggers"], "signature": "--disable-triggers", "description": "This option is relevant only when creating a data-only dump. 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": ["--exclude-database= pattern"], "signature": "--exclude-database= pattern", "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": ["--extra-float-digits= ndigits"], "signature": "--extra-float-digits= ndigits", "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": ["--if-exists"], "signature": "--if-exists", "description": "Use DROP ... IF EXISTS commands to drop objects in --clean mode. This suppresses \u201c does not exist \u201d errors that might otherwise be reported. This option is not valid unless --clean is also specified."}, {"names": ["--inserts"], "signature": "--inserts", "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": ["--load-via-partition-root"], "signature": "--load-via-partition-root", "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": ["--lock-wait-timeout= timeout"], "signature": "--lock-wait-timeout= timeout", "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": ["--no-comments"], "signature": "--no-comments", "description": "Do not dump comments."}, {"names": ["--no-publications"], "signature": "--no-publications", "description": "Do not dump publications."}, {"names": ["--no-role-passwords"], "signature": "--no-role-passwords", "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-security-labels"], "signature": "--no-security-labels", "description": "Do not dump security labels."}, {"names": ["--no-subscriptions"], "signature": "--no-subscriptions", "description": "Do not dump subscriptions."}, {"names": ["--no-sync"], "signature": "--no-sync", "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-table-access-method"], "signature": "--no-table-access-method", "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-tablespaces"], "signature": "--no-tablespaces", "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-toast-compression"], "signature": "--no-toast-compression", "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-unlogged-table-data"], "signature": "--no-unlogged-table-data", "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": ["--on-conflict-do-nothing"], "signature": "--on-conflict-do-nothing", "description": "Add ON CONFLICT DO NOTHING to INSERT commands. This option is not valid unless --inserts or --column-inserts is also specified."}, {"names": ["--quote-all-identifiers"], "signature": "--quote-all-identifiers", "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": ["--restrict-key= restrict_key"], "signature": "--restrict-key= restrict_key", "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": ["--rows-per-insert= nrows"], "signature": "--rows-per-insert= nrows", "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": ["--use-set-session-authorization"], "signature": "--use-set-session-authorization", "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": ["-?", "--help"], "signature": "-? --help", "description": "Show help about pg_dumpall command line arguments, and exit."}, {"names": ["-d connstr", "--dbname= connstr"], "signature": "-d connstr --dbname= connstr", "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": ["-h host", "--host= host"], "signature": "-h host --host= host", "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": ["-l dbname", "--database= dbname"], "signature": "-l dbname --database= dbname", "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": ["-p port", "--port= port"], "signature": "-p port --port= port", "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": ["-U username", "--username= username"], "signature": "-U username --username= username", "description": "User name to connect as."}, {"names": ["-w", "--no-password"], "signature": "-w --no-password", "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", "--password"], "signature": "-W --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": ["--role= rolename"], "signature": "--role= rolename", "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."}], "synopsis": ["pg_dumpall [ connection-option ...] [ option ...]"], "environment": [{"name": "PGHOST PGOPTIONS PGPORT PGUSER", "description": "Default connection parameters"}, {"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}]}, "comparison_hash": "bbf091482ea32f43d40a8ef9dfa9872b232f589fe2f88417dd522db4c2273394"}, "17": {"facts": [{"label": "Documented executable", "value": "pg_dumpall"}, {"label": "Executable version", "value": "17.11"}, {"label": "Reference inventory", "value": "Client applications"}, {"label": "Option definition groups", "value": "48"}], "tables": [{"key": "options", "rows": [{"summary": "Dump only the data, not the schema (data definitions).", "signature": {"url": "/docs/17/app-pg-dumpall.html", "text": "-a --data-only"}}, {"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": {"url": "/docs/17/app-pg-dumpall.html", "text": "-c --clean"}}, {"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": {"url": "/docs/17/app-pg-dumpall.html", "text": "-E encoding --encoding= encoding"}}, {"summary": "Send output to the specified file. If this is omitted, the standard output is used.", "signature": {"url": "/docs/17/app-pg-dumpall.html", "text": "-f filename --file= filename"}}, {"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": {"url": "/docs/17/app-pg-dumpall.html", "text": "--filter= filename"}}, {"summary": "Dump only global objects (roles and tablespaces), no databases.", "signature": {"url": "/docs/17/app-pg-dumpall.html", "text": "-g --globals-only"}}, {"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": {"url": "/docs/17/app-pg-dumpall.html", "text": "-O --no-owner"}}, {"summary": "Dump only roles, no databases or tablespaces.", "signature": {"url": "/docs/17/app-pg-dumpall.html", "text": "-r --roles-only"}}, {"summary": "Dump only the object definitions (schema), not data.", "signature": {"url": "/docs/17/app-pg-dumpall.html", "text": "-s --schema-only"}}, {"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": {"url": "/docs/17/app-pg-dumpall.html", "text": "-S username --superuser= username"}}, {"summary": "Dump only tablespaces, no databases or roles.", "signature": {"url": "/docs/17/app-pg-dumpall.html", "text": "-t --tablespaces-only"}}, {"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": {"url": "/docs/17/app-pg-dumpall.html", "text": "-v --verbose"}}, {"summary": "Print the pg_dumpall version and exit.", "signature": {"url": "/docs/17/app-pg-dumpall.html", "text": "-V --version"}}, {"summary": "Prevent dumping of access privileges (grant/revoke commands).", "signature": {"url": "/docs/17/app-pg-dumpall.html", "text": "-x --no-privileges --no-acl"}}, {"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": {"url": "/docs/17/app-pg-dumpall.html", "text": "--binary-upgrade"}}, {"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": {"url": "/docs/17/app-pg-dumpall.html", "text": "--column-inserts --attribute-inserts"}}, {"summary": "This option disables the use of dollar quoting for function bodies, and forces them to be quoted using SQL standard string syntax.", "signature": {"url": "/docs/17/app-pg-dumpall.html", "text": "--disable-dollar-quoting"}}, {"summary": "This option is relevant only when creating a data-only dump. 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": {"url": "/docs/17/app-pg-dumpall.html", "text": "--disable-triggers"}}, {"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": {"url": "/docs/17/app-pg-dumpall.html", "text": "--exclude-database= pattern"}}, {"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": {"url": "/docs/17/app-pg-dumpall.html", "text": "--extra-float-digits= ndigits"}}, {"summary": "Use DROP ... IF EXISTS commands to drop objects in --clean mode. This suppresses \u201c does not exist \u201d errors that might otherwise be reported. This option is not valid unless --clean is also specified.", "signature": {"url": "/docs/17/app-pg-dumpall.html", "text": "--if-exists"}}, {"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": {"url": "/docs/17/app-pg-dumpall.html", "text": "--inserts"}}, {"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": {"url": "/docs/17/app-pg-dumpall.html", "text": "--load-via-partition-root"}}, {"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": {"url": "/docs/17/app-pg-dumpall.html", "text": "--lock-wait-timeout= timeout"}}, {"summary": "Do not dump comments.", "signature": {"url": "/docs/17/app-pg-dumpall.html", "text": "--no-comments"}}, {"summary": "Do not dump publications.", "signature": {"url": "/docs/17/app-pg-dumpall.html", "text": "--no-publications"}}, {"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": {"url": "/docs/17/app-pg-dumpall.html", "text": "--no-role-passwords"}}, {"summary": "Do not dump security labels.", "signature": {"url": "/docs/17/app-pg-dumpall.html", "text": "--no-security-labels"}}, {"summary": "Do not dump subscriptions.", "signature": {"url": "/docs/17/app-pg-dumpall.html", "text": "--no-subscriptions"}}, {"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": {"url": "/docs/17/app-pg-dumpall.html", "text": "--no-sync"}}, {"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": {"url": "/docs/17/app-pg-dumpall.html", "text": "--no-table-access-method"}}, {"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": {"url": "/docs/17/app-pg-dumpall.html", "text": "--no-tablespaces"}}, {"summary": "Do not output commands to set TOAST compression methods. With this option, all columns will be restored with the default compression setting.", "signature": {"url": "/docs/17/app-pg-dumpall.html", "text": "--no-toast-compression"}}, {"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": {"url": "/docs/17/app-pg-dumpall.html", "text": "--no-unlogged-table-data"}}, {"summary": "Add ON CONFLICT DO NOTHING to INSERT commands. This option is not valid unless --inserts or --column-inserts is also specified.", "signature": {"url": "/docs/17/app-pg-dumpall.html", "text": "--on-conflict-do-nothing"}}, {"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": {"url": "/docs/17/app-pg-dumpall.html", "text": "--quote-all-identifiers"}}, {"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": {"url": "/docs/17/app-pg-dumpall.html", "text": "--restrict-key= restrict_key"}}, {"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": {"url": "/docs/17/app-pg-dumpall.html", "text": "--rows-per-insert= nrows"}}, {"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": {"url": "/docs/17/app-pg-dumpall.html", "text": "--use-set-session-authorization"}}, {"summary": "Show help about pg_dumpall command line arguments, and exit.", "signature": {"url": "/docs/17/app-pg-dumpall.html", "text": "-? --help"}}, {"summary": "Specifies parameters used to connect to the server, as a connection string ; these will override any conflicting command line options.", "signature": {"url": "/docs/17/app-pg-dumpall.html", "text": "-d connstr --dbname= connstr"}}, {"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": {"url": "/docs/17/app-pg-dumpall.html", "text": "-h host --host= host"}}, {"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": {"url": "/docs/17/app-pg-dumpall.html", "text": "-l dbname --database= dbname"}}, {"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": {"url": "/docs/17/app-pg-dumpall.html", "text": "-p port --port= port"}}, {"summary": "User name to connect as.", "signature": {"url": "/docs/17/app-pg-dumpall.html", "text": "-U username --username= username"}}, {"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": {"url": "/docs/17/app-pg-dumpall.html", "text": "-w --no-password"}}, {"summary": "Force pg_dumpall to prompt for a password before connecting to a database.", "signature": {"url": "/docs/17/app-pg-dumpall.html", "text": "-W --password"}}, {"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.", "signature": {"url": "/docs/17/app-pg-dumpall.html", "text": "--role= rolename"}}], "title": "Documented options", "columns": [{"key": "signature", "label": "Option and arguments"}, {"key": "summary", "label": "Description"}]}, {"key": "environment", "rows": [{"name": "PGHOST PGOPTIONS PGPORT PGUSER", "description": "Default connection parameters"}, {"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}], "title": "Environment variables", "columns": [{"key": "name", "label": "Variable"}, {"key": "description", "label": "Meaning"}]}], "options": [{"names": ["-a", "--data-only"], "summary": "Dump only the data, not the schema (data definitions).", "signature": "-a --data-only", "source_url": "/docs/17/app-pg-dumpall.html", "description": "Dump only the data, not the schema (data definitions)."}, {"names": ["-c", "--clean"], "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": "-c --clean", "source_url": "/docs/17/app-pg-dumpall.html", "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": ["-E encoding", "--encoding= encoding"], "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": "-E encoding --encoding= encoding", "source_url": "/docs/17/app-pg-dumpall.html", "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": ["-f filename", "--file= filename"], "summary": "Send output to the specified file. If this is omitted, the standard output is used.", "signature": "-f filename --file= filename", "source_url": "/docs/17/app-pg-dumpall.html", "description": "Send output to the specified file. If this is omitted, the standard output is used."}, {"names": ["--filter= filename"], "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": "--filter= filename", "source_url": "/docs/17/app-pg-dumpall.html", "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": ["-g", "--globals-only"], "summary": "Dump only global objects (roles and tablespaces), no databases.", "signature": "-g --globals-only", "source_url": "/docs/17/app-pg-dumpall.html", "description": "Dump only global objects (roles and tablespaces), no databases."}, {"names": ["-O", "--no-owner"], "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": "-O --no-owner", "source_url": "/docs/17/app-pg-dumpall.html", "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": ["-r", "--roles-only"], "summary": "Dump only roles, no databases or tablespaces.", "signature": "-r --roles-only", "source_url": "/docs/17/app-pg-dumpall.html", "description": "Dump only roles, no databases or tablespaces."}, {"names": ["-s", "--schema-only"], "summary": "Dump only the object definitions (schema), not data.", "signature": "-s --schema-only", "source_url": "/docs/17/app-pg-dumpall.html", "description": "Dump only the object definitions (schema), not data."}, {"names": ["-S username", "--superuser= username"], "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": "-S username --superuser= username", "source_url": "/docs/17/app-pg-dumpall.html", "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": ["-t", "--tablespaces-only"], "summary": "Dump only tablespaces, no databases or roles.", "signature": "-t --tablespaces-only", "source_url": "/docs/17/app-pg-dumpall.html", "description": "Dump only tablespaces, no databases or roles."}, {"names": ["-v", "--verbose"], "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": "-v --verbose", "source_url": "/docs/17/app-pg-dumpall.html", "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", "--version"], "summary": "Print the pg_dumpall version and exit.", "signature": "-V --version", "source_url": "/docs/17/app-pg-dumpall.html", "description": "Print the pg_dumpall version and exit."}, {"names": ["-x", "--no-privileges", "--no-acl"], "summary": "Prevent dumping of access privileges (grant/revoke commands).", "signature": "-x --no-privileges --no-acl", "source_url": "/docs/17/app-pg-dumpall.html", "description": "Prevent dumping of access privileges (grant/revoke commands)."}, {"names": ["--binary-upgrade"], "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": "--binary-upgrade", "source_url": "/docs/17/app-pg-dumpall.html", "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": ["--column-inserts", "--attribute-inserts"], "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": "--column-inserts --attribute-inserts", "source_url": "/docs/17/app-pg-dumpall.html", "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": ["--disable-dollar-quoting"], "summary": "This option disables the use of dollar quoting for function bodies, and forces them to be quoted using SQL standard string syntax.", "signature": "--disable-dollar-quoting", "source_url": "/docs/17/app-pg-dumpall.html", "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-triggers"], "summary": "This option is relevant only when creating a data-only dump. 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": "--disable-triggers", "source_url": "/docs/17/app-pg-dumpall.html", "description": "This option is relevant only when creating a data-only dump. 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": ["--exclude-database= pattern"], "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": "--exclude-database= pattern", "source_url": "/docs/17/app-pg-dumpall.html", "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": ["--extra-float-digits= ndigits"], "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": "--extra-float-digits= ndigits", "source_url": "/docs/17/app-pg-dumpall.html", "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": ["--if-exists"], "summary": "Use DROP ... IF EXISTS commands to drop objects in --clean mode. This suppresses \u201c does not exist \u201d errors that might otherwise be reported. This option is not valid unless --clean is also specified.", "signature": "--if-exists", "source_url": "/docs/17/app-pg-dumpall.html", "description": "Use DROP ... IF EXISTS commands to drop objects in --clean mode. This suppresses \u201c does not exist \u201d errors that might otherwise be reported. This option is not valid unless --clean is also specified."}, {"names": ["--inserts"], "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": "--inserts", "source_url": "/docs/17/app-pg-dumpall.html", "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": ["--load-via-partition-root"], "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": "--load-via-partition-root", "source_url": "/docs/17/app-pg-dumpall.html", "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": ["--lock-wait-timeout= timeout"], "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": "--lock-wait-timeout= timeout", "source_url": "/docs/17/app-pg-dumpall.html", "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": ["--no-comments"], "summary": "Do not dump comments.", "signature": "--no-comments", "source_url": "/docs/17/app-pg-dumpall.html", "description": "Do not dump comments."}, {"names": ["--no-publications"], "summary": "Do not dump publications.", "signature": "--no-publications", "source_url": "/docs/17/app-pg-dumpall.html", "description": "Do not dump publications."}, {"names": ["--no-role-passwords"], "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": "--no-role-passwords", "source_url": "/docs/17/app-pg-dumpall.html", "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-security-labels"], "summary": "Do not dump security labels.", "signature": "--no-security-labels", "source_url": "/docs/17/app-pg-dumpall.html", "description": "Do not dump security labels."}, {"names": ["--no-subscriptions"], "summary": "Do not dump subscriptions.", "signature": "--no-subscriptions", "source_url": "/docs/17/app-pg-dumpall.html", "description": "Do not dump subscriptions."}, {"names": ["--no-sync"], "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": "--no-sync", "source_url": "/docs/17/app-pg-dumpall.html", "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-table-access-method"], "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": "--no-table-access-method", "source_url": "/docs/17/app-pg-dumpall.html", "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-tablespaces"], "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": "--no-tablespaces", "source_url": "/docs/17/app-pg-dumpall.html", "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-toast-compression"], "summary": "Do not output commands to set TOAST compression methods. With this option, all columns will be restored with the default compression setting.", "signature": "--no-toast-compression", "source_url": "/docs/17/app-pg-dumpall.html", "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-unlogged-table-data"], "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": "--no-unlogged-table-data", "source_url": "/docs/17/app-pg-dumpall.html", "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": ["--on-conflict-do-nothing"], "summary": "Add ON CONFLICT DO NOTHING to INSERT commands. This option is not valid unless --inserts or --column-inserts is also specified.", "signature": "--on-conflict-do-nothing", "source_url": "/docs/17/app-pg-dumpall.html", "description": "Add ON CONFLICT DO NOTHING to INSERT commands. This option is not valid unless --inserts or --column-inserts is also specified."}, {"names": ["--quote-all-identifiers"], "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": "--quote-all-identifiers", "source_url": "/docs/17/app-pg-dumpall.html", "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": ["--restrict-key= restrict_key"], "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": "--restrict-key= restrict_key", "source_url": "/docs/17/app-pg-dumpall.html", "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": ["--rows-per-insert= nrows"], "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": "--rows-per-insert= nrows", "source_url": "/docs/17/app-pg-dumpall.html", "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": ["--use-set-session-authorization"], "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": "--use-set-session-authorization", "source_url": "/docs/17/app-pg-dumpall.html", "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": ["-?", "--help"], "summary": "Show help about pg_dumpall command line arguments, and exit.", "signature": "-? --help", "source_url": "/docs/17/app-pg-dumpall.html", "description": "Show help about pg_dumpall command line arguments, and exit."}, {"names": ["-d connstr", "--dbname= connstr"], "summary": "Specifies parameters used to connect to the server, as a connection string ; these will override any conflicting command line options.", "signature": "-d connstr --dbname= connstr", "source_url": "/docs/17/app-pg-dumpall.html", "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": ["-h host", "--host= host"], "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": "-h host --host= host", "source_url": "/docs/17/app-pg-dumpall.html", "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": ["-l dbname", "--database= dbname"], "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": "-l dbname --database= dbname", "source_url": "/docs/17/app-pg-dumpall.html", "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": ["-p port", "--port= port"], "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": "-p port --port= port", "source_url": "/docs/17/app-pg-dumpall.html", "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": ["-U username", "--username= username"], "summary": "User name to connect as.", "signature": "-U username --username= username", "source_url": "/docs/17/app-pg-dumpall.html", "description": "User name to connect as."}, {"names": ["-w", "--no-password"], "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": "-w --no-password", "source_url": "/docs/17/app-pg-dumpall.html", "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", "--password"], "summary": "Force pg_dumpall to prompt for a password before connecting to a database.", "signature": "-W --password", "source_url": "/docs/17/app-pg-dumpall.html", "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": ["--role= rolename"], "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.", "signature": "--role= rolename", "source_url": "/docs/17/app-pg-dumpall.html", "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."}], "related": [{"url": "/wiki/conn/?v=17", "label": "libpq connection parameters"}], "release": {"ref": "https://ftp.postgresql.org/pub/source/v17.11/postgresql-17.11.tar.bz2", "label": "17.11", "major": "17", "channel": "stable", "manifest": {"pdf": {"A4": {"url": "/files/documentation/pdf/17/postgresql-17-A4.pdf", "bytes": 15521293, "pages": 3099, "sha256": "1991354df0dc89e70ec39328c28988ef8b19c6a93671dab3893650b63e9f4e36", "built_at": "2026-09-26"}, "US": {"url": "/files/documentation/pdf/17/postgresql-17-US.pdf", "bytes": 15398150, "pages": 3270, "sha256": "07696c8f38abf31babf22d2db337093936e7c472d2af36d050b000c49bbcf52c", "built_at": "2026-09-26"}}, "tree": "17", "index": "index.html", "major": "17", "pages": 1143, "release": "17.11", "source_url": "https://ftp.postgresql.org/pub/source/v17.11/postgresql-17.11.tar.bz2", "svg_assets": 3, "source_mode": "en SGML built with pinned official archive", "source_sha256": "dd27f2b3c59e73ed14aa3324901242bf69a032a6347805f274e6260322d42979"}, "revision": "58419c9b0dd42cb34c8d53695bb025a7e582edf55ccd4c5bcb1c2c7c71a37487", "evidence_kind": "English manual and source declarations", "source_sha256": "dd27f2b3c59e73ed14aa3324901242bf69a032a6347805f274e6260322d42979"}, "sources": [{"url": "/docs/17/app-pg-dumpall.html", "file": "app-pg-dumpall.html", "label": "17.11 English manual \u00b7 app-pg-dumpall.html", "anchor": "", "sha256": "132208181c2b65230d604e9aef9d6e740b89d693a7438e7253af6634a39372dc"}, {"url": "/docs/17/reference-client.html", "file": "reference-client.html", "label": "Client applications inventory", "anchor": "", "sha256": "3194fc72ddad8e2fcba55f8e007f83413cb352146cb65aaa9457a18d0314ee1b"}], "sections": [], "synopsis": ["pg_dumpall [ connection-option ...] [ option ...]"], "signature": "pg_dumpall [ connection-option ...] [ option ...]", "description": ["pg_dumpall \u2014 extract a PostgreSQL database cluster into a script file"], "environment": [{"name": "PGHOST PGOPTIONS PGPORT PGUSER", "description": "Default connection parameters"}, {"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}], "manual_html": "<div><div class=\"refentry\" id=\"APP-PG-DUMPALL\">\n<div class=\"titlepage\"></div>\n<div class=\"refnamediv\">\n<h2><span class=\"refentrytitle\"><span class=\"application\">pg_dumpall</span></span></h2>\n<p>pg_dumpall \u2014 extract a <span class=\"productname\">PostgreSQL</span> database cluster into a script file</p>\n</div>\n<div class=\"refsynopsisdiv\">\n<h2>Synopsis</h2>\n<div class=\"cmdsynopsis\">\n<p id=\"id-1.9.4.15.4.1\"><code class=\"command\">pg_dumpall</code> [<em class=\"replaceable\"><code>connection-option</code></em>...] [<em class=\"replaceable\"><code>option</code></em>...]</p>\n</div>\n</div>\n<div class=\"refsect1\" id=\"APP-PG-DUMPALL-DESCRIPTION\">\n<h2>Description</h2>\n<p><span class=\"application\">pg_dumpall</span> is a utility for writing out (<span class=\"quote\">\u201c<span class=\"quote\">dumping</span>\u201d</span>) all <span class=\"productname\">PostgreSQL</span> databases of a cluster into one script file. The script file contains SQL commands that can be used as input to <a class=\"xref\" href=\"/docs/17/app-psql.html\" title=\"psql\"><span class=\"refentrytitle\"><span class=\"application\">psql</span></span></a> to restore the databases. It does this by calling <a class=\"xref\" href=\"/docs/17/app-pgdump.html\" title=\"pg_dump\"><span class=\"refentrytitle\"><span class=\"application\">pg_dump</span></span></a> for each database in the cluster. <span class=\"application\">pg_dumpall</span> also dumps global objects that are common to all databases, namely database roles, tablespaces, and privilege grants for configuration parameters. (<span class=\"application\">pg_dump</span> does not save these objects.)</p>\n<p>Since <span class=\"application\">pg_dumpall</span> 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.</p>\n<p>The SQL script will be written to the standard output. Use the <code class=\"option\">-f</code>/<code class=\"option\">--file</code> option or shell operators to redirect it into a file.</p>\n<p><span class=\"application\">pg_dumpall</span> needs to connect several times to the <span class=\"productname\">PostgreSQL</span> server (once per database). If you use password authentication it will ask for a password each time. It is convenient to have a <code class=\"filename\">~/.pgpass</code> file in such cases. See <a class=\"xref\" href=\"/docs/17/libpq-pgpass.html\" title=\"32.16.\u00a0The Password File\">Section\u00a032.16</a> for more information.</p>\n<div class=\"warning\">\n<h3 class=\"title\">Warning</h3>\n<p>Restoring 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.</p>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.15.6\">\n<h2>Options</h2>\n<p>The following command-line options control the content and format of the output.</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-a</code><br></span><span class=\"term\"><code class=\"option\">--data-only</code></span></dt>\n<dd>\n<p>Dump only the data, not the schema (data definitions).</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-c</code><br></span><span class=\"term\"><code class=\"option\">--clean</code></span></dt>\n<dd>\n<p>Emit SQL commands to <code class=\"command\">DROP</code> 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 <code class=\"option\">--if-exists</code> is also specified.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-E <em class=\"replaceable\"><code>encoding</code></em></code><br></span><span class=\"term\"><code class=\"option\">--encoding=<em class=\"replaceable\"><code>encoding</code></em></code></span></dt>\n<dd>\n<p>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 <code class=\"envar\">PGCLIENTENCODING</code> environment variable to the desired dump encoding.)</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-f <em class=\"replaceable\"><code>filename</code></em></code><br></span><span class=\"term\"><code class=\"option\">--file=<em class=\"replaceable\"><code>filename</code></em></code></span></dt>\n<dd>\n<p>Send output to the specified file. If this is omitted, the standard output is used.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--filter=<em class=\"replaceable\"><code>filename</code></em></code></span></dt>\n<dd>\n<p>Specify a filename from which to read patterns for databases excluded from the dump. The patterns are interpreted according to the same rules as <code class=\"option\">--exclude-database</code>. To read from <code class=\"literal\">STDIN</code>, use <code class=\"filename\">-</code> as the filename. The <code class=\"option\">--filter</code> option can be specified in conjunction with <code class=\"option\">--exclude-database</code> for excluding databases, and can also be specified more than once for multiple filter files.</p>\n<p>The file lists one database pattern per row, with the following format:</p>\n<pre class=\"synopsis\">exclude database <em class=\"replaceable\"><code>PATTERN</code></em>\n</pre>\n<p>Lines starting with <code class=\"literal\">#</code> are considered comments and ignored. Comments can be placed after an object pattern row as well. Blank lines are also ignored. See <a class=\"xref\" href=\"/docs/17/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\">Patterns</a> for how to perform quoting in patterns.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-g</code><br></span><span class=\"term\"><code class=\"option\">--globals-only</code></span></dt>\n<dd>\n<p>Dump only global objects (roles and tablespaces), no databases.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-O</code><br></span><span class=\"term\"><code class=\"option\">--no-owner</code></span></dt>\n<dd>\n<p>Do not output commands to set ownership of objects to match the original database. By default, <span class=\"application\">pg_dumpall</span> issues <code class=\"command\">ALTER OWNER</code> or <code class=\"command\">SET SESSION AUTHORIZATION</code> 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 <code class=\"option\">-O</code>.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-r</code><br></span><span class=\"term\"><code class=\"option\">--roles-only</code></span></dt>\n<dd>\n<p>Dump only roles, no databases or tablespaces.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-s</code><br></span><span class=\"term\"><code class=\"option\">--schema-only</code></span></dt>\n<dd>\n<p>Dump only the object definitions (schema), not data.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-S <em class=\"replaceable\"><code>username</code></em></code><br></span><span class=\"term\"><code class=\"option\">--superuser=<em class=\"replaceable\"><code>username</code></em></code></span></dt>\n<dd>\n<p>Specify the superuser user name to use when disabling triggers. This is relevant only if <code class=\"option\">--disable-triggers</code> is used. (Usually, it's better to leave this out, and instead start the resulting script as superuser.)</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-t</code><br></span><span class=\"term\"><code class=\"option\">--tablespaces-only</code></span></dt>\n<dd>\n<p>Dump only tablespaces, no databases or roles.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-v</code><br></span><span class=\"term\"><code class=\"option\">--verbose</code></span></dt>\n<dd>\n<p>Specifies verbose mode. This will cause <span class=\"application\">pg_dumpall</span> 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 <span class=\"application\">pg_dump</span>.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-V</code><br></span><span class=\"term\"><code class=\"option\">--version</code></span></dt>\n<dd>\n<p>Print the <span class=\"application\">pg_dumpall</span> version and exit.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-x</code><br></span><span class=\"term\"><code class=\"option\">--no-privileges</code><br></span><span class=\"term\"><code class=\"option\">--no-acl</code></span></dt>\n<dd>\n<p>Prevent dumping of access privileges (grant/revoke commands).</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--binary-upgrade</code></span></dt>\n<dd>\n<p>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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--column-inserts</code><br></span><span class=\"term\"><code class=\"option\">--attribute-inserts</code></span></dt>\n<dd>\n<p>Dump data as <code class=\"command\">INSERT</code> commands with explicit column names (<code class=\"literal\">INSERT INTO <em class=\"replaceable\"><code>table</code></em> (<em class=\"replaceable\"><code>column</code></em>, ...) VALUES ...</code>). This will make restoration very slow; it is mainly useful for making dumps that can be loaded into non-<span class=\"productname\">PostgreSQL</span> databases.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--disable-dollar-quoting</code></span></dt>\n<dd>\n<p>This option disables the use of dollar quoting for function bodies, and forces them to be quoted using SQL standard string syntax.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--disable-triggers</code></span></dt>\n<dd>\n<p>This option is relevant only when creating a data-only dump. It instructs <span class=\"application\">pg_dumpall</span> 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.</p>\n<p>Presently, the commands emitted for <code class=\"option\">--disable-triggers</code> must be done as superuser. So, you should also specify a superuser name with <code class=\"option\">-S</code>, or preferably be careful to start the resulting script as a superuser.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--exclude-database=<em class=\"replaceable\"><code>pattern</code></em></code></span></dt>\n<dd>\n<p>Do not dump databases whose name matches <em class=\"replaceable\"><code>pattern</code></em>. Multiple patterns can be excluded by writing multiple <code class=\"option\">--exclude-database</code> switches. The <em class=\"replaceable\"><code>pattern</code></em> parameter is interpreted as a pattern according to the same rules used by <span class=\"application\">psql</span>'s <code class=\"literal\">\\d</code> commands (see <a class=\"xref\" href=\"/docs/17/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\">Patterns</a>), 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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--extra-float-digits=<em class=\"replaceable\"><code>ndigits</code></em></code></span></dt>\n<dd>\n<p>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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--if-exists</code></span></dt>\n<dd>\n<p>Use <code class=\"literal\">DROP ... IF EXISTS</code> commands to drop objects in <code class=\"option\">--clean</code> mode. This suppresses <span class=\"quote\">\u201c<span class=\"quote\">does not exist</span>\u201d</span> errors that might otherwise be reported. This option is not valid unless <code class=\"option\">--clean</code> is also specified.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--inserts</code></span></dt>\n<dd>\n<p>Dump data as <code class=\"command\">INSERT</code> commands (rather than <code class=\"command\">COPY</code>). This will make restoration very slow; it is mainly useful for making dumps that can be loaded into non-<span class=\"productname\">PostgreSQL</span> databases. Note that the restore might fail altogether if you have rearranged column order. The <code class=\"option\">--column-inserts</code> option is safer, though even slower.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--load-via-partition-root</code></span></dt>\n<dd>\n<p>When dumping data for a table partition, make the <code class=\"command\">COPY</code> or <code class=\"command\">INSERT</code> 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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--lock-wait-timeout=<em class=\"replaceable\"><code>timeout</code></em></code></span></dt>\n<dd>\n<p>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 <em class=\"replaceable\"><code>timeout</code></em>. The timeout may be specified in any of the formats accepted by <code class=\"command\">SET statement_timeout</code>.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-comments</code></span></dt>\n<dd>\n<p>Do not dump comments.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-publications</code></span></dt>\n<dd>\n<p>Do not dump publications.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-role-passwords</code></span></dt>\n<dd>\n<p>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 <code class=\"structname\">pg_roles</code> instead of <code class=\"structname\">pg_authid</code>. Therefore, this option also helps if access to <code class=\"structname\">pg_authid</code> is restricted by some security policy.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-security-labels</code></span></dt>\n<dd>\n<p>Do not dump security labels.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-subscriptions</code></span></dt>\n<dd>\n<p>Do not dump subscriptions.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-sync</code></span></dt>\n<dd>\n<p>By default, <code class=\"command\">pg_dumpall</code> will wait for all files to be written safely to disk. This option causes <code class=\"command\">pg_dumpall</code> 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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-table-access-method</code></span></dt>\n<dd>\n<p>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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-tablespaces</code></span></dt>\n<dd>\n<p>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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-toast-compression</code></span></dt>\n<dd>\n<p>Do not output commands to set TOAST compression methods. With this option, all columns will be restored with the default compression setting.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-unlogged-table-data</code></span></dt>\n<dd>\n<p>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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--on-conflict-do-nothing</code></span></dt>\n<dd>\n<p>Add <code class=\"literal\">ON CONFLICT DO NOTHING</code> to <code class=\"command\">INSERT</code> commands. This option is not valid unless <code class=\"option\">--inserts</code> or <code class=\"option\">--column-inserts</code> is also specified.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--quote-all-identifiers</code></span></dt>\n<dd>\n<p>Force quoting of all identifiers. This option is recommended when dumping a database from a server whose <span class=\"productname\">PostgreSQL</span> major version is different from <span class=\"application\">pg_dumpall</span>'s, or when the output is intended to be loaded into a server of a different major version. By default, <span class=\"application\">pg_dumpall</span> 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 <code class=\"option\">--quote-all-identifiers</code> prevents such issues, at the price of a harder-to-read dump script.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--restrict-key=<em class=\"replaceable\"><code>restrict_key</code></em></code></span></dt>\n<dd>\n<p>Use the provided string as the <span class=\"application\">psql</span> <code class=\"command\">\\restrict</code> key in the dump output. If no restrict key is specified, <span class=\"application\">pg_dumpall</span> will generate a random one as needed. Keys may contain only alphanumeric characters.</p>\n<p>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 <span class=\"application\">psql</span> with the dump output.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--rows-per-insert=<em class=\"replaceable\"><code>nrows</code></em></code></span></dt>\n<dd>\n<p>Dump data as <code class=\"command\">INSERT</code> commands (rather than <code class=\"command\">COPY</code>). Controls the maximum number of rows per <code class=\"command\">INSERT</code> 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 <code class=\"command\">INSERT</code> to be lost, rather than the entire table contents.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--use-set-session-authorization</code></span></dt>\n<dd>\n<p>Output SQL-standard <code class=\"command\">SET SESSION AUTHORIZATION</code> commands instead of <code class=\"command\">ALTER OWNER</code> 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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-?</code><br></span><span class=\"term\"><code class=\"option\">--help</code></span></dt>\n<dd>\n<p>Show help about <span class=\"application\">pg_dumpall</span> command line arguments, and exit.</p>\n</dd>\n</dl>\n</div>\n<p>The following command-line options control the database connection parameters.</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-d <em class=\"replaceable\"><code>connstr</code></em></code><br></span><span class=\"term\"><code class=\"option\">--dbname=<em class=\"replaceable\"><code>connstr</code></em></code></span></dt>\n<dd>\n<p>Specifies parameters used to connect to the server, as a <a class=\"link\" href=\"/docs/17/libpq-connect.html#LIBPQ-CONNSTRING\" title=\"32.1.1.\u00a0Connection Strings\">connection string</a>; these will override any conflicting command line options.</p>\n<p>The option is called <code class=\"literal\">--dbname</code> for consistency with other client applications, but because <span class=\"application\">pg_dumpall</span> needs to connect to many databases, the database name in the connection string will be ignored. Use the <code class=\"literal\">-l</code> 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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-h <em class=\"replaceable\"><code>host</code></em></code><br></span><span class=\"term\"><code class=\"option\">--host=<em class=\"replaceable\"><code>host</code></em></code></span></dt>\n<dd>\n<p>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 <code class=\"envar\">PGHOST</code> environment variable, if set, else a Unix domain socket connection is attempted.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-l <em class=\"replaceable\"><code>dbname</code></em></code><br></span><span class=\"term\"><code class=\"option\">--database=<em class=\"replaceable\"><code>dbname</code></em></code></span></dt>\n<dd>\n<p>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 <code class=\"literal\">postgres</code> database will be used, and if that does not exist, <code class=\"literal\">template1</code> will be used.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-p <em class=\"replaceable\"><code>port</code></em></code><br></span><span class=\"term\"><code class=\"option\">--port=<em class=\"replaceable\"><code>port</code></em></code></span></dt>\n<dd>\n<p>Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the <code class=\"envar\">PGPORT</code> environment variable, if set, or a compiled-in default.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-U <em class=\"replaceable\"><code>username</code></em></code><br></span><span class=\"term\"><code class=\"option\">--username=<em class=\"replaceable\"><code>username</code></em></code></span></dt>\n<dd>\n<p>User name to connect as.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-w</code><br></span><span class=\"term\"><code class=\"option\">--no-password</code></span></dt>\n<dd>\n<p>Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a <code class=\"filename\">.pgpass</code> 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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-W</code><br></span><span class=\"term\"><code class=\"option\">--password</code></span></dt>\n<dd>\n<p>Force <span class=\"application\">pg_dumpall</span> to prompt for a password before connecting to a database.</p>\n<p>This option is never essential, since <span class=\"application\">pg_dumpall</span> will automatically prompt for a password if the server demands password authentication. However, <span class=\"application\">pg_dumpall</span> will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing <code class=\"option\">-W</code> to avoid the extra connection attempt.</p>\n<p>Note that the password prompt will occur again for each database to be dumped. Usually, it's better to set up a <code class=\"filename\">~/.pgpass</code> file than to rely on manual password entry.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--role=<em class=\"replaceable\"><code>rolename</code></em></code></span></dt>\n<dd>\n<p>Specifies a role name to be used to create the dump. This option causes <span class=\"application\">pg_dumpall</span> to issue a <code class=\"command\">SET ROLE</code> <em class=\"replaceable\"><code>rolename</code></em> command after connecting to the database. It is useful when the authenticated user (specified by <code class=\"option\">-U</code>) lacks privileges needed by <span class=\"application\">pg_dumpall</span>, 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.</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.15.7\">\n<h2>Environment</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"envar\">PGHOST</code><br></span><span class=\"term\"><code class=\"envar\">PGOPTIONS</code><br></span><span class=\"term\"><code class=\"envar\">PGPORT</code><br></span><span class=\"term\"><code class=\"envar\">PGUSER</code></span></dt>\n<dd>\n<p>Default connection parameters</p>\n</dd>\n<dt><span class=\"term\"><code class=\"envar\">PG_COLOR</code></span></dt>\n<dd>\n<p>Specifies whether to use color in diagnostic messages. Possible values are <code class=\"literal\">always</code>, <code class=\"literal\">auto</code> and <code class=\"literal\">never</code>.</p>\n</dd>\n</dl>\n</div>\n<p>This utility, like most other <span class=\"productname\">PostgreSQL</span> utilities, also uses the environment variables supported by <span class=\"application\">libpq</span> (see <a class=\"xref\" href=\"/docs/17/libpq-envars.html\" title=\"32.15.\u00a0Environment Variables\">Section\u00a032.15</a>).</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.15.8\">\n<h2>Notes</h2>\n<p>Since <span class=\"application\">pg_dumpall</span> calls <span class=\"application\">pg_dump</span> internally, some diagnostic messages will refer to <span class=\"application\">pg_dump</span>.</p>\n<p>The <code class=\"option\">--clean</code> option can be useful even when your intention is to restore the dump script into a fresh cluster. Use of <code class=\"option\">--clean</code> authorizes the script to drop and re-create the built-in <code class=\"literal\">postgres</code> and <code class=\"literal\">template1</code> 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.</p>\n<p>Once restored, it is wise to run <code class=\"command\">ANALYZE</code> on each database so the optimizer has useful statistics. You can also run <code class=\"command\">vacuumdb -a -z</code> to analyze all databases.</p>\n<p>The dump script should not be expected to run completely without errors. In particular, because the script will issue <code class=\"command\">CREATE ROLE</code> for every role existing in the source cluster, it is certain to get a <span class=\"quote\">\u201c<span class=\"quote\">role already exists</span>\u201d</span> 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 <code class=\"option\">--clean</code> option is likely to produce additional harmless error messages about non-existent objects, although you can minimize those by adding <code class=\"option\">--if-exists</code>.</p>\n<p><span class=\"application\">pg_dumpall</span> requires all needed tablespace directories to exist before the restore; otherwise, database creation will fail for databases in non-default locations.</p>\n<p>It is generally recommended to use the <code class=\"option\">-X</code> (<code class=\"option\">--no-psqlrc</code>) option when restoring a database from a <span class=\"application\">pg_dumpall</span> script to ensure a clean restore process and prevent potential conflicts with non-default <span class=\"application\">psql</span> configurations. Additionally, because the <span class=\"application\">pg_dumpall</span> script may include <span class=\"application\">psql</span> meta-commands, it may be incompatible with clients other than <span class=\"application\">psql</span>.</p>\n</div>\n<div class=\"refsect1\" id=\"APP-PG-DUMPALL-EX\">\n<h2>Examples</h2>\n<p>To dump all databases:</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_dumpall &gt; db.out</code></strong>\n</pre>\n<p>To restore database(s) from this file, you can use:</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>psql -X -f db.out -d postgres</code></strong>\n</pre>\n<p>It is not important which database you connect to here since the script file created by <span class=\"application\">pg_dumpall</span> will contain the appropriate commands to create and connect to the saved databases. An exception is that if you specified <code class=\"option\">--clean</code>, you must connect to the <code class=\"literal\">postgres</code> database initially; the script will attempt to drop other databases immediately, and that will fail for the database you are connected to.</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.15.10\">\n<h2>See Also</h2>\n<p>Check <a class=\"xref\" href=\"/docs/17/app-pgdump.html\" title=\"pg_dump\"><span class=\"refentrytitle\"><span class=\"application\">pg_dump</span></span></a> for details on possible error conditions.</p>\n</div>\n</div></div>", "manual_path": "app-pg-dumpall.html", "comparison_data": {"options": [{"names": ["-a", "--data-only"], "signature": "-a --data-only", "description": "Dump only the data, not the schema (data definitions)."}, {"names": ["-c", "--clean"], "signature": "-c --clean", "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": ["-E encoding", "--encoding= encoding"], "signature": "-E encoding --encoding= encoding", "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": ["-f filename", "--file= filename"], "signature": "-f filename --file= filename", "description": "Send output to the specified file. If this is omitted, the standard output is used."}, {"names": ["--filter= filename"], "signature": "--filter= filename", "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": ["-g", "--globals-only"], "signature": "-g --globals-only", "description": "Dump only global objects (roles and tablespaces), no databases."}, {"names": ["-O", "--no-owner"], "signature": "-O --no-owner", "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": ["-r", "--roles-only"], "signature": "-r --roles-only", "description": "Dump only roles, no databases or tablespaces."}, {"names": ["-s", "--schema-only"], "signature": "-s --schema-only", "description": "Dump only the object definitions (schema), not data."}, {"names": ["-S username", "--superuser= username"], "signature": "-S username --superuser= username", "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": ["-t", "--tablespaces-only"], "signature": "-t --tablespaces-only", "description": "Dump only tablespaces, no databases or roles."}, {"names": ["-v", "--verbose"], "signature": "-v --verbose", "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", "--version"], "signature": "-V --version", "description": "Print the pg_dumpall version and exit."}, {"names": ["-x", "--no-privileges", "--no-acl"], "signature": "-x --no-privileges --no-acl", "description": "Prevent dumping of access privileges (grant/revoke commands)."}, {"names": ["--binary-upgrade"], "signature": "--binary-upgrade", "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": ["--column-inserts", "--attribute-inserts"], "signature": "--column-inserts --attribute-inserts", "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": ["--disable-dollar-quoting"], "signature": "--disable-dollar-quoting", "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-triggers"], "signature": "--disable-triggers", "description": "This option is relevant only when creating a data-only dump. 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": ["--exclude-database= pattern"], "signature": "--exclude-database= pattern", "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": ["--extra-float-digits= ndigits"], "signature": "--extra-float-digits= ndigits", "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": ["--if-exists"], "signature": "--if-exists", "description": "Use DROP ... IF EXISTS commands to drop objects in --clean mode. This suppresses \u201c does not exist \u201d errors that might otherwise be reported. This option is not valid unless --clean is also specified."}, {"names": ["--inserts"], "signature": "--inserts", "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": ["--load-via-partition-root"], "signature": "--load-via-partition-root", "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": ["--lock-wait-timeout= timeout"], "signature": "--lock-wait-timeout= timeout", "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": ["--no-comments"], "signature": "--no-comments", "description": "Do not dump comments."}, {"names": ["--no-publications"], "signature": "--no-publications", "description": "Do not dump publications."}, {"names": ["--no-role-passwords"], "signature": "--no-role-passwords", "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-security-labels"], "signature": "--no-security-labels", "description": "Do not dump security labels."}, {"names": ["--no-subscriptions"], "signature": "--no-subscriptions", "description": "Do not dump subscriptions."}, {"names": ["--no-sync"], "signature": "--no-sync", "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-table-access-method"], "signature": "--no-table-access-method", "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-tablespaces"], "signature": "--no-tablespaces", "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-toast-compression"], "signature": "--no-toast-compression", "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-unlogged-table-data"], "signature": "--no-unlogged-table-data", "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": ["--on-conflict-do-nothing"], "signature": "--on-conflict-do-nothing", "description": "Add ON CONFLICT DO NOTHING to INSERT commands. This option is not valid unless --inserts or --column-inserts is also specified."}, {"names": ["--quote-all-identifiers"], "signature": "--quote-all-identifiers", "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": ["--restrict-key= restrict_key"], "signature": "--restrict-key= restrict_key", "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": ["--rows-per-insert= nrows"], "signature": "--rows-per-insert= nrows", "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": ["--use-set-session-authorization"], "signature": "--use-set-session-authorization", "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": ["-?", "--help"], "signature": "-? --help", "description": "Show help about pg_dumpall command line arguments, and exit."}, {"names": ["-d connstr", "--dbname= connstr"], "signature": "-d connstr --dbname= connstr", "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": ["-h host", "--host= host"], "signature": "-h host --host= host", "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": ["-l dbname", "--database= dbname"], "signature": "-l dbname --database= dbname", "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": ["-p port", "--port= port"], "signature": "-p port --port= port", "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": ["-U username", "--username= username"], "signature": "-U username --username= username", "description": "User name to connect as."}, {"names": ["-w", "--no-password"], "signature": "-w --no-password", "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", "--password"], "signature": "-W --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": ["--role= rolename"], "signature": "--role= rolename", "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."}], "synopsis": ["pg_dumpall [ connection-option ...] [ option ...]"], "environment": [{"name": "PGHOST PGOPTIONS PGPORT PGUSER", "description": "Default connection parameters"}, {"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}]}, "comparison_hash": "63c7fcb8cf8d3e6a1293d93963fad4075ec2f12c569252cde447513380998e45"}, "18": {"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"}], "tables": [{"key": "options", "rows": [{"summary": "Dump only the data, not the schema (data definitions) or statistics.", "signature": {"url": "/docs/18/app-pg-dumpall.html", "text": "-a --data-only"}}, {"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": {"url": "/docs/18/app-pg-dumpall.html", "text": "-c --clean"}}, {"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": {"url": "/docs/18/app-pg-dumpall.html", "text": "-E encoding --encoding= encoding"}}, {"summary": "Send output to the specified file. If this is omitted, the standard output is used.", "signature": {"url": "/docs/18/app-pg-dumpall.html", "text": "-f filename --file= filename"}}, {"summary": "Dump only global objects (roles and tablespaces), no databases.", "signature": {"url": "/docs/18/app-pg-dumpall.html", "text": "-g --globals-only"}}, {"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": {"url": "/docs/18/app-pg-dumpall.html", "text": "-O --no-owner"}}, {"summary": "Dump only roles, no databases or tablespaces.", "signature": {"url": "/docs/18/app-pg-dumpall.html", "text": "-r --roles-only"}}, {"summary": "Dump only the object definitions (schema), not data.", "signature": {"url": "/docs/18/app-pg-dumpall.html", "text": "-s --schema-only"}}, {"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": {"url": "/docs/18/app-pg-dumpall.html", "text": "-S username --superuser= username"}}, {"summary": "Dump only tablespaces, no databases or roles.", "signature": {"url": "/docs/18/app-pg-dumpall.html", "text": "-t --tablespaces-only"}}, {"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": {"url": "/docs/18/app-pg-dumpall.html", "text": "-v --verbose"}}, {"summary": "Print the pg_dumpall version and exit.", "signature": {"url": "/docs/18/app-pg-dumpall.html", "text": "-V --version"}}, {"summary": "Prevent dumping of access privileges (grant/revoke commands).", "signature": {"url": "/docs/18/app-pg-dumpall.html", "text": "-x --no-privileges --no-acl"}}, {"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": {"url": "/docs/18/app-pg-dumpall.html", "text": "--binary-upgrade"}}, {"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": {"url": "/docs/18/app-pg-dumpall.html", "text": "--column-inserts --attribute-inserts"}}, {"summary": "This option disables the use of dollar quoting for function bodies, and forces them to be quoted using SQL standard string syntax.", "signature": {"url": "/docs/18/app-pg-dumpall.html", "text": "--disable-dollar-quoting"}}, {"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": {"url": "/docs/18/app-pg-dumpall.html", "text": "--disable-triggers"}}, {"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": {"url": "/docs/18/app-pg-dumpall.html", "text": "--exclude-database= pattern"}}, {"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": {"url": "/docs/18/app-pg-dumpall.html", "text": "--extra-float-digits= ndigits"}}, {"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": {"url": "/docs/18/app-pg-dumpall.html", "text": "--filter= filename"}}, {"summary": "Use DROP ... IF EXISTS commands to drop objects in --clean mode. This suppresses \u201c does not exist \u201d errors that might otherwise be reported. This option is not valid unless --clean is also specified.", "signature": {"url": "/docs/18/app-pg-dumpall.html", "text": "--if-exists"}}, {"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": {"url": "/docs/18/app-pg-dumpall.html", "text": "--inserts"}}, {"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": {"url": "/docs/18/app-pg-dumpall.html", "text": "--load-via-partition-root"}}, {"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": {"url": "/docs/18/app-pg-dumpall.html", "text": "--lock-wait-timeout= timeout"}}, {"summary": "Do not dump COMMENT commands.", "signature": {"url": "/docs/18/app-pg-dumpall.html", "text": "--no-comments"}}, {"summary": "Do not dump data.", "signature": {"url": "/docs/18/app-pg-dumpall.html", "text": "--no-data"}}, {"summary": "Do not dump row security policies.", "signature": {"url": "/docs/18/app-pg-dumpall.html", "text": "--no-policies"}}, {"summary": "Do not dump publications.", "signature": {"url": "/docs/18/app-pg-dumpall.html", "text": "--no-publications"}}, {"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": {"url": "/docs/18/app-pg-dumpall.html", "text": "--no-role-passwords"}}, {"summary": "Do not dump schema (data definitions).", "signature": {"url": "/docs/18/app-pg-dumpall.html", "text": "--no-schema"}}, {"summary": "Do not dump security labels.", "signature": {"url": "/docs/18/app-pg-dumpall.html", "text": "--no-security-labels"}}, {"summary": "Do not dump statistics. This is the default.", "signature": {"url": "/docs/18/app-pg-dumpall.html", "text": "--no-statistics"}}, {"summary": "Do not dump subscriptions.", "signature": {"url": "/docs/18/app-pg-dumpall.html", "text": "--no-subscriptions"}}, {"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": {"url": "/docs/18/app-pg-dumpall.html", "text": "--no-sync"}}, {"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": {"url": "/docs/18/app-pg-dumpall.html", "text": "--no-table-access-method"}}, {"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": {"url": "/docs/18/app-pg-dumpall.html", "text": "--no-tablespaces"}}, {"summary": "Do not output commands to set TOAST compression methods. With this option, all columns will be restored with the default compression setting.", "signature": {"url": "/docs/18/app-pg-dumpall.html", "text": "--no-toast-compression"}}, {"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": {"url": "/docs/18/app-pg-dumpall.html", "text": "--no-unlogged-table-data"}}, {"summary": "Add ON CONFLICT DO NOTHING to INSERT commands. This option is not valid unless --inserts or --column-inserts is also specified.", "signature": {"url": "/docs/18/app-pg-dumpall.html", "text": "--on-conflict-do-nothing"}}, {"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": {"url": "/docs/18/app-pg-dumpall.html", "text": "--quote-all-identifiers"}}, {"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": {"url": "/docs/18/app-pg-dumpall.html", "text": "--restrict-key= restrict_key"}}, {"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": {"url": "/docs/18/app-pg-dumpall.html", "text": "--rows-per-insert= nrows"}}, {"summary": "Dump optimizer statistics.", "signature": {"url": "/docs/18/app-pg-dumpall.html", "text": "--statistics"}}, {"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": {"url": "/docs/18/app-pg-dumpall.html", "text": "--statistics-only"}}, {"summary": "Include sequence data in the dump. This is the default behavior except when --no-data , --schema-only , or --statistics-only is specified.", "signature": {"url": "/docs/18/app-pg-dumpall.html", "text": "--sequence-data"}}, {"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": {"url": "/docs/18/app-pg-dumpall.html", "text": "--use-set-session-authorization"}}, {"summary": "Show help about pg_dumpall command line arguments, and exit.", "signature": {"url": "/docs/18/app-pg-dumpall.html", "text": "-? --help"}}, {"summary": "Specifies parameters used to connect to the server, as a connection string ; these will override any conflicting command line options.", "signature": {"url": "/docs/18/app-pg-dumpall.html", "text": "-d connstr --dbname= connstr"}}, {"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": {"url": "/docs/18/app-pg-dumpall.html", "text": "-h host --host= host"}}, {"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": {"url": "/docs/18/app-pg-dumpall.html", "text": "-l dbname --database= dbname"}}, {"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": {"url": "/docs/18/app-pg-dumpall.html", "text": "-p port --port= port"}}, {"summary": "User name to connect as.", "signature": {"url": "/docs/18/app-pg-dumpall.html", "text": "-U username --username= username"}}, {"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": {"url": "/docs/18/app-pg-dumpall.html", "text": "-w --no-password"}}, {"summary": "Force pg_dumpall to prompt for a password before connecting to a database.", "signature": {"url": "/docs/18/app-pg-dumpall.html", "text": "-W --password"}}, {"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.", "signature": {"url": "/docs/18/app-pg-dumpall.html", "text": "--role= rolename"}}], "title": "Documented options", "columns": [{"key": "signature", "label": "Option and arguments"}, {"key": "summary", "label": "Description"}]}, {"key": "environment", "rows": [{"name": "PGHOST PGOPTIONS PGPORT PGUSER", "description": "Default connection parameters"}, {"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}], "title": "Environment variables", "columns": [{"key": "name", "label": "Variable"}, {"key": "description", "label": "Meaning"}]}], "options": [{"names": ["-a", "--data-only"], "summary": "Dump only the data, not the schema (data definitions) or statistics.", "signature": "-a --data-only", "source_url": "/docs/18/app-pg-dumpall.html", "description": "Dump only the data, not the schema (data definitions) or statistics."}, {"names": ["-c", "--clean"], "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": "-c --clean", "source_url": "/docs/18/app-pg-dumpall.html", "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": ["-E encoding", "--encoding= encoding"], "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": "-E encoding --encoding= encoding", "source_url": "/docs/18/app-pg-dumpall.html", "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": ["-f filename", "--file= filename"], "summary": "Send output to the specified file. If this is omitted, the standard output is used.", "signature": "-f filename --file= filename", "source_url": "/docs/18/app-pg-dumpall.html", "description": "Send output to the specified file. If this is omitted, the standard output is used."}, {"names": ["-g", "--globals-only"], "summary": "Dump only global objects (roles and tablespaces), no databases.", "signature": "-g --globals-only", "source_url": "/docs/18/app-pg-dumpall.html", "description": "Dump only global objects (roles and tablespaces), no databases."}, {"names": ["-O", "--no-owner"], "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": "-O --no-owner", "source_url": "/docs/18/app-pg-dumpall.html", "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": ["-r", "--roles-only"], "summary": "Dump only roles, no databases or tablespaces.", "signature": "-r --roles-only", "source_url": "/docs/18/app-pg-dumpall.html", "description": "Dump only roles, no databases or tablespaces."}, {"names": ["-s", "--schema-only"], "summary": "Dump only the object definitions (schema), not data.", "signature": "-s --schema-only", "source_url": "/docs/18/app-pg-dumpall.html", "description": "Dump only the object definitions (schema), not data."}, {"names": ["-S username", "--superuser= username"], "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": "-S username --superuser= username", "source_url": "/docs/18/app-pg-dumpall.html", "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": ["-t", "--tablespaces-only"], "summary": "Dump only tablespaces, no databases or roles.", "signature": "-t --tablespaces-only", "source_url": "/docs/18/app-pg-dumpall.html", "description": "Dump only tablespaces, no databases or roles."}, {"names": ["-v", "--verbose"], "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": "-v --verbose", "source_url": "/docs/18/app-pg-dumpall.html", "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", "--version"], "summary": "Print the pg_dumpall version and exit.", "signature": "-V --version", "source_url": "/docs/18/app-pg-dumpall.html", "description": "Print the pg_dumpall version and exit."}, {"names": ["-x", "--no-privileges", "--no-acl"], "summary": "Prevent dumping of access privileges (grant/revoke commands).", "signature": "-x --no-privileges --no-acl", "source_url": "/docs/18/app-pg-dumpall.html", "description": "Prevent dumping of access privileges (grant/revoke commands)."}, {"names": ["--binary-upgrade"], "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": "--binary-upgrade", "source_url": "/docs/18/app-pg-dumpall.html", "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": ["--column-inserts", "--attribute-inserts"], "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": "--column-inserts --attribute-inserts", "source_url": "/docs/18/app-pg-dumpall.html", "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": ["--disable-dollar-quoting"], "summary": "This option disables the use of dollar quoting for function bodies, and forces them to be quoted using SQL standard string syntax.", "signature": "--disable-dollar-quoting", "source_url": "/docs/18/app-pg-dumpall.html", "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-triggers"], "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": "--disable-triggers", "source_url": "/docs/18/app-pg-dumpall.html", "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": ["--exclude-database= pattern"], "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": "--exclude-database= pattern", "source_url": "/docs/18/app-pg-dumpall.html", "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": ["--extra-float-digits= ndigits"], "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": "--extra-float-digits= ndigits", "source_url": "/docs/18/app-pg-dumpall.html", "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": ["--filter= filename"], "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": "--filter= filename", "source_url": "/docs/18/app-pg-dumpall.html", "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": ["--if-exists"], "summary": "Use DROP ... IF EXISTS commands to drop objects in --clean mode. This suppresses \u201c does not exist \u201d errors that might otherwise be reported. This option is not valid unless --clean is also specified.", "signature": "--if-exists", "source_url": "/docs/18/app-pg-dumpall.html", "description": "Use DROP ... IF EXISTS commands to drop objects in --clean mode. This suppresses \u201c does not exist \u201d errors that might otherwise be reported. This option is not valid unless --clean is also specified."}, {"names": ["--inserts"], "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": "--inserts", "source_url": "/docs/18/app-pg-dumpall.html", "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": ["--load-via-partition-root"], "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": "--load-via-partition-root", "source_url": "/docs/18/app-pg-dumpall.html", "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": ["--lock-wait-timeout= timeout"], "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": "--lock-wait-timeout= timeout", "source_url": "/docs/18/app-pg-dumpall.html", "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": ["--no-comments"], "summary": "Do not dump COMMENT commands.", "signature": "--no-comments", "source_url": "/docs/18/app-pg-dumpall.html", "description": "Do not dump COMMENT commands."}, {"names": ["--no-data"], "summary": "Do not dump data.", "signature": "--no-data", "source_url": "/docs/18/app-pg-dumpall.html", "description": "Do not dump data."}, {"names": ["--no-policies"], "summary": "Do not dump row security policies.", "signature": "--no-policies", "source_url": "/docs/18/app-pg-dumpall.html", "description": "Do not dump row security policies."}, {"names": ["--no-publications"], "summary": "Do not dump publications.", "signature": "--no-publications", "source_url": "/docs/18/app-pg-dumpall.html", "description": "Do not dump publications."}, {"names": ["--no-role-passwords"], "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": "--no-role-passwords", "source_url": "/docs/18/app-pg-dumpall.html", "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-schema"], "summary": "Do not dump schema (data definitions).", "signature": "--no-schema", "source_url": "/docs/18/app-pg-dumpall.html", "description": "Do not dump schema (data definitions)."}, {"names": ["--no-security-labels"], "summary": "Do not dump security labels.", "signature": "--no-security-labels", "source_url": "/docs/18/app-pg-dumpall.html", "description": "Do not dump security labels."}, {"names": ["--no-statistics"], "summary": "Do not dump statistics. This is the default.", "signature": "--no-statistics", "source_url": "/docs/18/app-pg-dumpall.html", "description": "Do not dump statistics. This is the default."}, {"names": ["--no-subscriptions"], "summary": "Do not dump subscriptions.", "signature": "--no-subscriptions", "source_url": "/docs/18/app-pg-dumpall.html", "description": "Do not dump subscriptions."}, {"names": ["--no-sync"], "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": "--no-sync", "source_url": "/docs/18/app-pg-dumpall.html", "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-table-access-method"], "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": "--no-table-access-method", "source_url": "/docs/18/app-pg-dumpall.html", "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-tablespaces"], "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": "--no-tablespaces", "source_url": "/docs/18/app-pg-dumpall.html", "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-toast-compression"], "summary": "Do not output commands to set TOAST compression methods. With this option, all columns will be restored with the default compression setting.", "signature": "--no-toast-compression", "source_url": "/docs/18/app-pg-dumpall.html", "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-unlogged-table-data"], "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": "--no-unlogged-table-data", "source_url": "/docs/18/app-pg-dumpall.html", "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": ["--on-conflict-do-nothing"], "summary": "Add ON CONFLICT DO NOTHING to INSERT commands. This option is not valid unless --inserts or --column-inserts is also specified.", "signature": "--on-conflict-do-nothing", "source_url": "/docs/18/app-pg-dumpall.html", "description": "Add ON CONFLICT DO NOTHING to INSERT commands. This option is not valid unless --inserts or --column-inserts is also specified."}, {"names": ["--quote-all-identifiers"], "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": "--quote-all-identifiers", "source_url": "/docs/18/app-pg-dumpall.html", "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": ["--restrict-key= restrict_key"], "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": "--restrict-key= restrict_key", "source_url": "/docs/18/app-pg-dumpall.html", "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": ["--rows-per-insert= nrows"], "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": "--rows-per-insert= nrows", "source_url": "/docs/18/app-pg-dumpall.html", "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": ["--statistics"], "summary": "Dump optimizer statistics.", "signature": "--statistics", "source_url": "/docs/18/app-pg-dumpall.html", "description": "Dump optimizer statistics."}, {"names": ["--statistics-only"], "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": "--statistics-only", "source_url": "/docs/18/app-pg-dumpall.html", "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": ["--sequence-data"], "summary": "Include sequence data in the dump. This is the default behavior except when --no-data , --schema-only , or --statistics-only is specified.", "signature": "--sequence-data", "source_url": "/docs/18/app-pg-dumpall.html", "description": "Include sequence data in the dump. This is the default behavior except when --no-data , --schema-only , or --statistics-only is specified."}, {"names": ["--use-set-session-authorization"], "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": "--use-set-session-authorization", "source_url": "/docs/18/app-pg-dumpall.html", "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": ["-?", "--help"], "summary": "Show help about pg_dumpall command line arguments, and exit.", "signature": "-? --help", "source_url": "/docs/18/app-pg-dumpall.html", "description": "Show help about pg_dumpall command line arguments, and exit."}, {"names": ["-d connstr", "--dbname= connstr"], "summary": "Specifies parameters used to connect to the server, as a connection string ; these will override any conflicting command line options.", "signature": "-d connstr --dbname= connstr", "source_url": "/docs/18/app-pg-dumpall.html", "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": ["-h host", "--host= host"], "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": "-h host --host= host", "source_url": "/docs/18/app-pg-dumpall.html", "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": ["-l dbname", "--database= dbname"], "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": "-l dbname --database= dbname", "source_url": "/docs/18/app-pg-dumpall.html", "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": ["-p port", "--port= port"], "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": "-p port --port= port", "source_url": "/docs/18/app-pg-dumpall.html", "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": ["-U username", "--username= username"], "summary": "User name to connect as.", "signature": "-U username --username= username", "source_url": "/docs/18/app-pg-dumpall.html", "description": "User name to connect as."}, {"names": ["-w", "--no-password"], "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": "-w --no-password", "source_url": "/docs/18/app-pg-dumpall.html", "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", "--password"], "summary": "Force pg_dumpall to prompt for a password before connecting to a database.", "signature": "-W --password", "source_url": "/docs/18/app-pg-dumpall.html", "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": ["--role= rolename"], "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.", "signature": "--role= rolename", "source_url": "/docs/18/app-pg-dumpall.html", "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."}], "related": [{"url": "/wiki/conn/?v=18", "label": "libpq connection parameters"}], "release": {"ref": "https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2", "label": "18.6", "major": "18", "channel": "stable", "manifest": {"pdf": {"A4": {"url": "/files/documentation/pdf/18/postgresql-18-A4.pdf", "bytes": 15865106, "pages": 3154, "sha256": "19512c405da53f9f7fcf0abba359223aa65f021be025bf3411381918f92e3190", "built_at": "2026-09-26"}, "US": {"url": "/files/documentation/pdf/18/postgresql-18-US.pdf", "bytes": 15748059, "pages": 3328, "sha256": "facbe6c229e598b872d3d98bef53308f46e06746006fa4590de9a7de9dd46319", "built_at": "2026-09-26"}}, "tree": "18", "index": "index.html", "major": "18", "pages": 1148, "release": "18.6", "source_url": "https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2", "svg_assets": 3, "source_mode": "en SGML built with pinned official archive", "source_sha256": "555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f"}, "revision": "ee8d1a3612338fd9adf250730cb640fcc5233b5491337cc00a316a44e3a0b9f8", "evidence_kind": "English manual and source declarations", "source_sha256": "555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f"}, "sources": [{"url": "/docs/18/app-pg-dumpall.html", "file": "app-pg-dumpall.html", "label": "18.6 English manual \u00b7 app-pg-dumpall.html", "anchor": "", "sha256": "5f64e2921cefa4823764e46860b95e0f5f7568192670220a0bac10314c740683"}, {"url": "/docs/18/reference-client.html", "file": "reference-client.html", "label": "Client applications inventory", "anchor": "", "sha256": "68f726af77272fe73a827be2b7b5958d0f2239a6f8ed44264e9d42496bfa4fd0"}], "sections": [], "synopsis": ["pg_dumpall [ connection-option ...] [ option ...]"], "signature": "pg_dumpall [ connection-option ...] [ option ...]", "description": ["pg_dumpall \u2014 extract a PostgreSQL database cluster into a script file"], "environment": [{"name": "PGHOST PGOPTIONS PGPORT PGUSER", "description": "Default connection parameters"}, {"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}], "manual_html": "<div><div class=\"refentry\" id=\"APP-PG-DUMPALL\">\n<div class=\"titlepage\"></div>\n<div class=\"refnamediv\">\n<h2><span class=\"refentrytitle\"><span class=\"application\">pg_dumpall</span></span></h2>\n<p>pg_dumpall \u2014 extract a <span class=\"productname\">PostgreSQL</span> database cluster into a script file</p>\n</div>\n<div class=\"refsynopsisdiv\">\n<h2>Synopsis</h2>\n<div class=\"cmdsynopsis\">\n<p id=\"id-1.9.4.15.4.1\"><code class=\"command\">pg_dumpall</code> [<em class=\"replaceable\"><code>connection-option</code></em>...] [<em class=\"replaceable\"><code>option</code></em>...]</p>\n</div>\n</div>\n<div class=\"refsect1\" id=\"APP-PG-DUMPALL-DESCRIPTION\">\n<h2>Description</h2>\n<p><span class=\"application\">pg_dumpall</span> is a utility for writing out (<span class=\"quote\">\u201c<span class=\"quote\">dumping</span>\u201d</span>) all <span class=\"productname\">PostgreSQL</span> databases of a cluster into one script file. The script file contains SQL commands that can be used as input to <a class=\"xref\" href=\"/docs/18/app-psql.html\" title=\"psql\"><span class=\"refentrytitle\"><span class=\"application\">psql</span></span></a> to restore the databases. It does this by calling <a class=\"xref\" href=\"/docs/18/app-pgdump.html\" title=\"pg_dump\"><span class=\"refentrytitle\"><span class=\"application\">pg_dump</span></span></a> for each database in the cluster. <span class=\"application\">pg_dumpall</span> also dumps global objects that are common to all databases, namely database roles, tablespaces, and privilege grants for configuration parameters. (<span class=\"application\">pg_dump</span> does not save these objects.)</p>\n<p>Since <span class=\"application\">pg_dumpall</span> 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.</p>\n<p>The SQL script will be written to the standard output. Use the <code class=\"option\">-f</code>/<code class=\"option\">--file</code> option or shell operators to redirect it into a file.</p>\n<p><span class=\"application\">pg_dumpall</span> needs to connect several times to the <span class=\"productname\">PostgreSQL</span> server (once per database). If you use password authentication it will ask for a password each time. It is convenient to have a <code class=\"filename\">~/.pgpass</code> file in such cases. See <a class=\"xref\" href=\"/docs/18/libpq-pgpass.html\" title=\"32.16.\u00a0The Password File\">Section\u00a032.16</a> for more information.</p>\n<div class=\"warning\">\n<h3 class=\"title\">Warning</h3>\n<p>Restoring 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.</p>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.15.6\">\n<h2>Options</h2>\n<p>The following command-line options control the content and format of the output.</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-a</code><br></span><span class=\"term\"><code class=\"option\">--data-only</code></span></dt>\n<dd>\n<p>Dump only the data, not the schema (data definitions) or statistics.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-c</code><br></span><span class=\"term\"><code class=\"option\">--clean</code></span></dt>\n<dd>\n<p>Emit SQL commands to <code class=\"command\">DROP</code> 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 <code class=\"option\">--if-exists</code> is also specified.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-E <em class=\"replaceable\"><code>encoding</code></em></code><br></span><span class=\"term\"><code class=\"option\">--encoding=<em class=\"replaceable\"><code>encoding</code></em></code></span></dt>\n<dd>\n<p>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 <code class=\"envar\">PGCLIENTENCODING</code> environment variable to the desired dump encoding.)</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-f <em class=\"replaceable\"><code>filename</code></em></code><br></span><span class=\"term\"><code class=\"option\">--file=<em class=\"replaceable\"><code>filename</code></em></code></span></dt>\n<dd>\n<p>Send output to the specified file. If this is omitted, the standard output is used.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-g</code><br></span><span class=\"term\"><code class=\"option\">--globals-only</code></span></dt>\n<dd>\n<p>Dump only global objects (roles and tablespaces), no databases.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-O</code><br></span><span class=\"term\"><code class=\"option\">--no-owner</code></span></dt>\n<dd>\n<p>Do not output commands to set ownership of objects to match the original database. By default, <span class=\"application\">pg_dumpall</span> issues <code class=\"command\">ALTER OWNER</code> or <code class=\"command\">SET SESSION AUTHORIZATION</code> 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 <code class=\"option\">-O</code>.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-r</code><br></span><span class=\"term\"><code class=\"option\">--roles-only</code></span></dt>\n<dd>\n<p>Dump only roles, no databases or tablespaces.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-s</code><br></span><span class=\"term\"><code class=\"option\">--schema-only</code></span></dt>\n<dd>\n<p>Dump only the object definitions (schema), not data.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-S <em class=\"replaceable\"><code>username</code></em></code><br></span><span class=\"term\"><code class=\"option\">--superuser=<em class=\"replaceable\"><code>username</code></em></code></span></dt>\n<dd>\n<p>Specify the superuser user name to use when disabling triggers. This is relevant only if <code class=\"option\">--disable-triggers</code> is used. (Usually, it's better to leave this out, and instead start the resulting script as superuser.)</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-t</code><br></span><span class=\"term\"><code class=\"option\">--tablespaces-only</code></span></dt>\n<dd>\n<p>Dump only tablespaces, no databases or roles.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-v</code><br></span><span class=\"term\"><code class=\"option\">--verbose</code></span></dt>\n<dd>\n<p>Specifies verbose mode. This will cause <span class=\"application\">pg_dumpall</span> 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 <span class=\"application\">pg_dump</span>.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-V</code><br></span><span class=\"term\"><code class=\"option\">--version</code></span></dt>\n<dd>\n<p>Print the <span class=\"application\">pg_dumpall</span> version and exit.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-x</code><br></span><span class=\"term\"><code class=\"option\">--no-privileges</code><br></span><span class=\"term\"><code class=\"option\">--no-acl</code></span></dt>\n<dd>\n<p>Prevent dumping of access privileges (grant/revoke commands).</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--binary-upgrade</code></span></dt>\n<dd>\n<p>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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--column-inserts</code><br></span><span class=\"term\"><code class=\"option\">--attribute-inserts</code></span></dt>\n<dd>\n<p>Dump data as <code class=\"command\">INSERT</code> commands with explicit column names (<code class=\"literal\">INSERT INTO <em class=\"replaceable\"><code>table</code></em> (<em class=\"replaceable\"><code>column</code></em>, ...) VALUES ...</code>). This will make restoration very slow; it is mainly useful for making dumps that can be loaded into non-<span class=\"productname\">PostgreSQL</span> databases.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--disable-dollar-quoting</code></span></dt>\n<dd>\n<p>This option disables the use of dollar quoting for function bodies, and forces them to be quoted using SQL standard string syntax.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--disable-triggers</code></span></dt>\n<dd>\n<p>This option is relevant only when creating a dump with data and without schema. It instructs <span class=\"application\">pg_dumpall</span> 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.</p>\n<p>Presently, the commands emitted for <code class=\"option\">--disable-triggers</code> must be done as superuser. So, you should also specify a superuser name with <code class=\"option\">-S</code>, or preferably be careful to start the resulting script as a superuser.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--exclude-database=<em class=\"replaceable\"><code>pattern</code></em></code></span></dt>\n<dd>\n<p>Do not dump databases whose name matches <em class=\"replaceable\"><code>pattern</code></em>. Multiple patterns can be excluded by writing multiple <code class=\"option\">--exclude-database</code> switches. The <em class=\"replaceable\"><code>pattern</code></em> parameter is interpreted as a pattern according to the same rules used by <span class=\"application\">psql</span>'s <code class=\"literal\">\\d</code> commands (see <a class=\"xref\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\">Patterns</a>), 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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--extra-float-digits=<em class=\"replaceable\"><code>ndigits</code></em></code></span></dt>\n<dd>\n<p>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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--filter=<em class=\"replaceable\"><code>filename</code></em></code></span></dt>\n<dd>\n<p>Specify a filename from which to read patterns for databases excluded from the dump. The patterns are interpreted according to the same rules as <code class=\"option\">--exclude-database</code>. To read from <code class=\"literal\">STDIN</code>, use <code class=\"filename\">-</code> as the filename. The <code class=\"option\">--filter</code> option can be specified in conjunction with <code class=\"option\">--exclude-database</code> for excluding databases, and can also be specified more than once for multiple filter files.</p>\n<p>The file lists one database pattern per row, with the following format:</p>\n<pre class=\"synopsis\">exclude database <em class=\"replaceable\"><code>PATTERN</code></em>\n</pre>\n<p>Lines starting with <code class=\"literal\">#</code> are considered comments and ignored. Comments can be placed after an object pattern row as well. Blank lines are also ignored. See <a class=\"xref\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\">Patterns</a> for how to perform quoting in patterns.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--if-exists</code></span></dt>\n<dd>\n<p>Use <code class=\"literal\">DROP ... IF EXISTS</code> commands to drop objects in <code class=\"option\">--clean</code> mode. This suppresses <span class=\"quote\">\u201c<span class=\"quote\">does not exist</span>\u201d</span> errors that might otherwise be reported. This option is not valid unless <code class=\"option\">--clean</code> is also specified.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--inserts</code></span></dt>\n<dd>\n<p>Dump data as <code class=\"command\">INSERT</code> commands (rather than <code class=\"command\">COPY</code>). This will make restoration very slow; it is mainly useful for making dumps that can be loaded into non-<span class=\"productname\">PostgreSQL</span> databases. Note that the restore might fail altogether if you have rearranged column order. The <code class=\"option\">--column-inserts</code> option is safer, though even slower.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--load-via-partition-root</code></span></dt>\n<dd>\n<p>When dumping data for a table partition, make the <code class=\"command\">COPY</code> or <code class=\"command\">INSERT</code> 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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--lock-wait-timeout=<em class=\"replaceable\"><code>timeout</code></em></code></span></dt>\n<dd>\n<p>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 <em class=\"replaceable\"><code>timeout</code></em>. The timeout may be specified in any of the formats accepted by <code class=\"command\">SET statement_timeout</code>.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-comments</code></span></dt>\n<dd>\n<p>Do not dump <code class=\"command\">COMMENT</code> commands.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-data</code></span></dt>\n<dd>\n<p>Do not dump data.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-policies</code></span></dt>\n<dd>\n<p>Do not dump row security policies.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-publications</code></span></dt>\n<dd>\n<p>Do not dump publications.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-role-passwords</code></span></dt>\n<dd>\n<p>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 <code class=\"structname\">pg_roles</code> instead of <code class=\"structname\">pg_authid</code>. Therefore, this option also helps if access to <code class=\"structname\">pg_authid</code> is restricted by some security policy.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-schema</code></span></dt>\n<dd>\n<p>Do not dump schema (data definitions).</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-security-labels</code></span></dt>\n<dd>\n<p>Do not dump security labels.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-statistics</code></span></dt>\n<dd>\n<p>Do not dump statistics. This is the default.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-subscriptions</code></span></dt>\n<dd>\n<p>Do not dump subscriptions.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-sync</code></span></dt>\n<dd>\n<p>By default, <code class=\"command\">pg_dumpall</code> will wait for all files to be written safely to disk. This option causes <code class=\"command\">pg_dumpall</code> 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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-table-access-method</code></span></dt>\n<dd>\n<p>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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-tablespaces</code></span></dt>\n<dd>\n<p>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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-toast-compression</code></span></dt>\n<dd>\n<p>Do not output commands to set TOAST compression methods. With this option, all columns will be restored with the default compression setting.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-unlogged-table-data</code></span></dt>\n<dd>\n<p>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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--on-conflict-do-nothing</code></span></dt>\n<dd>\n<p>Add <code class=\"literal\">ON CONFLICT DO NOTHING</code> to <code class=\"command\">INSERT</code> commands. This option is not valid unless <code class=\"option\">--inserts</code> or <code class=\"option\">--column-inserts</code> is also specified.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--quote-all-identifiers</code></span></dt>\n<dd>\n<p>Force quoting of all identifiers. This option is recommended when dumping a database from a server whose <span class=\"productname\">PostgreSQL</span> major version is different from <span class=\"application\">pg_dumpall</span>'s, or when the output is intended to be loaded into a server of a different major version. By default, <span class=\"application\">pg_dumpall</span> 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 <code class=\"option\">--quote-all-identifiers</code> prevents such issues, at the price of a harder-to-read dump script.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--restrict-key=<em class=\"replaceable\"><code>restrict_key</code></em></code></span></dt>\n<dd>\n<p>Use the provided string as the <span class=\"application\">psql</span> <code class=\"command\">\\restrict</code> key in the dump output. If no restrict key is specified, <span class=\"application\">pg_dumpall</span> will generate a random one as needed. Keys may contain only alphanumeric characters.</p>\n<p>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 <span class=\"application\">psql</span> with the dump output.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--rows-per-insert=<em class=\"replaceable\"><code>nrows</code></em></code></span></dt>\n<dd>\n<p>Dump data as <code class=\"command\">INSERT</code> commands (rather than <code class=\"command\">COPY</code>). Controls the maximum number of rows per <code class=\"command\">INSERT</code> 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 <code class=\"command\">INSERT</code> to be lost, rather than the entire table contents.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--statistics</code></span></dt>\n<dd>\n<p>Dump optimizer statistics.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--statistics-only</code></span></dt>\n<dd>\n<p>Dump only the statistics, not the schema (data definitions) or data. Optimizer statistics for tables, materialized views, foreign tables, and indexes are dumped.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--sequence-data</code></span></dt>\n<dd>\n<p>Include sequence data in the dump. This is the default behavior except when <code class=\"option\">--no-data</code>, <code class=\"option\">--schema-only</code>, or <code class=\"option\">--statistics-only</code> is specified.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--use-set-session-authorization</code></span></dt>\n<dd>\n<p>Output SQL-standard <code class=\"command\">SET SESSION AUTHORIZATION</code> commands instead of <code class=\"command\">ALTER OWNER</code> 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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-?</code><br></span><span class=\"term\"><code class=\"option\">--help</code></span></dt>\n<dd>\n<p>Show help about <span class=\"application\">pg_dumpall</span> command line arguments, and exit.</p>\n</dd>\n</dl>\n</div>\n<p>The following command-line options control the database connection parameters.</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-d <em class=\"replaceable\"><code>connstr</code></em></code><br></span><span class=\"term\"><code class=\"option\">--dbname=<em class=\"replaceable\"><code>connstr</code></em></code></span></dt>\n<dd>\n<p>Specifies parameters used to connect to the server, as a <a class=\"link\" href=\"/docs/18/libpq-connect.html#LIBPQ-CONNSTRING\" title=\"32.1.1.\u00a0Connection Strings\">connection string</a>; these will override any conflicting command line options.</p>\n<p>The option is called <code class=\"literal\">--dbname</code> for consistency with other client applications, but because <span class=\"application\">pg_dumpall</span> needs to connect to many databases, the database name in the connection string will be ignored. Use the <code class=\"literal\">-l</code> 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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-h <em class=\"replaceable\"><code>host</code></em></code><br></span><span class=\"term\"><code class=\"option\">--host=<em class=\"replaceable\"><code>host</code></em></code></span></dt>\n<dd>\n<p>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 <code class=\"envar\">PGHOST</code> environment variable, if set, else a Unix domain socket connection is attempted.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-l <em class=\"replaceable\"><code>dbname</code></em></code><br></span><span class=\"term\"><code class=\"option\">--database=<em class=\"replaceable\"><code>dbname</code></em></code></span></dt>\n<dd>\n<p>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 <code class=\"literal\">postgres</code> database will be used, and if that does not exist, <code class=\"literal\">template1</code> will be used.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-p <em class=\"replaceable\"><code>port</code></em></code><br></span><span class=\"term\"><code class=\"option\">--port=<em class=\"replaceable\"><code>port</code></em></code></span></dt>\n<dd>\n<p>Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the <code class=\"envar\">PGPORT</code> environment variable, if set, or a compiled-in default.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-U <em class=\"replaceable\"><code>username</code></em></code><br></span><span class=\"term\"><code class=\"option\">--username=<em class=\"replaceable\"><code>username</code></em></code></span></dt>\n<dd>\n<p>User name to connect as.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-w</code><br></span><span class=\"term\"><code class=\"option\">--no-password</code></span></dt>\n<dd>\n<p>Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a <code class=\"filename\">.pgpass</code> 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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-W</code><br></span><span class=\"term\"><code class=\"option\">--password</code></span></dt>\n<dd>\n<p>Force <span class=\"application\">pg_dumpall</span> to prompt for a password before connecting to a database.</p>\n<p>This option is never essential, since <span class=\"application\">pg_dumpall</span> will automatically prompt for a password if the server demands password authentication. However, <span class=\"application\">pg_dumpall</span> will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing <code class=\"option\">-W</code> to avoid the extra connection attempt.</p>\n<p>Note that the password prompt will occur again for each database to be dumped. Usually, it's better to set up a <code class=\"filename\">~/.pgpass</code> file than to rely on manual password entry.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--role=<em class=\"replaceable\"><code>rolename</code></em></code></span></dt>\n<dd>\n<p>Specifies a role name to be used to create the dump. This option causes <span class=\"application\">pg_dumpall</span> to issue a <code class=\"command\">SET ROLE</code> <em class=\"replaceable\"><code>rolename</code></em> command after connecting to the database. It is useful when the authenticated user (specified by <code class=\"option\">-U</code>) lacks privileges needed by <span class=\"application\">pg_dumpall</span>, 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.</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.15.7\">\n<h2>Environment</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"envar\">PGHOST</code><br></span><span class=\"term\"><code class=\"envar\">PGOPTIONS</code><br></span><span class=\"term\"><code class=\"envar\">PGPORT</code><br></span><span class=\"term\"><code class=\"envar\">PGUSER</code></span></dt>\n<dd>\n<p>Default connection parameters</p>\n</dd>\n<dt><span class=\"term\"><code class=\"envar\">PG_COLOR</code></span></dt>\n<dd>\n<p>Specifies whether to use color in diagnostic messages. Possible values are <code class=\"literal\">always</code>, <code class=\"literal\">auto</code> and <code class=\"literal\">never</code>.</p>\n</dd>\n</dl>\n</div>\n<p>This utility, like most other <span class=\"productname\">PostgreSQL</span> utilities, also uses the environment variables supported by <span class=\"application\">libpq</span> (see <a class=\"xref\" href=\"/docs/18/libpq-envars.html\" title=\"32.15.\u00a0Environment Variables\">Section\u00a032.15</a>).</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.15.8\">\n<h2>Notes</h2>\n<p>Since <span class=\"application\">pg_dumpall</span> calls <span class=\"application\">pg_dump</span> internally, some diagnostic messages will refer to <span class=\"application\">pg_dump</span>.</p>\n<p>The <code class=\"option\">--clean</code> option can be useful even when your intention is to restore the dump script into a fresh cluster. Use of <code class=\"option\">--clean</code> authorizes the script to drop and re-create the built-in <code class=\"literal\">postgres</code> and <code class=\"literal\">template1</code> 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.</p>\n<p>When <code class=\"option\">--statistics</code> is specified, <code class=\"command\">pg_dumpall</code> will include most optimizer statistics in the resulting dump file. This does not include all statistics, such as those created explicitly with <a class=\"xref\" href=\"/docs/18/sql-createstatistics.html\" title=\"CREATE STATISTICS\"><span class=\"refentrytitle\">CREATE STATISTICS</span></a>, custom statistics added by an extension, or statistics collected by the cumulative statistics system. Therefore, it may still be useful to run <code class=\"command\">ANALYZE</code> on each database after restoring from a dump file to ensure optimal performance. You can also run <code class=\"command\">vacuumdb -a -z</code> to analyze all databases.</p>\n<p>The dump script should not be expected to run completely without errors. In particular, because the script will issue <code class=\"command\">CREATE ROLE</code> for every role existing in the source cluster, it is certain to get a <span class=\"quote\">\u201c<span class=\"quote\">role already exists</span>\u201d</span> 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 <code class=\"option\">--clean</code> option is likely to produce additional harmless error messages about non-existent objects, although you can minimize those by adding <code class=\"option\">--if-exists</code>.</p>\n<p><span class=\"application\">pg_dumpall</span> requires all needed tablespace directories to exist before the restore; otherwise, database creation will fail for databases in non-default locations.</p>\n<p>It is generally recommended to use the <code class=\"option\">-X</code> (<code class=\"option\">--no-psqlrc</code>) option when restoring a database from a <span class=\"application\">pg_dumpall</span> script to ensure a clean restore process and prevent potential conflicts with non-default <span class=\"application\">psql</span> configurations. Additionally, because the <span class=\"application\">pg_dumpall</span> script may include <span class=\"application\">psql</span> meta-commands, it may be incompatible with clients other than <span class=\"application\">psql</span>.</p>\n</div>\n<div class=\"refsect1\" id=\"APP-PG-DUMPALL-EX\">\n<h2>Examples</h2>\n<p>To dump all databases:</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_dumpall &gt; db.out</code></strong>\n</pre>\n<p>To restore database(s) from this file, you can use:</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>psql -X -f db.out -d postgres</code></strong>\n</pre>\n<p>It is not important which database you connect to here since the script file created by <span class=\"application\">pg_dumpall</span> will contain the appropriate commands to create and connect to the saved databases. An exception is that if you specified <code class=\"option\">--clean</code>, you must connect to the <code class=\"literal\">postgres</code> database initially; the script will attempt to drop other databases immediately, and that will fail for the database you are connected to.</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.15.10\">\n<h2>See Also</h2>\n<p>Check <a class=\"xref\" href=\"/docs/18/app-pgdump.html\" title=\"pg_dump\"><span class=\"refentrytitle\"><span class=\"application\">pg_dump</span></span></a> for details on possible error conditions.</p>\n</div>\n</div></div>", "manual_path": "app-pg-dumpall.html", "comparison_data": {"options": [{"names": ["-a", "--data-only"], "signature": "-a --data-only", "description": "Dump only the data, not the schema (data definitions) or statistics."}, {"names": ["-c", "--clean"], "signature": "-c --clean", "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": ["-E encoding", "--encoding= encoding"], "signature": "-E encoding --encoding= encoding", "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": ["-f filename", "--file= filename"], "signature": "-f filename --file= filename", "description": "Send output to the specified file. If this is omitted, the standard output is used."}, {"names": ["-g", "--globals-only"], "signature": "-g --globals-only", "description": "Dump only global objects (roles and tablespaces), no databases."}, {"names": ["-O", "--no-owner"], "signature": "-O --no-owner", "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": ["-r", "--roles-only"], "signature": "-r --roles-only", "description": "Dump only roles, no databases or tablespaces."}, {"names": ["-s", "--schema-only"], "signature": "-s --schema-only", "description": "Dump only the object definitions (schema), not data."}, {"names": ["-S username", "--superuser= username"], "signature": "-S username --superuser= username", "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": ["-t", "--tablespaces-only"], "signature": "-t --tablespaces-only", "description": "Dump only tablespaces, no databases or roles."}, {"names": ["-v", "--verbose"], "signature": "-v --verbose", "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", "--version"], "signature": "-V --version", "description": "Print the pg_dumpall version and exit."}, {"names": ["-x", "--no-privileges", "--no-acl"], "signature": "-x --no-privileges --no-acl", "description": "Prevent dumping of access privileges (grant/revoke commands)."}, {"names": ["--binary-upgrade"], "signature": "--binary-upgrade", "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": ["--column-inserts", "--attribute-inserts"], "signature": "--column-inserts --attribute-inserts", "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": ["--disable-dollar-quoting"], "signature": "--disable-dollar-quoting", "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-triggers"], "signature": "--disable-triggers", "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": ["--exclude-database= pattern"], "signature": "--exclude-database= pattern", "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": ["--extra-float-digits= ndigits"], "signature": "--extra-float-digits= ndigits", "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": ["--filter= filename"], "signature": "--filter= filename", "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": ["--if-exists"], "signature": "--if-exists", "description": "Use DROP ... IF EXISTS commands to drop objects in --clean mode. This suppresses \u201c does not exist \u201d errors that might otherwise be reported. This option is not valid unless --clean is also specified."}, {"names": ["--inserts"], "signature": "--inserts", "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": ["--load-via-partition-root"], "signature": "--load-via-partition-root", "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": ["--lock-wait-timeout= timeout"], "signature": "--lock-wait-timeout= timeout", "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": ["--no-comments"], "signature": "--no-comments", "description": "Do not dump COMMENT commands."}, {"names": ["--no-data"], "signature": "--no-data", "description": "Do not dump data."}, {"names": ["--no-policies"], "signature": "--no-policies", "description": "Do not dump row security policies."}, {"names": ["--no-publications"], "signature": "--no-publications", "description": "Do not dump publications."}, {"names": ["--no-role-passwords"], "signature": "--no-role-passwords", "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-schema"], "signature": "--no-schema", "description": "Do not dump schema (data definitions)."}, {"names": ["--no-security-labels"], "signature": "--no-security-labels", "description": "Do not dump security labels."}, {"names": ["--no-statistics"], "signature": "--no-statistics", "description": "Do not dump statistics. This is the default."}, {"names": ["--no-subscriptions"], "signature": "--no-subscriptions", "description": "Do not dump subscriptions."}, {"names": ["--no-sync"], "signature": "--no-sync", "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-table-access-method"], "signature": "--no-table-access-method", "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-tablespaces"], "signature": "--no-tablespaces", "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-toast-compression"], "signature": "--no-toast-compression", "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-unlogged-table-data"], "signature": "--no-unlogged-table-data", "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": ["--on-conflict-do-nothing"], "signature": "--on-conflict-do-nothing", "description": "Add ON CONFLICT DO NOTHING to INSERT commands. This option is not valid unless --inserts or --column-inserts is also specified."}, {"names": ["--quote-all-identifiers"], "signature": "--quote-all-identifiers", "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": ["--restrict-key= restrict_key"], "signature": "--restrict-key= restrict_key", "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": ["--rows-per-insert= nrows"], "signature": "--rows-per-insert= nrows", "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": ["--statistics"], "signature": "--statistics", "description": "Dump optimizer statistics."}, {"names": ["--statistics-only"], "signature": "--statistics-only", "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": ["--sequence-data"], "signature": "--sequence-data", "description": "Include sequence data in the dump. This is the default behavior except when --no-data , --schema-only , or --statistics-only is specified."}, {"names": ["--use-set-session-authorization"], "signature": "--use-set-session-authorization", "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": ["-?", "--help"], "signature": "-? --help", "description": "Show help about pg_dumpall command line arguments, and exit."}, {"names": ["-d connstr", "--dbname= connstr"], "signature": "-d connstr --dbname= connstr", "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": ["-h host", "--host= host"], "signature": "-h host --host= host", "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": ["-l dbname", "--database= dbname"], "signature": "-l dbname --database= dbname", "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": ["-p port", "--port= port"], "signature": "-p port --port= port", "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": ["-U username", "--username= username"], "signature": "-U username --username= username", "description": "User name to connect as."}, {"names": ["-w", "--no-password"], "signature": "-w --no-password", "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", "--password"], "signature": "-W --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": ["--role= rolename"], "signature": "--role= rolename", "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."}], "synopsis": ["pg_dumpall [ connection-option ...] [ option ...]"], "environment": [{"name": "PGHOST PGOPTIONS PGPORT PGUSER", "description": "Default connection parameters"}, {"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}]}, "comparison_hash": "dd0edf9a9ef6de0e86b97b0a2b08127ecf99f382528014ef50f210767b2d4f6c"}, "19": {"facts": [{"label": "Documented executable", "value": "pg_dumpall"}, {"label": "Executable version", "value": "19beta4"}, {"label": "Reference inventory", "value": "Client applications"}, {"label": "Option definition groups", "value": "55"}], "tables": [{"key": "options", "rows": [{"summary": "Dump only the data, not the schema (data definitions) or statistics.", "signature": {"url": "/docs/19/app-pg-dumpall.html", "text": "-a --data-only"}}, {"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": {"url": "/docs/19/app-pg-dumpall.html", "text": "-c --clean"}}, {"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": {"url": "/docs/19/app-pg-dumpall.html", "text": "-E encoding --encoding= encoding"}}, {"summary": "Send output to the specified file. If this is omitted, the standard output is used.", "signature": {"url": "/docs/19/app-pg-dumpall.html", "text": "-f filename --file= filename"}}, {"summary": "Dump only global objects (roles and tablespaces), no databases.", "signature": {"url": "/docs/19/app-pg-dumpall.html", "text": "-g --globals-only"}}, {"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": {"url": "/docs/19/app-pg-dumpall.html", "text": "-O --no-owner"}}, {"summary": "Dump only roles, no databases or tablespaces.", "signature": {"url": "/docs/19/app-pg-dumpall.html", "text": "-r --roles-only"}}, {"summary": "Dump only the object definitions (schema), not data.", "signature": {"url": "/docs/19/app-pg-dumpall.html", "text": "-s --schema-only"}}, {"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": {"url": "/docs/19/app-pg-dumpall.html", "text": "-S username --superuser= username"}}, {"summary": "Dump only tablespaces, no databases or roles.", "signature": {"url": "/docs/19/app-pg-dumpall.html", "text": "-t --tablespaces-only"}}, {"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": {"url": "/docs/19/app-pg-dumpall.html", "text": "-v --verbose"}}, {"summary": "Print the pg_dumpall version and exit.", "signature": {"url": "/docs/19/app-pg-dumpall.html", "text": "-V --version"}}, {"summary": "Prevent dumping of access privileges (grant/revoke commands).", "signature": {"url": "/docs/19/app-pg-dumpall.html", "text": "-x --no-privileges --no-acl"}}, {"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": {"url": "/docs/19/app-pg-dumpall.html", "text": "--binary-upgrade"}}, {"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": {"url": "/docs/19/app-pg-dumpall.html", "text": "--column-inserts --attribute-inserts"}}, {"summary": "This option disables the use of dollar quoting for function bodies, and forces them to be quoted using SQL standard string syntax.", "signature": {"url": "/docs/19/app-pg-dumpall.html", "text": "--disable-dollar-quoting"}}, {"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": {"url": "/docs/19/app-pg-dumpall.html", "text": "--disable-triggers"}}, {"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": {"url": "/docs/19/app-pg-dumpall.html", "text": "--exclude-database= pattern"}}, {"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": {"url": "/docs/19/app-pg-dumpall.html", "text": "--extra-float-digits= ndigits"}}, {"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": {"url": "/docs/19/app-pg-dumpall.html", "text": "--filter= filename"}}, {"summary": "Use DROP ... IF EXISTS commands to drop objects in --clean mode. This suppresses \u201c does not exist \u201d errors that might otherwise be reported. This option is not valid unless --clean is also specified.", "signature": {"url": "/docs/19/app-pg-dumpall.html", "text": "--if-exists"}}, {"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": {"url": "/docs/19/app-pg-dumpall.html", "text": "--inserts"}}, {"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": {"url": "/docs/19/app-pg-dumpall.html", "text": "--load-via-partition-root"}}, {"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": {"url": "/docs/19/app-pg-dumpall.html", "text": "--lock-wait-timeout= timeout"}}, {"summary": "Do not dump COMMENT commands.", "signature": {"url": "/docs/19/app-pg-dumpall.html", "text": "--no-comments"}}, {"summary": "Do not dump data.", "signature": {"url": "/docs/19/app-pg-dumpall.html", "text": "--no-data"}}, {"summary": "Do not dump row security policies.", "signature": {"url": "/docs/19/app-pg-dumpall.html", "text": "--no-policies"}}, {"summary": "Do not dump publications.", "signature": {"url": "/docs/19/app-pg-dumpall.html", "text": "--no-publications"}}, {"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": {"url": "/docs/19/app-pg-dumpall.html", "text": "--no-role-passwords"}}, {"summary": "Do not dump schema (data definitions).", "signature": {"url": "/docs/19/app-pg-dumpall.html", "text": "--no-schema"}}, {"summary": "Do not dump security labels.", "signature": {"url": "/docs/19/app-pg-dumpall.html", "text": "--no-security-labels"}}, {"summary": "Do not dump statistics. This is the default.", "signature": {"url": "/docs/19/app-pg-dumpall.html", "text": "--no-statistics"}}, {"summary": "Do not dump subscriptions.", "signature": {"url": "/docs/19/app-pg-dumpall.html", "text": "--no-subscriptions"}}, {"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": {"url": "/docs/19/app-pg-dumpall.html", "text": "--no-sync"}}, {"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": {"url": "/docs/19/app-pg-dumpall.html", "text": "--no-table-access-method"}}, {"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": {"url": "/docs/19/app-pg-dumpall.html", "text": "--no-tablespaces"}}, {"summary": "Do not output commands to set TOAST compression methods. With this option, all columns will be restored with the default compression setting.", "signature": {"url": "/docs/19/app-pg-dumpall.html", "text": "--no-toast-compression"}}, {"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": {"url": "/docs/19/app-pg-dumpall.html", "text": "--no-unlogged-table-data"}}, {"summary": "Add ON CONFLICT DO NOTHING to INSERT commands. This option is not valid unless --inserts or --column-inserts is also specified.", "signature": {"url": "/docs/19/app-pg-dumpall.html", "text": "--on-conflict-do-nothing"}}, {"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": {"url": "/docs/19/app-pg-dumpall.html", "text": "--quote-all-identifiers"}}, {"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": {"url": "/docs/19/app-pg-dumpall.html", "text": "--restrict-key= restrict_key"}}, {"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": {"url": "/docs/19/app-pg-dumpall.html", "text": "--rows-per-insert= nrows"}}, {"summary": "Dump optimizer statistics.", "signature": {"url": "/docs/19/app-pg-dumpall.html", "text": "--statistics"}}, {"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": {"url": "/docs/19/app-pg-dumpall.html", "text": "--statistics-only"}}, {"summary": "Include sequence data in the dump. This is the default behavior except when --no-data , --schema-only , or --statistics-only is specified.", "signature": {"url": "/docs/19/app-pg-dumpall.html", "text": "--sequence-data"}}, {"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": {"url": "/docs/19/app-pg-dumpall.html", "text": "--use-set-session-authorization"}}, {"summary": "Show help about pg_dumpall command line arguments, and exit.", "signature": {"url": "/docs/19/app-pg-dumpall.html", "text": "-? --help"}}, {"summary": "Specifies parameters used to connect to the server, as a connection string ; these will override any conflicting command line options.", "signature": {"url": "/docs/19/app-pg-dumpall.html", "text": "-d connstr --dbname= connstr"}}, {"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": {"url": "/docs/19/app-pg-dumpall.html", "text": "-h host --host= host"}}, {"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": {"url": "/docs/19/app-pg-dumpall.html", "text": "-l dbname --database= dbname"}}, {"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": {"url": "/docs/19/app-pg-dumpall.html", "text": "-p port --port= port"}}, {"summary": "User name to connect as.", "signature": {"url": "/docs/19/app-pg-dumpall.html", "text": "-U username --username= username"}}, {"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": {"url": "/docs/19/app-pg-dumpall.html", "text": "-w --no-password"}}, {"summary": "Force pg_dumpall to prompt for a password before connecting to a database.", "signature": {"url": "/docs/19/app-pg-dumpall.html", "text": "-W --password"}}, {"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.", "signature": {"url": "/docs/19/app-pg-dumpall.html", "text": "--role= rolename"}}], "title": "Documented options", "columns": [{"key": "signature", "label": "Option and arguments"}, {"key": "summary", "label": "Description"}]}, {"key": "environment", "rows": [{"name": "PGHOST PGOPTIONS PGPORT PGUSER", "description": "Default connection parameters"}, {"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}], "title": "Environment variables", "columns": [{"key": "name", "label": "Variable"}, {"key": "description", "label": "Meaning"}]}], "options": [{"names": ["-a", "--data-only"], "summary": "Dump only the data, not the schema (data definitions) or statistics.", "signature": "-a --data-only", "source_url": "/docs/19/app-pg-dumpall.html", "description": "Dump only the data, not the schema (data definitions) or statistics."}, {"names": ["-c", "--clean"], "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": "-c --clean", "source_url": "/docs/19/app-pg-dumpall.html", "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": ["-E encoding", "--encoding= encoding"], "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": "-E encoding --encoding= encoding", "source_url": "/docs/19/app-pg-dumpall.html", "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": ["-f filename", "--file= filename"], "summary": "Send output to the specified file. If this is omitted, the standard output is used.", "signature": "-f filename --file= filename", "source_url": "/docs/19/app-pg-dumpall.html", "description": "Send output to the specified file. If this is omitted, the standard output is used."}, {"names": ["-g", "--globals-only"], "summary": "Dump only global objects (roles and tablespaces), no databases.", "signature": "-g --globals-only", "source_url": "/docs/19/app-pg-dumpall.html", "description": "Dump only global objects (roles and tablespaces), no databases."}, {"names": ["-O", "--no-owner"], "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": "-O --no-owner", "source_url": "/docs/19/app-pg-dumpall.html", "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": ["-r", "--roles-only"], "summary": "Dump only roles, no databases or tablespaces.", "signature": "-r --roles-only", "source_url": "/docs/19/app-pg-dumpall.html", "description": "Dump only roles, no databases or tablespaces."}, {"names": ["-s", "--schema-only"], "summary": "Dump only the object definitions (schema), not data.", "signature": "-s --schema-only", "source_url": "/docs/19/app-pg-dumpall.html", "description": "Dump only the object definitions (schema), not data."}, {"names": ["-S username", "--superuser= username"], "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": "-S username --superuser= username", "source_url": "/docs/19/app-pg-dumpall.html", "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": ["-t", "--tablespaces-only"], "summary": "Dump only tablespaces, no databases or roles.", "signature": "-t --tablespaces-only", "source_url": "/docs/19/app-pg-dumpall.html", "description": "Dump only tablespaces, no databases or roles."}, {"names": ["-v", "--verbose"], "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": "-v --verbose", "source_url": "/docs/19/app-pg-dumpall.html", "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", "--version"], "summary": "Print the pg_dumpall version and exit.", "signature": "-V --version", "source_url": "/docs/19/app-pg-dumpall.html", "description": "Print the pg_dumpall version and exit."}, {"names": ["-x", "--no-privileges", "--no-acl"], "summary": "Prevent dumping of access privileges (grant/revoke commands).", "signature": "-x --no-privileges --no-acl", "source_url": "/docs/19/app-pg-dumpall.html", "description": "Prevent dumping of access privileges (grant/revoke commands)."}, {"names": ["--binary-upgrade"], "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": "--binary-upgrade", "source_url": "/docs/19/app-pg-dumpall.html", "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": ["--column-inserts", "--attribute-inserts"], "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": "--column-inserts --attribute-inserts", "source_url": "/docs/19/app-pg-dumpall.html", "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": ["--disable-dollar-quoting"], "summary": "This option disables the use of dollar quoting for function bodies, and forces them to be quoted using SQL standard string syntax.", "signature": "--disable-dollar-quoting", "source_url": "/docs/19/app-pg-dumpall.html", "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-triggers"], "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": "--disable-triggers", "source_url": "/docs/19/app-pg-dumpall.html", "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": ["--exclude-database= pattern"], "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": "--exclude-database= pattern", "source_url": "/docs/19/app-pg-dumpall.html", "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": ["--extra-float-digits= ndigits"], "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": "--extra-float-digits= ndigits", "source_url": "/docs/19/app-pg-dumpall.html", "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": ["--filter= filename"], "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": "--filter= filename", "source_url": "/docs/19/app-pg-dumpall.html", "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": ["--if-exists"], "summary": "Use DROP ... IF EXISTS commands to drop objects in --clean mode. This suppresses \u201c does not exist \u201d errors that might otherwise be reported. This option is not valid unless --clean is also specified.", "signature": "--if-exists", "source_url": "/docs/19/app-pg-dumpall.html", "description": "Use DROP ... IF EXISTS commands to drop objects in --clean mode. This suppresses \u201c does not exist \u201d errors that might otherwise be reported. This option is not valid unless --clean is also specified."}, {"names": ["--inserts"], "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": "--inserts", "source_url": "/docs/19/app-pg-dumpall.html", "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": ["--load-via-partition-root"], "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": "--load-via-partition-root", "source_url": "/docs/19/app-pg-dumpall.html", "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": ["--lock-wait-timeout= timeout"], "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": "--lock-wait-timeout= timeout", "source_url": "/docs/19/app-pg-dumpall.html", "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": ["--no-comments"], "summary": "Do not dump COMMENT commands.", "signature": "--no-comments", "source_url": "/docs/19/app-pg-dumpall.html", "description": "Do not dump COMMENT commands."}, {"names": ["--no-data"], "summary": "Do not dump data.", "signature": "--no-data", "source_url": "/docs/19/app-pg-dumpall.html", "description": "Do not dump data."}, {"names": ["--no-policies"], "summary": "Do not dump row security policies.", "signature": "--no-policies", "source_url": "/docs/19/app-pg-dumpall.html", "description": "Do not dump row security policies."}, {"names": ["--no-publications"], "summary": "Do not dump publications.", "signature": "--no-publications", "source_url": "/docs/19/app-pg-dumpall.html", "description": "Do not dump publications."}, {"names": ["--no-role-passwords"], "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": "--no-role-passwords", "source_url": "/docs/19/app-pg-dumpall.html", "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-schema"], "summary": "Do not dump schema (data definitions).", "signature": "--no-schema", "source_url": "/docs/19/app-pg-dumpall.html", "description": "Do not dump schema (data definitions)."}, {"names": ["--no-security-labels"], "summary": "Do not dump security labels.", "signature": "--no-security-labels", "source_url": "/docs/19/app-pg-dumpall.html", "description": "Do not dump security labels."}, {"names": ["--no-statistics"], "summary": "Do not dump statistics. This is the default.", "signature": "--no-statistics", "source_url": "/docs/19/app-pg-dumpall.html", "description": "Do not dump statistics. This is the default."}, {"names": ["--no-subscriptions"], "summary": "Do not dump subscriptions.", "signature": "--no-subscriptions", "source_url": "/docs/19/app-pg-dumpall.html", "description": "Do not dump subscriptions."}, {"names": ["--no-sync"], "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": "--no-sync", "source_url": "/docs/19/app-pg-dumpall.html", "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-table-access-method"], "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": "--no-table-access-method", "source_url": "/docs/19/app-pg-dumpall.html", "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-tablespaces"], "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": "--no-tablespaces", "source_url": "/docs/19/app-pg-dumpall.html", "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-toast-compression"], "summary": "Do not output commands to set TOAST compression methods. With this option, all columns will be restored with the default compression setting.", "signature": "--no-toast-compression", "source_url": "/docs/19/app-pg-dumpall.html", "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-unlogged-table-data"], "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": "--no-unlogged-table-data", "source_url": "/docs/19/app-pg-dumpall.html", "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": ["--on-conflict-do-nothing"], "summary": "Add ON CONFLICT DO NOTHING to INSERT commands. This option is not valid unless --inserts or --column-inserts is also specified.", "signature": "--on-conflict-do-nothing", "source_url": "/docs/19/app-pg-dumpall.html", "description": "Add ON CONFLICT DO NOTHING to INSERT commands. This option is not valid unless --inserts or --column-inserts is also specified."}, {"names": ["--quote-all-identifiers"], "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": "--quote-all-identifiers", "source_url": "/docs/19/app-pg-dumpall.html", "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": ["--restrict-key= restrict_key"], "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": "--restrict-key= restrict_key", "source_url": "/docs/19/app-pg-dumpall.html", "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": ["--rows-per-insert= nrows"], "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": "--rows-per-insert= nrows", "source_url": "/docs/19/app-pg-dumpall.html", "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": ["--statistics"], "summary": "Dump optimizer statistics.", "signature": "--statistics", "source_url": "/docs/19/app-pg-dumpall.html", "description": "Dump optimizer statistics."}, {"names": ["--statistics-only"], "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": "--statistics-only", "source_url": "/docs/19/app-pg-dumpall.html", "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": ["--sequence-data"], "summary": "Include sequence data in the dump. This is the default behavior except when --no-data , --schema-only , or --statistics-only is specified.", "signature": "--sequence-data", "source_url": "/docs/19/app-pg-dumpall.html", "description": "Include sequence data in the dump. This is the default behavior except when --no-data , --schema-only , or --statistics-only is specified."}, {"names": ["--use-set-session-authorization"], "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": "--use-set-session-authorization", "source_url": "/docs/19/app-pg-dumpall.html", "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": ["-?", "--help"], "summary": "Show help about pg_dumpall command line arguments, and exit.", "signature": "-? --help", "source_url": "/docs/19/app-pg-dumpall.html", "description": "Show help about pg_dumpall command line arguments, and exit."}, {"names": ["-d connstr", "--dbname= connstr"], "summary": "Specifies parameters used to connect to the server, as a connection string ; these will override any conflicting command line options.", "signature": "-d connstr --dbname= connstr", "source_url": "/docs/19/app-pg-dumpall.html", "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": ["-h host", "--host= host"], "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": "-h host --host= host", "source_url": "/docs/19/app-pg-dumpall.html", "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": ["-l dbname", "--database= dbname"], "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": "-l dbname --database= dbname", "source_url": "/docs/19/app-pg-dumpall.html", "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": ["-p port", "--port= port"], "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": "-p port --port= port", "source_url": "/docs/19/app-pg-dumpall.html", "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": ["-U username", "--username= username"], "summary": "User name to connect as.", "signature": "-U username --username= username", "source_url": "/docs/19/app-pg-dumpall.html", "description": "User name to connect as."}, {"names": ["-w", "--no-password"], "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": "-w --no-password", "source_url": "/docs/19/app-pg-dumpall.html", "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", "--password"], "summary": "Force pg_dumpall to prompt for a password before connecting to a database.", "signature": "-W --password", "source_url": "/docs/19/app-pg-dumpall.html", "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": ["--role= rolename"], "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.", "signature": "--role= rolename", "source_url": "/docs/19/app-pg-dumpall.html", "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."}], "related": [{"url": "/wiki/conn/?v=19", "label": "libpq connection parameters"}], "release": {"ref": "https://ftp.postgresql.org/pub/source/v19beta4/postgresql-19beta4.tar.bz2", "label": "19beta4", "major": "19", "channel": "preview", "manifest": {"pdf": {"A4": {"url": "/files/documentation/pdf/19/postgresql-19-A4.pdf", "bytes": 16064841, "pages": 3052, "sha256": "4dd099e4125c591128fc5f3ebd02178dc24781f9e5ae629f96d67c4c8547427b", "built_at": "2026-09-26"}, "US": {"url": "/files/documentation/pdf/19/postgresql-19-US.pdf", "bytes": 15974616, "pages": 3225, "sha256": "61971fa857f0956d47341a0388fa6af9ae10acf691d4b2fc009007d384b0342b", "built_at": "2026-09-26"}}, "tree": "19", "index": "index.html", "major": "19", "pages": 1155, "release": "19beta4", "source_url": "https://ftp.postgresql.org/pub/source/v19beta4/postgresql-19beta4.tar.bz2", "svg_assets": 5, "source_mode": "en SGML built with pinned official archive", "source_sha256": "83157ee9c599d03b2f7a3d73ef3a56ec24e0e79cc2b3501a64d1364f56398c86"}, "revision": "1bbbbf4133d426f0e4304010688d2984c30fb67df0cc3a61b3e37eb3f6f37833", "evidence_kind": "English manual and source declarations", "source_sha256": "83157ee9c599d03b2f7a3d73ef3a56ec24e0e79cc2b3501a64d1364f56398c86"}, "sources": [{"url": "/docs/19/app-pg-dumpall.html", "file": "app-pg-dumpall.html", "label": "19beta4 English manual \u00b7 app-pg-dumpall.html", "anchor": "", "sha256": "1b13ec00b843b047aa39166330c02218809958c20afb6df5b5baf83fdfaacbd8"}, {"url": "/docs/19/reference-client.html", "file": "reference-client.html", "label": "Client applications inventory", "anchor": "", "sha256": "c827f460db781b39da305303c88e73729a419cd2b2b9dedb126d8ad5cbf02c95"}], "sections": [], "synopsis": ["pg_dumpall [ connection-option ...] [ option ...]"], "signature": "pg_dumpall [ connection-option ...] [ option ...]", "description": ["pg_dumpall \u2014 extract a PostgreSQL database cluster into a script file"], "environment": [{"name": "PGHOST PGOPTIONS PGPORT PGUSER", "description": "Default connection parameters"}, {"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}], "manual_html": "<div><div class=\"refentry\" id=\"APP-PG-DUMPALL\">\n<div class=\"titlepage\"></div>\n<div class=\"refnamediv\">\n<h2><span class=\"refentrytitle\"><span class=\"application\">pg_dumpall</span></span></h2>\n<p>pg_dumpall \u2014 extract a <span class=\"productname\">PostgreSQL</span> database cluster into a script file</p>\n</div>\n<div class=\"refsynopsisdiv\">\n<h2>Synopsis</h2>\n<div class=\"cmdsynopsis\">\n<p id=\"id-1.9.4.15.4.1\"><code class=\"command\">pg_dumpall</code> [<em class=\"replaceable\"><code>connection-option</code></em>...] [<em class=\"replaceable\"><code>option</code></em>...]</p>\n</div>\n</div>\n<div class=\"refsect1\" id=\"APP-PG-DUMPALL-DESCRIPTION\">\n<h2>Description</h2>\n<p><span class=\"application\">pg_dumpall</span> is a utility for writing out (<span class=\"quote\">\u201c<span class=\"quote\">dumping</span>\u201d</span>) all <span class=\"productname\">PostgreSQL</span> databases of a cluster into one script file. The script file contains SQL commands that can be used as input to <a class=\"xref\" href=\"/docs/19/app-psql.html\" title=\"psql\"><span class=\"refentrytitle\"><span class=\"application\">psql</span></span></a> to restore the databases. It does this by calling <a class=\"xref\" href=\"/docs/19/app-pgdump.html\" title=\"pg_dump\"><span class=\"refentrytitle\"><span class=\"application\">pg_dump</span></span></a> for each database in the cluster. <span class=\"application\">pg_dumpall</span> also dumps global objects that are common to all databases, namely database roles, tablespaces, and privilege grants for configuration parameters. (<span class=\"application\">pg_dump</span> does not save these objects.)</p>\n<p>Since <span class=\"application\">pg_dumpall</span> 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.</p>\n<p>The SQL script will be written to the standard output. Use the <code class=\"option\">-f</code>/<code class=\"option\">--file</code> option or shell operators to redirect it into a file.</p>\n<p><span class=\"application\">pg_dumpall</span> needs to connect several times to the <span class=\"productname\">PostgreSQL</span> server (once per database). If you use password authentication it will ask for a password each time. It is convenient to have a <code class=\"filename\">~/.pgpass</code> file in such cases. See <a class=\"xref\" href=\"/docs/19/libpq-pgpass.html\" title=\"32.16.\u00a0The Password File\">Section\u00a032.16</a> for more information.</p>\n<div class=\"warning\">\n<h3 class=\"title\">Warning</h3>\n<p>Restoring 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.</p>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.15.6\">\n<h2>Options</h2>\n<p>The following command-line options control the content and format of the output.</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-a</code><br></span><span class=\"term\"><code class=\"option\">--data-only</code></span></dt>\n<dd>\n<p>Dump only the data, not the schema (data definitions) or statistics.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-c</code><br></span><span class=\"term\"><code class=\"option\">--clean</code></span></dt>\n<dd>\n<p>Emit SQL commands to <code class=\"command\">DROP</code> 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 <code class=\"option\">--if-exists</code> is also specified.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-E <em class=\"replaceable\"><code>encoding</code></em></code><br></span><span class=\"term\"><code class=\"option\">--encoding=<em class=\"replaceable\"><code>encoding</code></em></code></span></dt>\n<dd>\n<p>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 <code class=\"envar\">PGCLIENTENCODING</code> environment variable to the desired dump encoding.)</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-f <em class=\"replaceable\"><code>filename</code></em></code><br></span><span class=\"term\"><code class=\"option\">--file=<em class=\"replaceable\"><code>filename</code></em></code></span></dt>\n<dd>\n<p>Send output to the specified file. If this is omitted, the standard output is used.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-g</code><br></span><span class=\"term\"><code class=\"option\">--globals-only</code></span></dt>\n<dd>\n<p>Dump only global objects (roles and tablespaces), no databases.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-O</code><br></span><span class=\"term\"><code class=\"option\">--no-owner</code></span></dt>\n<dd>\n<p>Do not output commands to set ownership of objects to match the original database. By default, <span class=\"application\">pg_dumpall</span> issues <code class=\"command\">ALTER OWNER</code> or <code class=\"command\">SET SESSION AUTHORIZATION</code> 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 <code class=\"option\">-O</code>.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-r</code><br></span><span class=\"term\"><code class=\"option\">--roles-only</code></span></dt>\n<dd>\n<p>Dump only roles, no databases or tablespaces.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-s</code><br></span><span class=\"term\"><code class=\"option\">--schema-only</code></span></dt>\n<dd>\n<p>Dump only the object definitions (schema), not data.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-S <em class=\"replaceable\"><code>username</code></em></code><br></span><span class=\"term\"><code class=\"option\">--superuser=<em class=\"replaceable\"><code>username</code></em></code></span></dt>\n<dd>\n<p>Specify the superuser user name to use when disabling triggers. This is relevant only if <code class=\"option\">--disable-triggers</code> is used. (Usually, it's better to leave this out, and instead start the resulting script as superuser.)</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-t</code><br></span><span class=\"term\"><code class=\"option\">--tablespaces-only</code></span></dt>\n<dd>\n<p>Dump only tablespaces, no databases or roles.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-v</code><br></span><span class=\"term\"><code class=\"option\">--verbose</code></span></dt>\n<dd>\n<p>Specifies verbose mode. This will cause <span class=\"application\">pg_dumpall</span> 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 <span class=\"application\">pg_dump</span>.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-V</code><br></span><span class=\"term\"><code class=\"option\">--version</code></span></dt>\n<dd>\n<p>Print the <span class=\"application\">pg_dumpall</span> version and exit.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-x</code><br></span><span class=\"term\"><code class=\"option\">--no-privileges</code><br></span><span class=\"term\"><code class=\"option\">--no-acl</code></span></dt>\n<dd>\n<p>Prevent dumping of access privileges (grant/revoke commands).</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--binary-upgrade</code></span></dt>\n<dd>\n<p>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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--column-inserts</code><br></span><span class=\"term\"><code class=\"option\">--attribute-inserts</code></span></dt>\n<dd>\n<p>Dump data as <code class=\"command\">INSERT</code> commands with explicit column names (<code class=\"literal\">INSERT INTO <em class=\"replaceable\"><code>table</code></em> (<em class=\"replaceable\"><code>column</code></em>, ...) VALUES ...</code>). This will make restoration very slow; it is mainly useful for making dumps that can be loaded into non-<span class=\"productname\">PostgreSQL</span> databases.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--disable-dollar-quoting</code></span></dt>\n<dd>\n<p>This option disables the use of dollar quoting for function bodies, and forces them to be quoted using SQL standard string syntax.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--disable-triggers</code></span></dt>\n<dd>\n<p>This option is relevant only when creating a dump with data and without schema. It instructs <span class=\"application\">pg_dumpall</span> 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.</p>\n<p>Presently, the commands emitted for <code class=\"option\">--disable-triggers</code> must be done as superuser. So, you should also specify a superuser name with <code class=\"option\">-S</code>, or preferably be careful to start the resulting script as a superuser.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--exclude-database=<em class=\"replaceable\"><code>pattern</code></em></code></span></dt>\n<dd>\n<p>Do not dump databases whose name matches <em class=\"replaceable\"><code>pattern</code></em>. Multiple patterns can be excluded by writing multiple <code class=\"option\">--exclude-database</code> switches. The <em class=\"replaceable\"><code>pattern</code></em> parameter is interpreted as a pattern according to the same rules used by <span class=\"application\">psql</span>'s <code class=\"literal\">\\d</code> commands (see <a class=\"xref\" href=\"/docs/19/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\">Patterns</a>), 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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--extra-float-digits=<em class=\"replaceable\"><code>ndigits</code></em></code></span></dt>\n<dd>\n<p>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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--filter=<em class=\"replaceable\"><code>filename</code></em></code></span></dt>\n<dd>\n<p>Specify a filename from which to read patterns for databases excluded from the dump. The patterns are interpreted according to the same rules as <code class=\"option\">--exclude-database</code>. To read from <code class=\"literal\">STDIN</code>, use <code class=\"filename\">-</code> as the filename. The <code class=\"option\">--filter</code> option can be specified in conjunction with <code class=\"option\">--exclude-database</code> for excluding databases, and can also be specified more than once for multiple filter files.</p>\n<p>The file lists one database pattern per row, with the following format:</p>\n<pre class=\"synopsis\">exclude database <em class=\"replaceable\"><code>PATTERN</code></em>\n</pre>\n<p>Lines starting with <code class=\"literal\">#</code> are considered comments and ignored. Comments can be placed after an object pattern row as well. Blank lines are also ignored. See <a class=\"xref\" href=\"/docs/19/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\">Patterns</a> for how to perform quoting in patterns.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--if-exists</code></span></dt>\n<dd>\n<p>Use <code class=\"literal\">DROP ... IF EXISTS</code> commands to drop objects in <code class=\"option\">--clean</code> mode. This suppresses <span class=\"quote\">\u201c<span class=\"quote\">does not exist</span>\u201d</span> errors that might otherwise be reported. This option is not valid unless <code class=\"option\">--clean</code> is also specified.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--inserts</code></span></dt>\n<dd>\n<p>Dump data as <code class=\"command\">INSERT</code> commands (rather than <code class=\"command\">COPY</code>). This will make restoration very slow; it is mainly useful for making dumps that can be loaded into non-<span class=\"productname\">PostgreSQL</span> databases. Note that the restore might fail altogether if you have rearranged column order. The <code class=\"option\">--column-inserts</code> option is safer, though even slower.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--load-via-partition-root</code></span></dt>\n<dd>\n<p>When dumping data for a table partition, make the <code class=\"command\">COPY</code> or <code class=\"command\">INSERT</code> 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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--lock-wait-timeout=<em class=\"replaceable\"><code>timeout</code></em></code></span></dt>\n<dd>\n<p>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 <em class=\"replaceable\"><code>timeout</code></em>. The timeout may be specified in any of the formats accepted by <code class=\"command\">SET statement_timeout</code>.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-comments</code></span></dt>\n<dd>\n<p>Do not dump <code class=\"command\">COMMENT</code> commands.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-data</code></span></dt>\n<dd>\n<p>Do not dump data.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-policies</code></span></dt>\n<dd>\n<p>Do not dump row security policies.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-publications</code></span></dt>\n<dd>\n<p>Do not dump publications.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-role-passwords</code></span></dt>\n<dd>\n<p>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 <code class=\"structname\">pg_roles</code> instead of <code class=\"structname\">pg_authid</code>. Therefore, this option also helps if access to <code class=\"structname\">pg_authid</code> is restricted by some security policy.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-schema</code></span></dt>\n<dd>\n<p>Do not dump schema (data definitions).</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-security-labels</code></span></dt>\n<dd>\n<p>Do not dump security labels.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-statistics</code></span></dt>\n<dd>\n<p>Do not dump statistics. This is the default.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-subscriptions</code></span></dt>\n<dd>\n<p>Do not dump subscriptions.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-sync</code></span></dt>\n<dd>\n<p>By default, <code class=\"command\">pg_dumpall</code> will wait for all files to be written safely to disk. This option causes <code class=\"command\">pg_dumpall</code> 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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-table-access-method</code></span></dt>\n<dd>\n<p>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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-tablespaces</code></span></dt>\n<dd>\n<p>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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-toast-compression</code></span></dt>\n<dd>\n<p>Do not output commands to set TOAST compression methods. With this option, all columns will be restored with the default compression setting.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-unlogged-table-data</code></span></dt>\n<dd>\n<p>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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--on-conflict-do-nothing</code></span></dt>\n<dd>\n<p>Add <code class=\"literal\">ON CONFLICT DO NOTHING</code> to <code class=\"command\">INSERT</code> commands. This option is not valid unless <code class=\"option\">--inserts</code> or <code class=\"option\">--column-inserts</code> is also specified.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--quote-all-identifiers</code></span></dt>\n<dd>\n<p>Force quoting of all identifiers. This option is recommended when dumping a database from a server whose <span class=\"productname\">PostgreSQL</span> major version is different from <span class=\"application\">pg_dumpall</span>'s, or when the output is intended to be loaded into a server of a different major version. By default, <span class=\"application\">pg_dumpall</span> 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 <code class=\"option\">--quote-all-identifiers</code> prevents such issues, at the price of a harder-to-read dump script.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--restrict-key=<em class=\"replaceable\"><code>restrict_key</code></em></code></span></dt>\n<dd>\n<p>Use the provided string as the <span class=\"application\">psql</span> <code class=\"command\">\\restrict</code> key in the dump output. If no restrict key is specified, <span class=\"application\">pg_dumpall</span> will generate a random one as needed. Keys may contain only alphanumeric characters.</p>\n<p>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 <span class=\"application\">psql</span> with the dump output.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--rows-per-insert=<em class=\"replaceable\"><code>nrows</code></em></code></span></dt>\n<dd>\n<p>Dump data as <code class=\"command\">INSERT</code> commands (rather than <code class=\"command\">COPY</code>). Controls the maximum number of rows per <code class=\"command\">INSERT</code> 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 <code class=\"command\">INSERT</code> to be lost, rather than the entire table contents.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--statistics</code></span></dt>\n<dd>\n<p>Dump optimizer statistics.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--statistics-only</code></span></dt>\n<dd>\n<p>Dump only the statistics, not the schema (data definitions) or data. Optimizer statistics for tables, materialized views, foreign tables, and indexes are dumped.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--sequence-data</code></span></dt>\n<dd>\n<p>Include sequence data in the dump. This is the default behavior except when <code class=\"option\">--no-data</code>, <code class=\"option\">--schema-only</code>, or <code class=\"option\">--statistics-only</code> is specified.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--use-set-session-authorization</code></span></dt>\n<dd>\n<p>Output SQL-standard <code class=\"command\">SET SESSION AUTHORIZATION</code> commands instead of <code class=\"command\">ALTER OWNER</code> 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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-?</code><br></span><span class=\"term\"><code class=\"option\">--help</code></span></dt>\n<dd>\n<p>Show help about <span class=\"application\">pg_dumpall</span> command line arguments, and exit.</p>\n</dd>\n</dl>\n</div>\n<p>The following command-line options control the database connection parameters.</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-d <em class=\"replaceable\"><code>connstr</code></em></code><br></span><span class=\"term\"><code class=\"option\">--dbname=<em class=\"replaceable\"><code>connstr</code></em></code></span></dt>\n<dd>\n<p>Specifies parameters used to connect to the server, as a <a class=\"link\" href=\"/docs/19/libpq-connect.html#LIBPQ-CONNSTRING\" title=\"32.1.1.\u00a0Connection Strings\">connection string</a>; these will override any conflicting command line options.</p>\n<p>The option is called <code class=\"literal\">--dbname</code> for consistency with other client applications, but because <span class=\"application\">pg_dumpall</span> needs to connect to many databases, the database name in the connection string will be ignored. Use the <code class=\"literal\">-l</code> 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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-h <em class=\"replaceable\"><code>host</code></em></code><br></span><span class=\"term\"><code class=\"option\">--host=<em class=\"replaceable\"><code>host</code></em></code></span></dt>\n<dd>\n<p>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 <code class=\"envar\">PGHOST</code> environment variable, if set, else a Unix domain socket connection is attempted.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-l <em class=\"replaceable\"><code>dbname</code></em></code><br></span><span class=\"term\"><code class=\"option\">--database=<em class=\"replaceable\"><code>dbname</code></em></code></span></dt>\n<dd>\n<p>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 <code class=\"literal\">postgres</code> database will be used, and if that does not exist, <code class=\"literal\">template1</code> will be used.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-p <em class=\"replaceable\"><code>port</code></em></code><br></span><span class=\"term\"><code class=\"option\">--port=<em class=\"replaceable\"><code>port</code></em></code></span></dt>\n<dd>\n<p>Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the <code class=\"envar\">PGPORT</code> environment variable, if set, or a compiled-in default.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-U <em class=\"replaceable\"><code>username</code></em></code><br></span><span class=\"term\"><code class=\"option\">--username=<em class=\"replaceable\"><code>username</code></em></code></span></dt>\n<dd>\n<p>User name to connect as.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-w</code><br></span><span class=\"term\"><code class=\"option\">--no-password</code></span></dt>\n<dd>\n<p>Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a <code class=\"filename\">.pgpass</code> 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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-W</code><br></span><span class=\"term\"><code class=\"option\">--password</code></span></dt>\n<dd>\n<p>Force <span class=\"application\">pg_dumpall</span> to prompt for a password before connecting to a database.</p>\n<p>This option is never essential, since <span class=\"application\">pg_dumpall</span> will automatically prompt for a password if the server demands password authentication. However, <span class=\"application\">pg_dumpall</span> will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing <code class=\"option\">-W</code> to avoid the extra connection attempt.</p>\n<p>Note that the password prompt will occur again for each database to be dumped. Usually, it's better to set up a <code class=\"filename\">~/.pgpass</code> file than to rely on manual password entry.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--role=<em class=\"replaceable\"><code>rolename</code></em></code></span></dt>\n<dd>\n<p>Specifies a role name to be used to create the dump. This option causes <span class=\"application\">pg_dumpall</span> to issue a <code class=\"command\">SET ROLE</code> <em class=\"replaceable\"><code>rolename</code></em> command after connecting to the database. It is useful when the authenticated user (specified by <code class=\"option\">-U</code>) lacks privileges needed by <span class=\"application\">pg_dumpall</span>, 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.</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.15.7\">\n<h2>Environment</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"envar\">PGHOST</code><br></span><span class=\"term\"><code class=\"envar\">PGOPTIONS</code><br></span><span class=\"term\"><code class=\"envar\">PGPORT</code><br></span><span class=\"term\"><code class=\"envar\">PGUSER</code></span></dt>\n<dd>\n<p>Default connection parameters</p>\n</dd>\n<dt><span class=\"term\"><code class=\"envar\">PG_COLOR</code></span></dt>\n<dd>\n<p>Specifies whether to use color in diagnostic messages. Possible values are <code class=\"literal\">always</code>, <code class=\"literal\">auto</code> and <code class=\"literal\">never</code>.</p>\n</dd>\n</dl>\n</div>\n<p>This utility, like most other <span class=\"productname\">PostgreSQL</span> utilities, also uses the environment variables supported by <span class=\"application\">libpq</span> (see <a class=\"xref\" href=\"/docs/19/libpq-envars.html\" title=\"32.15.\u00a0Environment Variables\">Section\u00a032.15</a>).</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.15.8\">\n<h2>Notes</h2>\n<p>Since <span class=\"application\">pg_dumpall</span> calls <span class=\"application\">pg_dump</span> internally, some diagnostic messages will refer to <span class=\"application\">pg_dump</span>.</p>\n<p>The <code class=\"option\">--clean</code> option can be useful even when your intention is to restore the dump script into a fresh cluster. Use of <code class=\"option\">--clean</code> authorizes the script to drop and re-create the built-in <code class=\"literal\">postgres</code> and <code class=\"literal\">template1</code> 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.</p>\n<p>When <code class=\"option\">--statistics</code> is specified, <code class=\"command\">pg_dumpall</code> will include most optimizer statistics in the resulting dump file. This does not include all statistics, such as custom statistics added by an extension, or statistics collected by the cumulative statistics system. Therefore, it may still be useful to run <code class=\"command\">ANALYZE</code> on each database after restoring from a dump file to ensure optimal performance. You can also run <code class=\"command\">vacuumdb -a -z</code> to analyze all databases.</p>\n<p>The dump script should not be expected to run completely without errors. In particular, because the script will issue <code class=\"command\">CREATE ROLE</code> for every role existing in the source cluster, it is certain to get a <span class=\"quote\">\u201c<span class=\"quote\">role already exists</span>\u201d</span> 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 <code class=\"option\">--clean</code> option is likely to produce additional harmless error messages about non-existent objects, although you can minimize those by adding <code class=\"option\">--if-exists</code>.</p>\n<p><span class=\"application\">pg_dumpall</span> requires all needed tablespace directories to exist before the restore; otherwise, database creation will fail for databases in non-default locations.</p>\n<p>It is generally recommended to use the <code class=\"option\">-X</code> (<code class=\"option\">--no-psqlrc</code>) option when restoring a database from a <span class=\"application\">pg_dumpall</span> script to ensure a clean restore process and prevent potential conflicts with non-default <span class=\"application\">psql</span> configurations. Additionally, because the <span class=\"application\">pg_dumpall</span> script may include <span class=\"application\">psql</span> meta-commands, it may be incompatible with clients other than <span class=\"application\">psql</span>.</p>\n</div>\n<div class=\"refsect1\" id=\"APP-PG-DUMPALL-EX\">\n<h2>Examples</h2>\n<p>To dump all databases:</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_dumpall &gt; db.out</code></strong>\n</pre>\n<p>To restore database(s) from this file, you can use:</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>psql -X -f db.out -d postgres</code></strong>\n</pre>\n<p>It is not important which database you connect to here since the script file created by <span class=\"application\">pg_dumpall</span> will contain the appropriate commands to create and connect to the saved databases. An exception is that if you specified <code class=\"option\">--clean</code>, you must connect to the <code class=\"literal\">postgres</code> database initially; the script will attempt to drop other databases immediately, and that will fail for the database you are connected to.</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.15.10\">\n<h2>See Also</h2>\n<p>Check <a class=\"xref\" href=\"/docs/19/app-pgdump.html\" title=\"pg_dump\"><span class=\"refentrytitle\"><span class=\"application\">pg_dump</span></span></a> for details on possible error conditions.</p>\n</div>\n</div></div>", "manual_path": "app-pg-dumpall.html", "comparison_data": {"options": [{"names": ["-a", "--data-only"], "signature": "-a --data-only", "description": "Dump only the data, not the schema (data definitions) or statistics."}, {"names": ["-c", "--clean"], "signature": "-c --clean", "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": ["-E encoding", "--encoding= encoding"], "signature": "-E encoding --encoding= encoding", "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": ["-f filename", "--file= filename"], "signature": "-f filename --file= filename", "description": "Send output to the specified file. If this is omitted, the standard output is used."}, {"names": ["-g", "--globals-only"], "signature": "-g --globals-only", "description": "Dump only global objects (roles and tablespaces), no databases."}, {"names": ["-O", "--no-owner"], "signature": "-O --no-owner", "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": ["-r", "--roles-only"], "signature": "-r --roles-only", "description": "Dump only roles, no databases or tablespaces."}, {"names": ["-s", "--schema-only"], "signature": "-s --schema-only", "description": "Dump only the object definitions (schema), not data."}, {"names": ["-S username", "--superuser= username"], "signature": "-S username --superuser= username", "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": ["-t", "--tablespaces-only"], "signature": "-t --tablespaces-only", "description": "Dump only tablespaces, no databases or roles."}, {"names": ["-v", "--verbose"], "signature": "-v --verbose", "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", "--version"], "signature": "-V --version", "description": "Print the pg_dumpall version and exit."}, {"names": ["-x", "--no-privileges", "--no-acl"], "signature": "-x --no-privileges --no-acl", "description": "Prevent dumping of access privileges (grant/revoke commands)."}, {"names": ["--binary-upgrade"], "signature": "--binary-upgrade", "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": ["--column-inserts", "--attribute-inserts"], "signature": "--column-inserts --attribute-inserts", "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": ["--disable-dollar-quoting"], "signature": "--disable-dollar-quoting", "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-triggers"], "signature": "--disable-triggers", "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": ["--exclude-database= pattern"], "signature": "--exclude-database= pattern", "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": ["--extra-float-digits= ndigits"], "signature": "--extra-float-digits= ndigits", "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": ["--filter= filename"], "signature": "--filter= filename", "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": ["--if-exists"], "signature": "--if-exists", "description": "Use DROP ... IF EXISTS commands to drop objects in --clean mode. This suppresses \u201c does not exist \u201d errors that might otherwise be reported. This option is not valid unless --clean is also specified."}, {"names": ["--inserts"], "signature": "--inserts", "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": ["--load-via-partition-root"], "signature": "--load-via-partition-root", "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": ["--lock-wait-timeout= timeout"], "signature": "--lock-wait-timeout= timeout", "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": ["--no-comments"], "signature": "--no-comments", "description": "Do not dump COMMENT commands."}, {"names": ["--no-data"], "signature": "--no-data", "description": "Do not dump data."}, {"names": ["--no-policies"], "signature": "--no-policies", "description": "Do not dump row security policies."}, {"names": ["--no-publications"], "signature": "--no-publications", "description": "Do not dump publications."}, {"names": ["--no-role-passwords"], "signature": "--no-role-passwords", "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-schema"], "signature": "--no-schema", "description": "Do not dump schema (data definitions)."}, {"names": ["--no-security-labels"], "signature": "--no-security-labels", "description": "Do not dump security labels."}, {"names": ["--no-statistics"], "signature": "--no-statistics", "description": "Do not dump statistics. This is the default."}, {"names": ["--no-subscriptions"], "signature": "--no-subscriptions", "description": "Do not dump subscriptions."}, {"names": ["--no-sync"], "signature": "--no-sync", "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-table-access-method"], "signature": "--no-table-access-method", "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-tablespaces"], "signature": "--no-tablespaces", "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-toast-compression"], "signature": "--no-toast-compression", "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-unlogged-table-data"], "signature": "--no-unlogged-table-data", "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": ["--on-conflict-do-nothing"], "signature": "--on-conflict-do-nothing", "description": "Add ON CONFLICT DO NOTHING to INSERT commands. This option is not valid unless --inserts or --column-inserts is also specified."}, {"names": ["--quote-all-identifiers"], "signature": "--quote-all-identifiers", "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": ["--restrict-key= restrict_key"], "signature": "--restrict-key= restrict_key", "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": ["--rows-per-insert= nrows"], "signature": "--rows-per-insert= nrows", "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": ["--statistics"], "signature": "--statistics", "description": "Dump optimizer statistics."}, {"names": ["--statistics-only"], "signature": "--statistics-only", "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": ["--sequence-data"], "signature": "--sequence-data", "description": "Include sequence data in the dump. This is the default behavior except when --no-data , --schema-only , or --statistics-only is specified."}, {"names": ["--use-set-session-authorization"], "signature": "--use-set-session-authorization", "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": ["-?", "--help"], "signature": "-? --help", "description": "Show help about pg_dumpall command line arguments, and exit."}, {"names": ["-d connstr", "--dbname= connstr"], "signature": "-d connstr --dbname= connstr", "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": ["-h host", "--host= host"], "signature": "-h host --host= host", "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": ["-l dbname", "--database= dbname"], "signature": "-l dbname --database= dbname", "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": ["-p port", "--port= port"], "signature": "-p port --port= port", "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": ["-U username", "--username= username"], "signature": "-U username --username= username", "description": "User name to connect as."}, {"names": ["-w", "--no-password"], "signature": "-w --no-password", "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", "--password"], "signature": "-W --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": ["--role= rolename"], "signature": "--role= rolename", "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."}], "synopsis": ["pg_dumpall [ connection-option ...] [ option ...]"], "environment": [{"name": "PGHOST PGOPTIONS PGPORT PGUSER", "description": "Default connection parameters"}, {"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}]}, "comparison_hash": "dd0edf9a9ef6de0e86b97b0a2b08127ecf99f382528014ef50f210767b2d4f6c"}, "20": {"facts": [{"label": "Documented executable", "value": "pg_dumpall"}, {"label": "Executable version", "value": "20devel"}, {"label": "Reference inventory", "value": "Client applications"}, {"label": "Option definition groups", "value": "55"}], "tables": [{"key": "options", "rows": [{"summary": "Dump only the data, not the schema (data definitions) or statistics.", "signature": {"url": "/docs/devel/app-pg-dumpall.html", "text": "-a --data-only"}}, {"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": {"url": "/docs/devel/app-pg-dumpall.html", "text": "-c --clean"}}, {"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": {"url": "/docs/devel/app-pg-dumpall.html", "text": "-E encoding --encoding= encoding"}}, {"summary": "Send output to the specified file. If this is omitted, the standard output is used.", "signature": {"url": "/docs/devel/app-pg-dumpall.html", "text": "-f filename --file= filename"}}, {"summary": "Dump only global objects (roles and tablespaces), no databases.", "signature": {"url": "/docs/devel/app-pg-dumpall.html", "text": "-g --globals-only"}}, {"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": {"url": "/docs/devel/app-pg-dumpall.html", "text": "-O --no-owner"}}, {"summary": "Dump only roles, no databases or tablespaces.", "signature": {"url": "/docs/devel/app-pg-dumpall.html", "text": "-r --roles-only"}}, {"summary": "Dump only the object definitions (schema), not data.", "signature": {"url": "/docs/devel/app-pg-dumpall.html", "text": "-s --schema-only"}}, {"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": {"url": "/docs/devel/app-pg-dumpall.html", "text": "-S username --superuser= username"}}, {"summary": "Dump only tablespaces, no databases or roles.", "signature": {"url": "/docs/devel/app-pg-dumpall.html", "text": "-t --tablespaces-only"}}, {"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": {"url": "/docs/devel/app-pg-dumpall.html", "text": "-v --verbose"}}, {"summary": "Print the pg_dumpall version and exit.", "signature": {"url": "/docs/devel/app-pg-dumpall.html", "text": "-V --version"}}, {"summary": "Prevent dumping of access privileges (grant/revoke commands).", "signature": {"url": "/docs/devel/app-pg-dumpall.html", "text": "-x --no-privileges --no-acl"}}, {"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": {"url": "/docs/devel/app-pg-dumpall.html", "text": "--binary-upgrade"}}, {"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": {"url": "/docs/devel/app-pg-dumpall.html", "text": "--column-inserts --attribute-inserts"}}, {"summary": "This option disables the use of dollar quoting for function bodies, and forces them to be quoted using SQL standard string syntax.", "signature": {"url": "/docs/devel/app-pg-dumpall.html", "text": "--disable-dollar-quoting"}}, {"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": {"url": "/docs/devel/app-pg-dumpall.html", "text": "--disable-triggers"}}, {"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": {"url": "/docs/devel/app-pg-dumpall.html", "text": "--exclude-database= pattern"}}, {"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": {"url": "/docs/devel/app-pg-dumpall.html", "text": "--extra-float-digits= ndigits"}}, {"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": {"url": "/docs/devel/app-pg-dumpall.html", "text": "--filter= filename"}}, {"summary": "Use DROP ... IF EXISTS commands to drop objects in --clean mode. This suppresses \u201c does not exist \u201d errors that might otherwise be reported. This option is not valid unless --clean is also specified.", "signature": {"url": "/docs/devel/app-pg-dumpall.html", "text": "--if-exists"}}, {"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": {"url": "/docs/devel/app-pg-dumpall.html", "text": "--inserts"}}, {"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": {"url": "/docs/devel/app-pg-dumpall.html", "text": "--load-via-partition-root"}}, {"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": {"url": "/docs/devel/app-pg-dumpall.html", "text": "--lock-wait-timeout= timeout"}}, {"summary": "Do not dump COMMENT commands.", "signature": {"url": "/docs/devel/app-pg-dumpall.html", "text": "--no-comments"}}, {"summary": "Do not dump data.", "signature": {"url": "/docs/devel/app-pg-dumpall.html", "text": "--no-data"}}, {"summary": "Do not dump row security policies.", "signature": {"url": "/docs/devel/app-pg-dumpall.html", "text": "--no-policies"}}, {"summary": "Do not dump publications.", "signature": {"url": "/docs/devel/app-pg-dumpall.html", "text": "--no-publications"}}, {"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": {"url": "/docs/devel/app-pg-dumpall.html", "text": "--no-role-passwords"}}, {"summary": "Do not dump schema (data definitions).", "signature": {"url": "/docs/devel/app-pg-dumpall.html", "text": "--no-schema"}}, {"summary": "Do not dump security labels.", "signature": {"url": "/docs/devel/app-pg-dumpall.html", "text": "--no-security-labels"}}, {"summary": "Do not dump statistics. This is the default.", "signature": {"url": "/docs/devel/app-pg-dumpall.html", "text": "--no-statistics"}}, {"summary": "Do not dump subscriptions.", "signature": {"url": "/docs/devel/app-pg-dumpall.html", "text": "--no-subscriptions"}}, {"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": {"url": "/docs/devel/app-pg-dumpall.html", "text": "--no-sync"}}, {"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": {"url": "/docs/devel/app-pg-dumpall.html", "text": "--no-table-access-method"}}, {"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": {"url": "/docs/devel/app-pg-dumpall.html", "text": "--no-tablespaces"}}, {"summary": "Do not output commands to set TOAST compression methods. With this option, all columns will be restored with the default compression setting.", "signature": {"url": "/docs/devel/app-pg-dumpall.html", "text": "--no-toast-compression"}}, {"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": {"url": "/docs/devel/app-pg-dumpall.html", "text": "--no-unlogged-table-data"}}, {"summary": "Add ON CONFLICT DO NOTHING to INSERT commands. This option is not valid unless --inserts or --column-inserts is also specified.", "signature": {"url": "/docs/devel/app-pg-dumpall.html", "text": "--on-conflict-do-nothing"}}, {"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": {"url": "/docs/devel/app-pg-dumpall.html", "text": "--quote-all-identifiers"}}, {"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": {"url": "/docs/devel/app-pg-dumpall.html", "text": "--restrict-key= restrict_key"}}, {"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": {"url": "/docs/devel/app-pg-dumpall.html", "text": "--rows-per-insert= nrows"}}, {"summary": "Dump optimizer statistics.", "signature": {"url": "/docs/devel/app-pg-dumpall.html", "text": "--statistics"}}, {"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": {"url": "/docs/devel/app-pg-dumpall.html", "text": "--statistics-only"}}, {"summary": "Include sequence data in the dump. This is the default behavior except when --no-data , --schema-only , or --statistics-only is specified.", "signature": {"url": "/docs/devel/app-pg-dumpall.html", "text": "--sequence-data"}}, {"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": {"url": "/docs/devel/app-pg-dumpall.html", "text": "--use-set-session-authorization"}}, {"summary": "Show help about pg_dumpall command line arguments, and exit.", "signature": {"url": "/docs/devel/app-pg-dumpall.html", "text": "-? --help"}}, {"summary": "Specifies parameters used to connect to the server, as a connection string ; these will override any conflicting command line options.", "signature": {"url": "/docs/devel/app-pg-dumpall.html", "text": "-d connstr --dbname= connstr"}}, {"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": {"url": "/docs/devel/app-pg-dumpall.html", "text": "-h host --host= host"}}, {"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": {"url": "/docs/devel/app-pg-dumpall.html", "text": "-l dbname --database= dbname"}}, {"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": {"url": "/docs/devel/app-pg-dumpall.html", "text": "-p port --port= port"}}, {"summary": "User name to connect as.", "signature": {"url": "/docs/devel/app-pg-dumpall.html", "text": "-U username --username= username"}}, {"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": {"url": "/docs/devel/app-pg-dumpall.html", "text": "-w --no-password"}}, {"summary": "Force pg_dumpall to prompt for a password before connecting to a database.", "signature": {"url": "/docs/devel/app-pg-dumpall.html", "text": "-W --password"}}, {"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.", "signature": {"url": "/docs/devel/app-pg-dumpall.html", "text": "--role= rolename"}}], "title": "Documented options", "columns": [{"key": "signature", "label": "Option and arguments"}, {"key": "summary", "label": "Description"}]}, {"key": "environment", "rows": [{"name": "PGHOST PGOPTIONS PGPORT PGUSER", "description": "Default connection parameters"}, {"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}], "title": "Environment variables", "columns": [{"key": "name", "label": "Variable"}, {"key": "description", "label": "Meaning"}]}], "options": [{"names": ["-a", "--data-only"], "summary": "Dump only the data, not the schema (data definitions) or statistics.", "signature": "-a --data-only", "source_url": "/docs/devel/app-pg-dumpall.html", "description": "Dump only the data, not the schema (data definitions) or statistics."}, {"names": ["-c", "--clean"], "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": "-c --clean", "source_url": "/docs/devel/app-pg-dumpall.html", "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": ["-E encoding", "--encoding= encoding"], "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": "-E encoding --encoding= encoding", "source_url": "/docs/devel/app-pg-dumpall.html", "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": ["-f filename", "--file= filename"], "summary": "Send output to the specified file. If this is omitted, the standard output is used.", "signature": "-f filename --file= filename", "source_url": "/docs/devel/app-pg-dumpall.html", "description": "Send output to the specified file. If this is omitted, the standard output is used."}, {"names": ["-g", "--globals-only"], "summary": "Dump only global objects (roles and tablespaces), no databases.", "signature": "-g --globals-only", "source_url": "/docs/devel/app-pg-dumpall.html", "description": "Dump only global objects (roles and tablespaces), no databases."}, {"names": ["-O", "--no-owner"], "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": "-O --no-owner", "source_url": "/docs/devel/app-pg-dumpall.html", "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": ["-r", "--roles-only"], "summary": "Dump only roles, no databases or tablespaces.", "signature": "-r --roles-only", "source_url": "/docs/devel/app-pg-dumpall.html", "description": "Dump only roles, no databases or tablespaces."}, {"names": ["-s", "--schema-only"], "summary": "Dump only the object definitions (schema), not data.", "signature": "-s --schema-only", "source_url": "/docs/devel/app-pg-dumpall.html", "description": "Dump only the object definitions (schema), not data."}, {"names": ["-S username", "--superuser= username"], "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": "-S username --superuser= username", "source_url": "/docs/devel/app-pg-dumpall.html", "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": ["-t", "--tablespaces-only"], "summary": "Dump only tablespaces, no databases or roles.", "signature": "-t --tablespaces-only", "source_url": "/docs/devel/app-pg-dumpall.html", "description": "Dump only tablespaces, no databases or roles."}, {"names": ["-v", "--verbose"], "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": "-v --verbose", "source_url": "/docs/devel/app-pg-dumpall.html", "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", "--version"], "summary": "Print the pg_dumpall version and exit.", "signature": "-V --version", "source_url": "/docs/devel/app-pg-dumpall.html", "description": "Print the pg_dumpall version and exit."}, {"names": ["-x", "--no-privileges", "--no-acl"], "summary": "Prevent dumping of access privileges (grant/revoke commands).", "signature": "-x --no-privileges --no-acl", "source_url": "/docs/devel/app-pg-dumpall.html", "description": "Prevent dumping of access privileges (grant/revoke commands)."}, {"names": ["--binary-upgrade"], "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": "--binary-upgrade", "source_url": "/docs/devel/app-pg-dumpall.html", "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": ["--column-inserts", "--attribute-inserts"], "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": "--column-inserts --attribute-inserts", "source_url": "/docs/devel/app-pg-dumpall.html", "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": ["--disable-dollar-quoting"], "summary": "This option disables the use of dollar quoting for function bodies, and forces them to be quoted using SQL standard string syntax.", "signature": "--disable-dollar-quoting", "source_url": "/docs/devel/app-pg-dumpall.html", "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-triggers"], "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": "--disable-triggers", "source_url": "/docs/devel/app-pg-dumpall.html", "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": ["--exclude-database= pattern"], "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": "--exclude-database= pattern", "source_url": "/docs/devel/app-pg-dumpall.html", "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": ["--extra-float-digits= ndigits"], "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": "--extra-float-digits= ndigits", "source_url": "/docs/devel/app-pg-dumpall.html", "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": ["--filter= filename"], "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": "--filter= filename", "source_url": "/docs/devel/app-pg-dumpall.html", "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": ["--if-exists"], "summary": "Use DROP ... IF EXISTS commands to drop objects in --clean mode. This suppresses \u201c does not exist \u201d errors that might otherwise be reported. This option is not valid unless --clean is also specified.", "signature": "--if-exists", "source_url": "/docs/devel/app-pg-dumpall.html", "description": "Use DROP ... IF EXISTS commands to drop objects in --clean mode. This suppresses \u201c does not exist \u201d errors that might otherwise be reported. This option is not valid unless --clean is also specified."}, {"names": ["--inserts"], "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": "--inserts", "source_url": "/docs/devel/app-pg-dumpall.html", "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": ["--load-via-partition-root"], "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": "--load-via-partition-root", "source_url": "/docs/devel/app-pg-dumpall.html", "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": ["--lock-wait-timeout= timeout"], "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": "--lock-wait-timeout= timeout", "source_url": "/docs/devel/app-pg-dumpall.html", "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": ["--no-comments"], "summary": "Do not dump COMMENT commands.", "signature": "--no-comments", "source_url": "/docs/devel/app-pg-dumpall.html", "description": "Do not dump COMMENT commands."}, {"names": ["--no-data"], "summary": "Do not dump data.", "signature": "--no-data", "source_url": "/docs/devel/app-pg-dumpall.html", "description": "Do not dump data."}, {"names": ["--no-policies"], "summary": "Do not dump row security policies.", "signature": "--no-policies", "source_url": "/docs/devel/app-pg-dumpall.html", "description": "Do not dump row security policies."}, {"names": ["--no-publications"], "summary": "Do not dump publications.", "signature": "--no-publications", "source_url": "/docs/devel/app-pg-dumpall.html", "description": "Do not dump publications."}, {"names": ["--no-role-passwords"], "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": "--no-role-passwords", "source_url": "/docs/devel/app-pg-dumpall.html", "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-schema"], "summary": "Do not dump schema (data definitions).", "signature": "--no-schema", "source_url": "/docs/devel/app-pg-dumpall.html", "description": "Do not dump schema (data definitions)."}, {"names": ["--no-security-labels"], "summary": "Do not dump security labels.", "signature": "--no-security-labels", "source_url": "/docs/devel/app-pg-dumpall.html", "description": "Do not dump security labels."}, {"names": ["--no-statistics"], "summary": "Do not dump statistics. This is the default.", "signature": "--no-statistics", "source_url": "/docs/devel/app-pg-dumpall.html", "description": "Do not dump statistics. This is the default."}, {"names": ["--no-subscriptions"], "summary": "Do not dump subscriptions.", "signature": "--no-subscriptions", "source_url": "/docs/devel/app-pg-dumpall.html", "description": "Do not dump subscriptions."}, {"names": ["--no-sync"], "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": "--no-sync", "source_url": "/docs/devel/app-pg-dumpall.html", "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-table-access-method"], "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": "--no-table-access-method", "source_url": "/docs/devel/app-pg-dumpall.html", "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-tablespaces"], "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": "--no-tablespaces", "source_url": "/docs/devel/app-pg-dumpall.html", "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-toast-compression"], "summary": "Do not output commands to set TOAST compression methods. With this option, all columns will be restored with the default compression setting.", "signature": "--no-toast-compression", "source_url": "/docs/devel/app-pg-dumpall.html", "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-unlogged-table-data"], "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": "--no-unlogged-table-data", "source_url": "/docs/devel/app-pg-dumpall.html", "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": ["--on-conflict-do-nothing"], "summary": "Add ON CONFLICT DO NOTHING to INSERT commands. This option is not valid unless --inserts or --column-inserts is also specified.", "signature": "--on-conflict-do-nothing", "source_url": "/docs/devel/app-pg-dumpall.html", "description": "Add ON CONFLICT DO NOTHING to INSERT commands. This option is not valid unless --inserts or --column-inserts is also specified."}, {"names": ["--quote-all-identifiers"], "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": "--quote-all-identifiers", "source_url": "/docs/devel/app-pg-dumpall.html", "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": ["--restrict-key= restrict_key"], "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": "--restrict-key= restrict_key", "source_url": "/docs/devel/app-pg-dumpall.html", "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": ["--rows-per-insert= nrows"], "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": "--rows-per-insert= nrows", "source_url": "/docs/devel/app-pg-dumpall.html", "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": ["--statistics"], "summary": "Dump optimizer statistics.", "signature": "--statistics", "source_url": "/docs/devel/app-pg-dumpall.html", "description": "Dump optimizer statistics."}, {"names": ["--statistics-only"], "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": "--statistics-only", "source_url": "/docs/devel/app-pg-dumpall.html", "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": ["--sequence-data"], "summary": "Include sequence data in the dump. This is the default behavior except when --no-data , --schema-only , or --statistics-only is specified.", "signature": "--sequence-data", "source_url": "/docs/devel/app-pg-dumpall.html", "description": "Include sequence data in the dump. This is the default behavior except when --no-data , --schema-only , or --statistics-only is specified."}, {"names": ["--use-set-session-authorization"], "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": "--use-set-session-authorization", "source_url": "/docs/devel/app-pg-dumpall.html", "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": ["-?", "--help"], "summary": "Show help about pg_dumpall command line arguments, and exit.", "signature": "-? --help", "source_url": "/docs/devel/app-pg-dumpall.html", "description": "Show help about pg_dumpall command line arguments, and exit."}, {"names": ["-d connstr", "--dbname= connstr"], "summary": "Specifies parameters used to connect to the server, as a connection string ; these will override any conflicting command line options.", "signature": "-d connstr --dbname= connstr", "source_url": "/docs/devel/app-pg-dumpall.html", "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": ["-h host", "--host= host"], "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": "-h host --host= host", "source_url": "/docs/devel/app-pg-dumpall.html", "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": ["-l dbname", "--database= dbname"], "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": "-l dbname --database= dbname", "source_url": "/docs/devel/app-pg-dumpall.html", "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": ["-p port", "--port= port"], "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": "-p port --port= port", "source_url": "/docs/devel/app-pg-dumpall.html", "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": ["-U username", "--username= username"], "summary": "User name to connect as.", "signature": "-U username --username= username", "source_url": "/docs/devel/app-pg-dumpall.html", "description": "User name to connect as."}, {"names": ["-w", "--no-password"], "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": "-w --no-password", "source_url": "/docs/devel/app-pg-dumpall.html", "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", "--password"], "summary": "Force pg_dumpall to prompt for a password before connecting to a database.", "signature": "-W --password", "source_url": "/docs/devel/app-pg-dumpall.html", "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": ["--role= rolename"], "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.", "signature": "--role= rolename", "source_url": "/docs/devel/app-pg-dumpall.html", "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."}], "related": [{"url": "/wiki/conn/?v=20", "label": "libpq connection parameters"}], "release": {"ref": "https://ftp.postgresql.org/pub/snapshot/dev/postgresql-snapshot.tar.bz2", "label": "20devel", "major": "20", "channel": "devel", "manifest": {"pdf": {"A4": {"url": "/files/documentation/pdf/20/postgresql-20-A4.pdf", "bytes": 16030631, "pages": 3052, "sha256": "bd5d82c0ce38fc18f92a0447818a91a193a261776bca1c37564bf9a683e177d0", "built_at": "2026-09-28"}, "US": {"url": "/files/documentation/pdf/20/postgresql-20-US.pdf", "bytes": 15936613, "pages": 3223, "sha256": "d97d9e0db479a02f4234b175f50fcad70c3661619afc8d6df9b9437882e3c299", "built_at": "2026-09-28"}}, "tree": "0", "index": "index.html", "major": "20", "pages": 1156, "release": "20devel", "source_url": "https://ftp.postgresql.org/pub/snapshot/dev/postgresql-snapshot.tar.bz2", "svg_assets": 6, "source_mode": "en SGML built with pinned official archive", "source_sha256": "4d3346909b201ac1648232cf290462a7070c119326f56196f1f0253ed80fae41", "source_snapshot_utc": "26-Sep-2026 20:22"}, "revision": "2eba5e0fd4c3bffb2803247b6cd537878e9d6ee5a6dfbe3c50ece8b421b80918", "evidence_kind": "English manual and source declarations", "source_sha256": "4d3346909b201ac1648232cf290462a7070c119326f56196f1f0253ed80fae41"}, "sources": [{"url": "/docs/devel/app-pg-dumpall.html", "file": "app-pg-dumpall.html", "label": "20devel English manual \u00b7 app-pg-dumpall.html", "anchor": "", "sha256": "b671f4c9d49e1e9b6656709e4c50892e93ec89a08e4f097f93c3c863663e2dc9"}, {"url": "/docs/devel/reference-client.html", "file": "reference-client.html", "label": "Client applications inventory", "anchor": "", "sha256": "a6c7ba748fa1d9feac5bb7cde41d1d36a1f4c26d5963e07fb103d02918b2a8ca"}], "sections": [], "synopsis": ["pg_dumpall [ connection-option ...] [ option ...]"], "signature": "pg_dumpall [ connection-option ...] [ option ...]", "description": ["pg_dumpall \u2014 extract a PostgreSQL database cluster into a script file"], "environment": [{"name": "PGHOST PGOPTIONS PGPORT PGUSER", "description": "Default connection parameters"}, {"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}], "manual_html": "<div><div class=\"refentry\" id=\"APP-PG-DUMPALL\">\n<div class=\"titlepage\"></div>\n<div class=\"refnamediv\">\n<h2><span class=\"refentrytitle\"><span class=\"application\">pg_dumpall</span></span></h2>\n<p>pg_dumpall \u2014 extract a <span class=\"productname\">PostgreSQL</span> database cluster into a script file</p>\n</div>\n<div class=\"refsynopsisdiv\">\n<h2>Synopsis</h2>\n<div class=\"cmdsynopsis\">\n<p id=\"id-1.9.4.15.4.1\"><code class=\"command\">pg_dumpall</code> [<em class=\"replaceable\"><code>connection-option</code></em>...] [<em class=\"replaceable\"><code>option</code></em>...]</p>\n</div>\n</div>\n<div class=\"refsect1\" id=\"APP-PG-DUMPALL-DESCRIPTION\">\n<h2>Description</h2>\n<p><span class=\"application\">pg_dumpall</span> is a utility for writing out (<span class=\"quote\">\u201c<span class=\"quote\">dumping</span>\u201d</span>) all <span class=\"productname\">PostgreSQL</span> databases of a cluster into one script file. The script file contains SQL commands that can be used as input to <a class=\"xref\" href=\"/docs/devel/app-psql.html\" title=\"psql\"><span class=\"refentrytitle\"><span class=\"application\">psql</span></span></a> to restore the databases. It does this by calling <a class=\"xref\" href=\"/docs/devel/app-pgdump.html\" title=\"pg_dump\"><span class=\"refentrytitle\"><span class=\"application\">pg_dump</span></span></a> for each database in the cluster. <span class=\"application\">pg_dumpall</span> also dumps global objects that are common to all databases, namely database roles, tablespaces, and privilege grants for configuration parameters. (<span class=\"application\">pg_dump</span> does not save these objects.)</p>\n<p>Since <span class=\"application\">pg_dumpall</span> 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.</p>\n<p>The SQL script will be written to the standard output. Use the <code class=\"option\">-f</code>/<code class=\"option\">--file</code> option or shell operators to redirect it into a file.</p>\n<p><span class=\"application\">pg_dumpall</span> needs to connect several times to the <span class=\"productname\">PostgreSQL</span> server (once per database). If you use password authentication it will ask for a password each time. It is convenient to have a <code class=\"filename\">~/.pgpass</code> file in such cases. See <a class=\"xref\" href=\"/docs/devel/libpq-pgpass.html\" title=\"32.15.\u00a0The Password File\">Section\u00a032.15</a> for more information.</p>\n<div class=\"warning\">\n<h3 class=\"title\">Warning</h3>\n<p>Restoring 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.</p>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.15.6\">\n<h2>Options</h2>\n<p>The following command-line options control the content and format of the output.</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-a</code><br></span><span class=\"term\"><code class=\"option\">--data-only</code></span></dt>\n<dd>\n<p>Dump only the data, not the schema (data definitions) or statistics.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-c</code><br></span><span class=\"term\"><code class=\"option\">--clean</code></span></dt>\n<dd>\n<p>Emit SQL commands to <code class=\"command\">DROP</code> 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 <code class=\"option\">--if-exists</code> is also specified.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-E <em class=\"replaceable\"><code>encoding</code></em></code><br></span><span class=\"term\"><code class=\"option\">--encoding=<em class=\"replaceable\"><code>encoding</code></em></code></span></dt>\n<dd>\n<p>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 <code class=\"envar\">PGCLIENTENCODING</code> environment variable to the desired dump encoding.)</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-f <em class=\"replaceable\"><code>filename</code></em></code><br></span><span class=\"term\"><code class=\"option\">--file=<em class=\"replaceable\"><code>filename</code></em></code></span></dt>\n<dd>\n<p>Send output to the specified file. If this is omitted, the standard output is used.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-g</code><br></span><span class=\"term\"><code class=\"option\">--globals-only</code></span></dt>\n<dd>\n<p>Dump only global objects (roles and tablespaces), no databases.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-O</code><br></span><span class=\"term\"><code class=\"option\">--no-owner</code></span></dt>\n<dd>\n<p>Do not output commands to set ownership of objects to match the original database. By default, <span class=\"application\">pg_dumpall</span> issues <code class=\"command\">ALTER OWNER</code> or <code class=\"command\">SET SESSION AUTHORIZATION</code> 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 <code class=\"option\">-O</code>.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-r</code><br></span><span class=\"term\"><code class=\"option\">--roles-only</code></span></dt>\n<dd>\n<p>Dump only roles, no databases or tablespaces.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-s</code><br></span><span class=\"term\"><code class=\"option\">--schema-only</code></span></dt>\n<dd>\n<p>Dump only the object definitions (schema), not data.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-S <em class=\"replaceable\"><code>username</code></em></code><br></span><span class=\"term\"><code class=\"option\">--superuser=<em class=\"replaceable\"><code>username</code></em></code></span></dt>\n<dd>\n<p>Specify the superuser user name to use when disabling triggers. This is relevant only if <code class=\"option\">--disable-triggers</code> is used. (Usually, it's better to leave this out, and instead start the resulting script as superuser.)</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-t</code><br></span><span class=\"term\"><code class=\"option\">--tablespaces-only</code></span></dt>\n<dd>\n<p>Dump only tablespaces, no databases or roles.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-v</code><br></span><span class=\"term\"><code class=\"option\">--verbose</code></span></dt>\n<dd>\n<p>Specifies verbose mode. This will cause <span class=\"application\">pg_dumpall</span> 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 <span class=\"application\">pg_dump</span>.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-V</code><br></span><span class=\"term\"><code class=\"option\">--version</code></span></dt>\n<dd>\n<p>Print the <span class=\"application\">pg_dumpall</span> version and exit.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-x</code><br></span><span class=\"term\"><code class=\"option\">--no-privileges</code><br></span><span class=\"term\"><code class=\"option\">--no-acl</code></span></dt>\n<dd>\n<p>Prevent dumping of access privileges (grant/revoke commands).</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--binary-upgrade</code></span></dt>\n<dd>\n<p>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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--column-inserts</code><br></span><span class=\"term\"><code class=\"option\">--attribute-inserts</code></span></dt>\n<dd>\n<p>Dump data as <code class=\"command\">INSERT</code> commands with explicit column names (<code class=\"literal\">INSERT INTO <em class=\"replaceable\"><code>table</code></em> (<em class=\"replaceable\"><code>column</code></em>, ...) VALUES ...</code>). This will make restoration very slow; it is mainly useful for making dumps that can be loaded into non-<span class=\"productname\">PostgreSQL</span> databases.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--disable-dollar-quoting</code></span></dt>\n<dd>\n<p>This option disables the use of dollar quoting for function bodies, and forces them to be quoted using SQL standard string syntax.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--disable-triggers</code></span></dt>\n<dd>\n<p>This option is relevant only when creating a dump with data and without schema. It instructs <span class=\"application\">pg_dumpall</span> 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.</p>\n<p>Presently, the commands emitted for <code class=\"option\">--disable-triggers</code> must be done as superuser. So, you should also specify a superuser name with <code class=\"option\">-S</code>, or preferably be careful to start the resulting script as a superuser.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--exclude-database=<em class=\"replaceable\"><code>pattern</code></em></code></span></dt>\n<dd>\n<p>Do not dump databases whose name matches <em class=\"replaceable\"><code>pattern</code></em>. Multiple patterns can be excluded by writing multiple <code class=\"option\">--exclude-database</code> switches. The <em class=\"replaceable\"><code>pattern</code></em> parameter is interpreted as a pattern according to the same rules used by <span class=\"application\">psql</span>'s <code class=\"literal\">\\d</code> commands (see <a class=\"xref\" href=\"/docs/devel/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\">Patterns</a>), 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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--extra-float-digits=<em class=\"replaceable\"><code>ndigits</code></em></code></span></dt>\n<dd>\n<p>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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--filter=<em class=\"replaceable\"><code>filename</code></em></code></span></dt>\n<dd>\n<p>Specify a filename from which to read patterns for databases excluded from the dump. The patterns are interpreted according to the same rules as <code class=\"option\">--exclude-database</code>. To read from <code class=\"literal\">STDIN</code>, use <code class=\"filename\">-</code> as the filename. The <code class=\"option\">--filter</code> option can be specified in conjunction with <code class=\"option\">--exclude-database</code> for excluding databases, and can also be specified more than once for multiple filter files.</p>\n<p>The file lists one database pattern per row, with the following format:</p>\n<pre class=\"synopsis\">exclude database <em class=\"replaceable\"><code>PATTERN</code></em>\n</pre>\n<p>Lines starting with <code class=\"literal\">#</code> are considered comments and ignored. Comments can be placed after an object pattern row as well. Blank lines are also ignored. See <a class=\"xref\" href=\"/docs/devel/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\">Patterns</a> for how to perform quoting in patterns.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--if-exists</code></span></dt>\n<dd>\n<p>Use <code class=\"literal\">DROP ... IF EXISTS</code> commands to drop objects in <code class=\"option\">--clean</code> mode. This suppresses <span class=\"quote\">\u201c<span class=\"quote\">does not exist</span>\u201d</span> errors that might otherwise be reported. This option is not valid unless <code class=\"option\">--clean</code> is also specified.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--inserts</code></span></dt>\n<dd>\n<p>Dump data as <code class=\"command\">INSERT</code> commands (rather than <code class=\"command\">COPY</code>). This will make restoration very slow; it is mainly useful for making dumps that can be loaded into non-<span class=\"productname\">PostgreSQL</span> databases. Note that the restore might fail altogether if you have rearranged column order. The <code class=\"option\">--column-inserts</code> option is safer, though even slower.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--load-via-partition-root</code></span></dt>\n<dd>\n<p>When dumping data for a table partition, make the <code class=\"command\">COPY</code> or <code class=\"command\">INSERT</code> 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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--lock-wait-timeout=<em class=\"replaceable\"><code>timeout</code></em></code></span></dt>\n<dd>\n<p>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 <em class=\"replaceable\"><code>timeout</code></em>. The timeout may be specified in any of the formats accepted by <code class=\"command\">SET statement_timeout</code>.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-comments</code></span></dt>\n<dd>\n<p>Do not dump <code class=\"command\">COMMENT</code> commands.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-data</code></span></dt>\n<dd>\n<p>Do not dump data.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-policies</code></span></dt>\n<dd>\n<p>Do not dump row security policies.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-publications</code></span></dt>\n<dd>\n<p>Do not dump publications.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-role-passwords</code></span></dt>\n<dd>\n<p>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 <code class=\"structname\">pg_roles</code> instead of <code class=\"structname\">pg_authid</code>. Therefore, this option also helps if access to <code class=\"structname\">pg_authid</code> is restricted by some security policy.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-schema</code></span></dt>\n<dd>\n<p>Do not dump schema (data definitions).</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-security-labels</code></span></dt>\n<dd>\n<p>Do not dump security labels.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-statistics</code></span></dt>\n<dd>\n<p>Do not dump statistics. This is the default.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-subscriptions</code></span></dt>\n<dd>\n<p>Do not dump subscriptions.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-sync</code></span></dt>\n<dd>\n<p>By default, <code class=\"command\">pg_dumpall</code> will wait for all files to be written safely to disk. This option causes <code class=\"command\">pg_dumpall</code> 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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-table-access-method</code></span></dt>\n<dd>\n<p>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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-tablespaces</code></span></dt>\n<dd>\n<p>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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-toast-compression</code></span></dt>\n<dd>\n<p>Do not output commands to set TOAST compression methods. With this option, all columns will be restored with the default compression setting.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-unlogged-table-data</code></span></dt>\n<dd>\n<p>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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--on-conflict-do-nothing</code></span></dt>\n<dd>\n<p>Add <code class=\"literal\">ON CONFLICT DO NOTHING</code> to <code class=\"command\">INSERT</code> commands. This option is not valid unless <code class=\"option\">--inserts</code> or <code class=\"option\">--column-inserts</code> is also specified.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--quote-all-identifiers</code></span></dt>\n<dd>\n<p>Force quoting of all identifiers. This option is recommended when dumping a database from a server whose <span class=\"productname\">PostgreSQL</span> major version is different from <span class=\"application\">pg_dumpall</span>'s, or when the output is intended to be loaded into a server of a different major version. By default, <span class=\"application\">pg_dumpall</span> 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 <code class=\"option\">--quote-all-identifiers</code> prevents such issues, at the price of a harder-to-read dump script.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--restrict-key=<em class=\"replaceable\"><code>restrict_key</code></em></code></span></dt>\n<dd>\n<p>Use the provided string as the <span class=\"application\">psql</span> <code class=\"command\">\\restrict</code> key in the dump output. If no restrict key is specified, <span class=\"application\">pg_dumpall</span> will generate a random one as needed. Keys may contain only alphanumeric characters.</p>\n<p>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 <span class=\"application\">psql</span> with the dump output.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--rows-per-insert=<em class=\"replaceable\"><code>nrows</code></em></code></span></dt>\n<dd>\n<p>Dump data as <code class=\"command\">INSERT</code> commands (rather than <code class=\"command\">COPY</code>). Controls the maximum number of rows per <code class=\"command\">INSERT</code> 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 <code class=\"command\">INSERT</code> to be lost, rather than the entire table contents.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--statistics</code></span></dt>\n<dd>\n<p>Dump optimizer statistics.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--statistics-only</code></span></dt>\n<dd>\n<p>Dump only the statistics, not the schema (data definitions) or data. Optimizer statistics for tables, materialized views, foreign tables, and indexes are dumped.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--sequence-data</code></span></dt>\n<dd>\n<p>Include sequence data in the dump. This is the default behavior except when <code class=\"option\">--no-data</code>, <code class=\"option\">--schema-only</code>, or <code class=\"option\">--statistics-only</code> is specified.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--use-set-session-authorization</code></span></dt>\n<dd>\n<p>Output SQL-standard <code class=\"command\">SET SESSION AUTHORIZATION</code> commands instead of <code class=\"command\">ALTER OWNER</code> 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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-?</code><br></span><span class=\"term\"><code class=\"option\">--help</code></span></dt>\n<dd>\n<p>Show help about <span class=\"application\">pg_dumpall</span> command line arguments, and exit.</p>\n</dd>\n</dl>\n</div>\n<p>The following command-line options control the database connection parameters.</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-d <em class=\"replaceable\"><code>connstr</code></em></code><br></span><span class=\"term\"><code class=\"option\">--dbname=<em class=\"replaceable\"><code>connstr</code></em></code></span></dt>\n<dd>\n<p>Specifies parameters used to connect to the server, as a <a class=\"link\" href=\"/docs/devel/libpq-connect.html#LIBPQ-CONNSTRING\" title=\"32.1.1.\u00a0Connection Strings\">connection string</a>; these will override any conflicting command line options.</p>\n<p>The option is called <code class=\"literal\">--dbname</code> for consistency with other client applications, but because <span class=\"application\">pg_dumpall</span> needs to connect to many databases, the database name in the connection string will be ignored. Use the <code class=\"literal\">-l</code> 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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-h <em class=\"replaceable\"><code>host</code></em></code><br></span><span class=\"term\"><code class=\"option\">--host=<em class=\"replaceable\"><code>host</code></em></code></span></dt>\n<dd>\n<p>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 <code class=\"envar\">PGHOST</code> environment variable, if set, else a Unix domain socket connection is attempted.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-l <em class=\"replaceable\"><code>dbname</code></em></code><br></span><span class=\"term\"><code class=\"option\">--database=<em class=\"replaceable\"><code>dbname</code></em></code></span></dt>\n<dd>\n<p>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 <code class=\"literal\">postgres</code> database will be used, and if that does not exist, <code class=\"literal\">template1</code> will be used.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-p <em class=\"replaceable\"><code>port</code></em></code><br></span><span class=\"term\"><code class=\"option\">--port=<em class=\"replaceable\"><code>port</code></em></code></span></dt>\n<dd>\n<p>Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the <code class=\"envar\">PGPORT</code> environment variable, if set, or a compiled-in default.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-U <em class=\"replaceable\"><code>username</code></em></code><br></span><span class=\"term\"><code class=\"option\">--username=<em class=\"replaceable\"><code>username</code></em></code></span></dt>\n<dd>\n<p>User name to connect as.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-w</code><br></span><span class=\"term\"><code class=\"option\">--no-password</code></span></dt>\n<dd>\n<p>Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a <code class=\"filename\">.pgpass</code> 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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-W</code><br></span><span class=\"term\"><code class=\"option\">--password</code></span></dt>\n<dd>\n<p>Force <span class=\"application\">pg_dumpall</span> to prompt for a password before connecting to a database.</p>\n<p>This option is never essential, since <span class=\"application\">pg_dumpall</span> will automatically prompt for a password if the server demands password authentication. However, <span class=\"application\">pg_dumpall</span> will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing <code class=\"option\">-W</code> to avoid the extra connection attempt.</p>\n<p>Note that the password prompt will occur again for each database to be dumped. Usually, it's better to set up a <code class=\"filename\">~/.pgpass</code> file than to rely on manual password entry.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--role=<em class=\"replaceable\"><code>rolename</code></em></code></span></dt>\n<dd>\n<p>Specifies a role name to be used to create the dump. This option causes <span class=\"application\">pg_dumpall</span> to issue a <code class=\"command\">SET ROLE</code> <em class=\"replaceable\"><code>rolename</code></em> command after connecting to the database. It is useful when the authenticated user (specified by <code class=\"option\">-U</code>) lacks privileges needed by <span class=\"application\">pg_dumpall</span>, 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.</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.15.7\">\n<h2>Environment</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"envar\">PGHOST</code><br></span><span class=\"term\"><code class=\"envar\">PGOPTIONS</code><br></span><span class=\"term\"><code class=\"envar\">PGPORT</code><br></span><span class=\"term\"><code class=\"envar\">PGUSER</code></span></dt>\n<dd>\n<p>Default connection parameters</p>\n</dd>\n<dt><span class=\"term\"><code class=\"envar\">PG_COLOR</code></span></dt>\n<dd>\n<p>Specifies whether to use color in diagnostic messages. Possible values are <code class=\"literal\">always</code>, <code class=\"literal\">auto</code> and <code class=\"literal\">never</code>.</p>\n</dd>\n</dl>\n</div>\n<p>This utility, like most other <span class=\"productname\">PostgreSQL</span> utilities, also uses the environment variables supported by <span class=\"application\">libpq</span> (see <a class=\"xref\" href=\"/docs/devel/libpq-envars.html\" title=\"32.14.\u00a0Environment Variables\">Section\u00a032.14</a>).</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.15.8\">\n<h2>Notes</h2>\n<p>Since <span class=\"application\">pg_dumpall</span> calls <span class=\"application\">pg_dump</span> internally, some diagnostic messages will refer to <span class=\"application\">pg_dump</span>.</p>\n<p>The <code class=\"option\">--clean</code> option can be useful even when your intention is to restore the dump script into a fresh cluster. Use of <code class=\"option\">--clean</code> authorizes the script to drop and re-create the built-in <code class=\"literal\">postgres</code> and <code class=\"literal\">template1</code> 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.</p>\n<p>When <code class=\"option\">--statistics</code> is specified, <code class=\"command\">pg_dumpall</code> will include most optimizer statistics in the resulting dump file. This does not include all statistics, such as custom statistics added by an extension, or statistics collected by the cumulative statistics system. Therefore, it may still be useful to run <code class=\"command\">ANALYZE</code> on each database after restoring from a dump file to ensure optimal performance. You can also run <code class=\"command\">vacuumdb -a -z</code> to analyze all databases.</p>\n<p>The dump script should not be expected to run completely without errors. In particular, because the script will issue <code class=\"command\">CREATE ROLE</code> for every role existing in the source cluster, it is certain to get a <span class=\"quote\">\u201c<span class=\"quote\">role already exists</span>\u201d</span> 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 <code class=\"option\">--clean</code> option is likely to produce additional harmless error messages about non-existent objects, although you can minimize those by adding <code class=\"option\">--if-exists</code>.</p>\n<p><span class=\"application\">pg_dumpall</span> requires all needed tablespace directories to exist before the restore; otherwise, database creation will fail for databases in non-default locations.</p>\n<p>It is generally recommended to use the <code class=\"option\">-X</code> (<code class=\"option\">--no-psqlrc</code>) option when restoring a database from a <span class=\"application\">pg_dumpall</span> script to ensure a clean restore process and prevent potential conflicts with non-default <span class=\"application\">psql</span> configurations. Additionally, because the <span class=\"application\">pg_dumpall</span> script may include <span class=\"application\">psql</span> meta-commands, it may be incompatible with clients other than <span class=\"application\">psql</span>.</p>\n</div>\n<div class=\"refsect1\" id=\"APP-PG-DUMPALL-EX\">\n<h2>Examples</h2>\n<p>To dump all databases:</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_dumpall &gt; db.out</code></strong>\n</pre>\n<p>To restore database(s) from this file, you can use:</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>psql -X -f db.out -d postgres</code></strong>\n</pre>\n<p>It is not important which database you connect to here since the script file created by <span class=\"application\">pg_dumpall</span> will contain the appropriate commands to create and connect to the saved databases. An exception is that if you specified <code class=\"option\">--clean</code>, you must connect to the <code class=\"literal\">postgres</code> database initially; the script will attempt to drop other databases immediately, and that will fail for the database you are connected to.</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.15.10\">\n<h2>See Also</h2>\n<p>Check <a class=\"xref\" href=\"/docs/devel/app-pgdump.html\" title=\"pg_dump\"><span class=\"refentrytitle\"><span class=\"application\">pg_dump</span></span></a> for details on possible error conditions.</p>\n</div>\n</div></div>", "manual_path": "app-pg-dumpall.html", "comparison_data": {"options": [{"names": ["-a", "--data-only"], "signature": "-a --data-only", "description": "Dump only the data, not the schema (data definitions) or statistics."}, {"names": ["-c", "--clean"], "signature": "-c --clean", "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": ["-E encoding", "--encoding= encoding"], "signature": "-E encoding --encoding= encoding", "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": ["-f filename", "--file= filename"], "signature": "-f filename --file= filename", "description": "Send output to the specified file. If this is omitted, the standard output is used."}, {"names": ["-g", "--globals-only"], "signature": "-g --globals-only", "description": "Dump only global objects (roles and tablespaces), no databases."}, {"names": ["-O", "--no-owner"], "signature": "-O --no-owner", "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": ["-r", "--roles-only"], "signature": "-r --roles-only", "description": "Dump only roles, no databases or tablespaces."}, {"names": ["-s", "--schema-only"], "signature": "-s --schema-only", "description": "Dump only the object definitions (schema), not data."}, {"names": ["-S username", "--superuser= username"], "signature": "-S username --superuser= username", "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": ["-t", "--tablespaces-only"], "signature": "-t --tablespaces-only", "description": "Dump only tablespaces, no databases or roles."}, {"names": ["-v", "--verbose"], "signature": "-v --verbose", "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", "--version"], "signature": "-V --version", "description": "Print the pg_dumpall version and exit."}, {"names": ["-x", "--no-privileges", "--no-acl"], "signature": "-x --no-privileges --no-acl", "description": "Prevent dumping of access privileges (grant/revoke commands)."}, {"names": ["--binary-upgrade"], "signature": "--binary-upgrade", "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": ["--column-inserts", "--attribute-inserts"], "signature": "--column-inserts --attribute-inserts", "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": ["--disable-dollar-quoting"], "signature": "--disable-dollar-quoting", "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-triggers"], "signature": "--disable-triggers", "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": ["--exclude-database= pattern"], "signature": "--exclude-database= pattern", "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": ["--extra-float-digits= ndigits"], "signature": "--extra-float-digits= ndigits", "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": ["--filter= filename"], "signature": "--filter= filename", "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": ["--if-exists"], "signature": "--if-exists", "description": "Use DROP ... IF EXISTS commands to drop objects in --clean mode. This suppresses \u201c does not exist \u201d errors that might otherwise be reported. This option is not valid unless --clean is also specified."}, {"names": ["--inserts"], "signature": "--inserts", "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": ["--load-via-partition-root"], "signature": "--load-via-partition-root", "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": ["--lock-wait-timeout= timeout"], "signature": "--lock-wait-timeout= timeout", "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": ["--no-comments"], "signature": "--no-comments", "description": "Do not dump COMMENT commands."}, {"names": ["--no-data"], "signature": "--no-data", "description": "Do not dump data."}, {"names": ["--no-policies"], "signature": "--no-policies", "description": "Do not dump row security policies."}, {"names": ["--no-publications"], "signature": "--no-publications", "description": "Do not dump publications."}, {"names": ["--no-role-passwords"], "signature": "--no-role-passwords", "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-schema"], "signature": "--no-schema", "description": "Do not dump schema (data definitions)."}, {"names": ["--no-security-labels"], "signature": "--no-security-labels", "description": "Do not dump security labels."}, {"names": ["--no-statistics"], "signature": "--no-statistics", "description": "Do not dump statistics. This is the default."}, {"names": ["--no-subscriptions"], "signature": "--no-subscriptions", "description": "Do not dump subscriptions."}, {"names": ["--no-sync"], "signature": "--no-sync", "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-table-access-method"], "signature": "--no-table-access-method", "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-tablespaces"], "signature": "--no-tablespaces", "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-toast-compression"], "signature": "--no-toast-compression", "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-unlogged-table-data"], "signature": "--no-unlogged-table-data", "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": ["--on-conflict-do-nothing"], "signature": "--on-conflict-do-nothing", "description": "Add ON CONFLICT DO NOTHING to INSERT commands. This option is not valid unless --inserts or --column-inserts is also specified."}, {"names": ["--quote-all-identifiers"], "signature": "--quote-all-identifiers", "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": ["--restrict-key= restrict_key"], "signature": "--restrict-key= restrict_key", "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": ["--rows-per-insert= nrows"], "signature": "--rows-per-insert= nrows", "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": ["--statistics"], "signature": "--statistics", "description": "Dump optimizer statistics."}, {"names": ["--statistics-only"], "signature": "--statistics-only", "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": ["--sequence-data"], "signature": "--sequence-data", "description": "Include sequence data in the dump. This is the default behavior except when --no-data , --schema-only , or --statistics-only is specified."}, {"names": ["--use-set-session-authorization"], "signature": "--use-set-session-authorization", "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": ["-?", "--help"], "signature": "-? --help", "description": "Show help about pg_dumpall command line arguments, and exit."}, {"names": ["-d connstr", "--dbname= connstr"], "signature": "-d connstr --dbname= connstr", "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": ["-h host", "--host= host"], "signature": "-h host --host= host", "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": ["-l dbname", "--database= dbname"], "signature": "-l dbname --database= dbname", "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": ["-p port", "--port= port"], "signature": "-p port --port= port", "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": ["-U username", "--username= username"], "signature": "-U username --username= username", "description": "User name to connect as."}, {"names": ["-w", "--no-password"], "signature": "-w --no-password", "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", "--password"], "signature": "-W --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": ["--role= rolename"], "signature": "--role= rolename", "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."}], "synopsis": ["pg_dumpall [ connection-option ...] [ option ...]"], "environment": [{"name": "PGHOST PGOPTIONS PGPORT PGUSER", "description": "Default connection parameters"}, {"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}]}, "comparison_hash": "dd0edf9a9ef6de0e86b97b0a2b08127ecf99f382528014ef50f210767b2d4f6c"}}}, "snapshot": {"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"}], "tables": [{"key": "options", "rows": [{"summary": "Dump only the data, not the schema (data definitions) or statistics.", "signature": {"url": "/docs/18/app-pg-dumpall.html", "text": "-a --data-only"}}, {"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": {"url": "/docs/18/app-pg-dumpall.html", "text": "-c --clean"}}, {"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": {"url": "/docs/18/app-pg-dumpall.html", "text": "-E encoding --encoding= encoding"}}, {"summary": "Send output to the specified file. If this is omitted, the standard output is used.", "signature": {"url": "/docs/18/app-pg-dumpall.html", "text": "-f filename --file= filename"}}, {"summary": "Dump only global objects (roles and tablespaces), no databases.", "signature": {"url": "/docs/18/app-pg-dumpall.html", "text": "-g --globals-only"}}, {"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": {"url": "/docs/18/app-pg-dumpall.html", "text": "-O --no-owner"}}, {"summary": "Dump only roles, no databases or tablespaces.", "signature": {"url": "/docs/18/app-pg-dumpall.html", "text": "-r --roles-only"}}, {"summary": "Dump only the object definitions (schema), not data.", "signature": {"url": "/docs/18/app-pg-dumpall.html", "text": "-s --schema-only"}}, {"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": {"url": "/docs/18/app-pg-dumpall.html", "text": "-S username --superuser= username"}}, {"summary": "Dump only tablespaces, no databases or roles.", "signature": {"url": "/docs/18/app-pg-dumpall.html", "text": "-t --tablespaces-only"}}, {"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": {"url": "/docs/18/app-pg-dumpall.html", "text": "-v --verbose"}}, {"summary": "Print the pg_dumpall version and exit.", "signature": {"url": "/docs/18/app-pg-dumpall.html", "text": "-V --version"}}, {"summary": "Prevent dumping of access privileges (grant/revoke commands).", "signature": {"url": "/docs/18/app-pg-dumpall.html", "text": "-x --no-privileges --no-acl"}}, {"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": {"url": "/docs/18/app-pg-dumpall.html", "text": "--binary-upgrade"}}, {"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": {"url": "/docs/18/app-pg-dumpall.html", "text": "--column-inserts --attribute-inserts"}}, {"summary": "This option disables the use of dollar quoting for function bodies, and forces them to be quoted using SQL standard string syntax.", "signature": {"url": "/docs/18/app-pg-dumpall.html", "text": "--disable-dollar-quoting"}}, {"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": {"url": "/docs/18/app-pg-dumpall.html", "text": "--disable-triggers"}}, {"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": {"url": "/docs/18/app-pg-dumpall.html", "text": "--exclude-database= pattern"}}, {"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": {"url": "/docs/18/app-pg-dumpall.html", "text": "--extra-float-digits= ndigits"}}, {"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": {"url": "/docs/18/app-pg-dumpall.html", "text": "--filter= filename"}}, {"summary": "Use DROP ... IF EXISTS commands to drop objects in --clean mode. This suppresses \u201c does not exist \u201d errors that might otherwise be reported. This option is not valid unless --clean is also specified.", "signature": {"url": "/docs/18/app-pg-dumpall.html", "text": "--if-exists"}}, {"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": {"url": "/docs/18/app-pg-dumpall.html", "text": "--inserts"}}, {"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": {"url": "/docs/18/app-pg-dumpall.html", "text": "--load-via-partition-root"}}, {"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": {"url": "/docs/18/app-pg-dumpall.html", "text": "--lock-wait-timeout= timeout"}}, {"summary": "Do not dump COMMENT commands.", "signature": {"url": "/docs/18/app-pg-dumpall.html", "text": "--no-comments"}}, {"summary": "Do not dump data.", "signature": {"url": "/docs/18/app-pg-dumpall.html", "text": "--no-data"}}, {"summary": "Do not dump row security policies.", "signature": {"url": "/docs/18/app-pg-dumpall.html", "text": "--no-policies"}}, {"summary": "Do not dump publications.", "signature": {"url": "/docs/18/app-pg-dumpall.html", "text": "--no-publications"}}, {"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": {"url": "/docs/18/app-pg-dumpall.html", "text": "--no-role-passwords"}}, {"summary": "Do not dump schema (data definitions).", "signature": {"url": "/docs/18/app-pg-dumpall.html", "text": "--no-schema"}}, {"summary": "Do not dump security labels.", "signature": {"url": "/docs/18/app-pg-dumpall.html", "text": "--no-security-labels"}}, {"summary": "Do not dump statistics. This is the default.", "signature": {"url": "/docs/18/app-pg-dumpall.html", "text": "--no-statistics"}}, {"summary": "Do not dump subscriptions.", "signature": {"url": "/docs/18/app-pg-dumpall.html", "text": "--no-subscriptions"}}, {"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": {"url": "/docs/18/app-pg-dumpall.html", "text": "--no-sync"}}, {"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": {"url": "/docs/18/app-pg-dumpall.html", "text": "--no-table-access-method"}}, {"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": {"url": "/docs/18/app-pg-dumpall.html", "text": "--no-tablespaces"}}, {"summary": "Do not output commands to set TOAST compression methods. With this option, all columns will be restored with the default compression setting.", "signature": {"url": "/docs/18/app-pg-dumpall.html", "text": "--no-toast-compression"}}, {"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": {"url": "/docs/18/app-pg-dumpall.html", "text": "--no-unlogged-table-data"}}, {"summary": "Add ON CONFLICT DO NOTHING to INSERT commands. This option is not valid unless --inserts or --column-inserts is also specified.", "signature": {"url": "/docs/18/app-pg-dumpall.html", "text": "--on-conflict-do-nothing"}}, {"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": {"url": "/docs/18/app-pg-dumpall.html", "text": "--quote-all-identifiers"}}, {"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": {"url": "/docs/18/app-pg-dumpall.html", "text": "--restrict-key= restrict_key"}}, {"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": {"url": "/docs/18/app-pg-dumpall.html", "text": "--rows-per-insert= nrows"}}, {"summary": "Dump optimizer statistics.", "signature": {"url": "/docs/18/app-pg-dumpall.html", "text": "--statistics"}}, {"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": {"url": "/docs/18/app-pg-dumpall.html", "text": "--statistics-only"}}, {"summary": "Include sequence data in the dump. This is the default behavior except when --no-data , --schema-only , or --statistics-only is specified.", "signature": {"url": "/docs/18/app-pg-dumpall.html", "text": "--sequence-data"}}, {"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": {"url": "/docs/18/app-pg-dumpall.html", "text": "--use-set-session-authorization"}}, {"summary": "Show help about pg_dumpall command line arguments, and exit.", "signature": {"url": "/docs/18/app-pg-dumpall.html", "text": "-? --help"}}, {"summary": "Specifies parameters used to connect to the server, as a connection string ; these will override any conflicting command line options.", "signature": {"url": "/docs/18/app-pg-dumpall.html", "text": "-d connstr --dbname= connstr"}}, {"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": {"url": "/docs/18/app-pg-dumpall.html", "text": "-h host --host= host"}}, {"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": {"url": "/docs/18/app-pg-dumpall.html", "text": "-l dbname --database= dbname"}}, {"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": {"url": "/docs/18/app-pg-dumpall.html", "text": "-p port --port= port"}}, {"summary": "User name to connect as.", "signature": {"url": "/docs/18/app-pg-dumpall.html", "text": "-U username --username= username"}}, {"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": {"url": "/docs/18/app-pg-dumpall.html", "text": "-w --no-password"}}, {"summary": "Force pg_dumpall to prompt for a password before connecting to a database.", "signature": {"url": "/docs/18/app-pg-dumpall.html", "text": "-W --password"}}, {"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.", "signature": {"url": "/docs/18/app-pg-dumpall.html", "text": "--role= rolename"}}], "title": "Documented options", "columns": [{"key": "signature", "label": "Option and arguments"}, {"key": "summary", "label": "Description"}]}, {"key": "environment", "rows": [{"name": "PGHOST PGOPTIONS PGPORT PGUSER", "description": "Default connection parameters"}, {"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}], "title": "Environment variables", "columns": [{"key": "name", "label": "Variable"}, {"key": "description", "label": "Meaning"}]}], "options": [{"names": ["-a", "--data-only"], "summary": "Dump only the data, not the schema (data definitions) or statistics.", "signature": "-a --data-only", "source_url": "/docs/18/app-pg-dumpall.html", "description": "Dump only the data, not the schema (data definitions) or statistics."}, {"names": ["-c", "--clean"], "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": "-c --clean", "source_url": "/docs/18/app-pg-dumpall.html", "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": ["-E encoding", "--encoding= encoding"], "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": "-E encoding --encoding= encoding", "source_url": "/docs/18/app-pg-dumpall.html", "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": ["-f filename", "--file= filename"], "summary": "Send output to the specified file. If this is omitted, the standard output is used.", "signature": "-f filename --file= filename", "source_url": "/docs/18/app-pg-dumpall.html", "description": "Send output to the specified file. If this is omitted, the standard output is used."}, {"names": ["-g", "--globals-only"], "summary": "Dump only global objects (roles and tablespaces), no databases.", "signature": "-g --globals-only", "source_url": "/docs/18/app-pg-dumpall.html", "description": "Dump only global objects (roles and tablespaces), no databases."}, {"names": ["-O", "--no-owner"], "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": "-O --no-owner", "source_url": "/docs/18/app-pg-dumpall.html", "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": ["-r", "--roles-only"], "summary": "Dump only roles, no databases or tablespaces.", "signature": "-r --roles-only", "source_url": "/docs/18/app-pg-dumpall.html", "description": "Dump only roles, no databases or tablespaces."}, {"names": ["-s", "--schema-only"], "summary": "Dump only the object definitions (schema), not data.", "signature": "-s --schema-only", "source_url": "/docs/18/app-pg-dumpall.html", "description": "Dump only the object definitions (schema), not data."}, {"names": ["-S username", "--superuser= username"], "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": "-S username --superuser= username", "source_url": "/docs/18/app-pg-dumpall.html", "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": ["-t", "--tablespaces-only"], "summary": "Dump only tablespaces, no databases or roles.", "signature": "-t --tablespaces-only", "source_url": "/docs/18/app-pg-dumpall.html", "description": "Dump only tablespaces, no databases or roles."}, {"names": ["-v", "--verbose"], "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": "-v --verbose", "source_url": "/docs/18/app-pg-dumpall.html", "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", "--version"], "summary": "Print the pg_dumpall version and exit.", "signature": "-V --version", "source_url": "/docs/18/app-pg-dumpall.html", "description": "Print the pg_dumpall version and exit."}, {"names": ["-x", "--no-privileges", "--no-acl"], "summary": "Prevent dumping of access privileges (grant/revoke commands).", "signature": "-x --no-privileges --no-acl", "source_url": "/docs/18/app-pg-dumpall.html", "description": "Prevent dumping of access privileges (grant/revoke commands)."}, {"names": ["--binary-upgrade"], "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": "--binary-upgrade", "source_url": "/docs/18/app-pg-dumpall.html", "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": ["--column-inserts", "--attribute-inserts"], "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": "--column-inserts --attribute-inserts", "source_url": "/docs/18/app-pg-dumpall.html", "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": ["--disable-dollar-quoting"], "summary": "This option disables the use of dollar quoting for function bodies, and forces them to be quoted using SQL standard string syntax.", "signature": "--disable-dollar-quoting", "source_url": "/docs/18/app-pg-dumpall.html", "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-triggers"], "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": "--disable-triggers", "source_url": "/docs/18/app-pg-dumpall.html", "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": ["--exclude-database= pattern"], "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": "--exclude-database= pattern", "source_url": "/docs/18/app-pg-dumpall.html", "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": ["--extra-float-digits= ndigits"], "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": "--extra-float-digits= ndigits", "source_url": "/docs/18/app-pg-dumpall.html", "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": ["--filter= filename"], "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": "--filter= filename", "source_url": "/docs/18/app-pg-dumpall.html", "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": ["--if-exists"], "summary": "Use DROP ... IF EXISTS commands to drop objects in --clean mode. This suppresses \u201c does not exist \u201d errors that might otherwise be reported. This option is not valid unless --clean is also specified.", "signature": "--if-exists", "source_url": "/docs/18/app-pg-dumpall.html", "description": "Use DROP ... IF EXISTS commands to drop objects in --clean mode. This suppresses \u201c does not exist \u201d errors that might otherwise be reported. This option is not valid unless --clean is also specified."}, {"names": ["--inserts"], "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": "--inserts", "source_url": "/docs/18/app-pg-dumpall.html", "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": ["--load-via-partition-root"], "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": "--load-via-partition-root", "source_url": "/docs/18/app-pg-dumpall.html", "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": ["--lock-wait-timeout= timeout"], "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": "--lock-wait-timeout= timeout", "source_url": "/docs/18/app-pg-dumpall.html", "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": ["--no-comments"], "summary": "Do not dump COMMENT commands.", "signature": "--no-comments", "source_url": "/docs/18/app-pg-dumpall.html", "description": "Do not dump COMMENT commands."}, {"names": ["--no-data"], "summary": "Do not dump data.", "signature": "--no-data", "source_url": "/docs/18/app-pg-dumpall.html", "description": "Do not dump data."}, {"names": ["--no-policies"], "summary": "Do not dump row security policies.", "signature": "--no-policies", "source_url": "/docs/18/app-pg-dumpall.html", "description": "Do not dump row security policies."}, {"names": ["--no-publications"], "summary": "Do not dump publications.", "signature": "--no-publications", "source_url": "/docs/18/app-pg-dumpall.html", "description": "Do not dump publications."}, {"names": ["--no-role-passwords"], "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": "--no-role-passwords", "source_url": "/docs/18/app-pg-dumpall.html", "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-schema"], "summary": "Do not dump schema (data definitions).", "signature": "--no-schema", "source_url": "/docs/18/app-pg-dumpall.html", "description": "Do not dump schema (data definitions)."}, {"names": ["--no-security-labels"], "summary": "Do not dump security labels.", "signature": "--no-security-labels", "source_url": "/docs/18/app-pg-dumpall.html", "description": "Do not dump security labels."}, {"names": ["--no-statistics"], "summary": "Do not dump statistics. This is the default.", "signature": "--no-statistics", "source_url": "/docs/18/app-pg-dumpall.html", "description": "Do not dump statistics. This is the default."}, {"names": ["--no-subscriptions"], "summary": "Do not dump subscriptions.", "signature": "--no-subscriptions", "source_url": "/docs/18/app-pg-dumpall.html", "description": "Do not dump subscriptions."}, {"names": ["--no-sync"], "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": "--no-sync", "source_url": "/docs/18/app-pg-dumpall.html", "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-table-access-method"], "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": "--no-table-access-method", "source_url": "/docs/18/app-pg-dumpall.html", "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-tablespaces"], "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": "--no-tablespaces", "source_url": "/docs/18/app-pg-dumpall.html", "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-toast-compression"], "summary": "Do not output commands to set TOAST compression methods. With this option, all columns will be restored with the default compression setting.", "signature": "--no-toast-compression", "source_url": "/docs/18/app-pg-dumpall.html", "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-unlogged-table-data"], "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": "--no-unlogged-table-data", "source_url": "/docs/18/app-pg-dumpall.html", "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": ["--on-conflict-do-nothing"], "summary": "Add ON CONFLICT DO NOTHING to INSERT commands. This option is not valid unless --inserts or --column-inserts is also specified.", "signature": "--on-conflict-do-nothing", "source_url": "/docs/18/app-pg-dumpall.html", "description": "Add ON CONFLICT DO NOTHING to INSERT commands. This option is not valid unless --inserts or --column-inserts is also specified."}, {"names": ["--quote-all-identifiers"], "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": "--quote-all-identifiers", "source_url": "/docs/18/app-pg-dumpall.html", "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": ["--restrict-key= restrict_key"], "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": "--restrict-key= restrict_key", "source_url": "/docs/18/app-pg-dumpall.html", "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": ["--rows-per-insert= nrows"], "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": "--rows-per-insert= nrows", "source_url": "/docs/18/app-pg-dumpall.html", "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": ["--statistics"], "summary": "Dump optimizer statistics.", "signature": "--statistics", "source_url": "/docs/18/app-pg-dumpall.html", "description": "Dump optimizer statistics."}, {"names": ["--statistics-only"], "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": "--statistics-only", "source_url": "/docs/18/app-pg-dumpall.html", "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": ["--sequence-data"], "summary": "Include sequence data in the dump. This is the default behavior except when --no-data , --schema-only , or --statistics-only is specified.", "signature": "--sequence-data", "source_url": "/docs/18/app-pg-dumpall.html", "description": "Include sequence data in the dump. This is the default behavior except when --no-data , --schema-only , or --statistics-only is specified."}, {"names": ["--use-set-session-authorization"], "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": "--use-set-session-authorization", "source_url": "/docs/18/app-pg-dumpall.html", "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": ["-?", "--help"], "summary": "Show help about pg_dumpall command line arguments, and exit.", "signature": "-? --help", "source_url": "/docs/18/app-pg-dumpall.html", "description": "Show help about pg_dumpall command line arguments, and exit."}, {"names": ["-d connstr", "--dbname= connstr"], "summary": "Specifies parameters used to connect to the server, as a connection string ; these will override any conflicting command line options.", "signature": "-d connstr --dbname= connstr", "source_url": "/docs/18/app-pg-dumpall.html", "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": ["-h host", "--host= host"], "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": "-h host --host= host", "source_url": "/docs/18/app-pg-dumpall.html", "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": ["-l dbname", "--database= dbname"], "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": "-l dbname --database= dbname", "source_url": "/docs/18/app-pg-dumpall.html", "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": ["-p port", "--port= port"], "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": "-p port --port= port", "source_url": "/docs/18/app-pg-dumpall.html", "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": ["-U username", "--username= username"], "summary": "User name to connect as.", "signature": "-U username --username= username", "source_url": "/docs/18/app-pg-dumpall.html", "description": "User name to connect as."}, {"names": ["-w", "--no-password"], "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": "-w --no-password", "source_url": "/docs/18/app-pg-dumpall.html", "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", "--password"], "summary": "Force pg_dumpall to prompt for a password before connecting to a database.", "signature": "-W --password", "source_url": "/docs/18/app-pg-dumpall.html", "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": ["--role= rolename"], "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.", "signature": "--role= rolename", "source_url": "/docs/18/app-pg-dumpall.html", "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."}], "related": [{"url": "/wiki/conn/?v=18", "label": "libpq connection parameters"}], "release": {"ref": "https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2", "label": "18.6", "major": "18", "channel": "stable", "manifest": {"pdf": {"A4": {"url": "/files/documentation/pdf/18/postgresql-18-A4.pdf", "bytes": 15865106, "pages": 3154, "sha256": "19512c405da53f9f7fcf0abba359223aa65f021be025bf3411381918f92e3190", "built_at": "2026-09-26"}, "US": {"url": "/files/documentation/pdf/18/postgresql-18-US.pdf", "bytes": 15748059, "pages": 3328, "sha256": "facbe6c229e598b872d3d98bef53308f46e06746006fa4590de9a7de9dd46319", "built_at": "2026-09-26"}}, "tree": "18", "index": "index.html", "major": "18", "pages": 1148, "release": "18.6", "source_url": "https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2", "svg_assets": 3, "source_mode": "en SGML built with pinned official archive", "source_sha256": "555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f"}, "revision": "ee8d1a3612338fd9adf250730cb640fcc5233b5491337cc00a316a44e3a0b9f8", "evidence_kind": "English manual and source declarations", "source_sha256": "555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f"}, "sources": [{"url": "/docs/18/app-pg-dumpall.html", "file": "app-pg-dumpall.html", "label": "18.6 English manual \u00b7 app-pg-dumpall.html", "anchor": "", "sha256": "5f64e2921cefa4823764e46860b95e0f5f7568192670220a0bac10314c740683"}, {"url": "/docs/18/reference-client.html", "file": "reference-client.html", "label": "Client applications inventory", "anchor": "", "sha256": "68f726af77272fe73a827be2b7b5958d0f2239a6f8ed44264e9d42496bfa4fd0"}], "sections": [], "synopsis": ["pg_dumpall [ connection-option ...] [ option ...]"], "signature": "pg_dumpall [ connection-option ...] [ option ...]", "description": ["pg_dumpall \u2014 extract a PostgreSQL database cluster into a script file"], "environment": [{"name": "PGHOST PGOPTIONS PGPORT PGUSER", "description": "Default connection parameters"}, {"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}], "manual_html": "<div><div class=\"refentry\" id=\"APP-PG-DUMPALL\">\n<div class=\"titlepage\"></div>\n<div class=\"refnamediv\">\n<h2><span class=\"refentrytitle\"><span class=\"application\">pg_dumpall</span></span></h2>\n<p>pg_dumpall \u2014 extract a <span class=\"productname\">PostgreSQL</span> database cluster into a script file</p>\n</div>\n<div class=\"refsynopsisdiv\">\n<h2>Synopsis</h2>\n<div class=\"cmdsynopsis\">\n<p id=\"id-1.9.4.15.4.1\"><code class=\"command\">pg_dumpall</code> [<em class=\"replaceable\"><code>connection-option</code></em>...] [<em class=\"replaceable\"><code>option</code></em>...]</p>\n</div>\n</div>\n<div class=\"refsect1\" id=\"APP-PG-DUMPALL-DESCRIPTION\">\n<h2>Description</h2>\n<p><span class=\"application\">pg_dumpall</span> is a utility for writing out (<span class=\"quote\">\u201c<span class=\"quote\">dumping</span>\u201d</span>) all <span class=\"productname\">PostgreSQL</span> databases of a cluster into one script file. The script file contains SQL commands that can be used as input to <a class=\"xref\" href=\"/docs/18/app-psql.html\" title=\"psql\"><span class=\"refentrytitle\"><span class=\"application\">psql</span></span></a> to restore the databases. It does this by calling <a class=\"xref\" href=\"/docs/18/app-pgdump.html\" title=\"pg_dump\"><span class=\"refentrytitle\"><span class=\"application\">pg_dump</span></span></a> for each database in the cluster. <span class=\"application\">pg_dumpall</span> also dumps global objects that are common to all databases, namely database roles, tablespaces, and privilege grants for configuration parameters. (<span class=\"application\">pg_dump</span> does not save these objects.)</p>\n<p>Since <span class=\"application\">pg_dumpall</span> 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.</p>\n<p>The SQL script will be written to the standard output. Use the <code class=\"option\">-f</code>/<code class=\"option\">--file</code> option or shell operators to redirect it into a file.</p>\n<p><span class=\"application\">pg_dumpall</span> needs to connect several times to the <span class=\"productname\">PostgreSQL</span> server (once per database). If you use password authentication it will ask for a password each time. It is convenient to have a <code class=\"filename\">~/.pgpass</code> file in such cases. See <a class=\"xref\" href=\"/docs/18/libpq-pgpass.html\" title=\"32.16.\u00a0The Password File\">Section\u00a032.16</a> for more information.</p>\n<div class=\"warning\">\n<h3 class=\"title\">Warning</h3>\n<p>Restoring 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.</p>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.15.6\">\n<h2>Options</h2>\n<p>The following command-line options control the content and format of the output.</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-a</code><br></span><span class=\"term\"><code class=\"option\">--data-only</code></span></dt>\n<dd>\n<p>Dump only the data, not the schema (data definitions) or statistics.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-c</code><br></span><span class=\"term\"><code class=\"option\">--clean</code></span></dt>\n<dd>\n<p>Emit SQL commands to <code class=\"command\">DROP</code> 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 <code class=\"option\">--if-exists</code> is also specified.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-E <em class=\"replaceable\"><code>encoding</code></em></code><br></span><span class=\"term\"><code class=\"option\">--encoding=<em class=\"replaceable\"><code>encoding</code></em></code></span></dt>\n<dd>\n<p>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 <code class=\"envar\">PGCLIENTENCODING</code> environment variable to the desired dump encoding.)</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-f <em class=\"replaceable\"><code>filename</code></em></code><br></span><span class=\"term\"><code class=\"option\">--file=<em class=\"replaceable\"><code>filename</code></em></code></span></dt>\n<dd>\n<p>Send output to the specified file. If this is omitted, the standard output is used.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-g</code><br></span><span class=\"term\"><code class=\"option\">--globals-only</code></span></dt>\n<dd>\n<p>Dump only global objects (roles and tablespaces), no databases.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-O</code><br></span><span class=\"term\"><code class=\"option\">--no-owner</code></span></dt>\n<dd>\n<p>Do not output commands to set ownership of objects to match the original database. By default, <span class=\"application\">pg_dumpall</span> issues <code class=\"command\">ALTER OWNER</code> or <code class=\"command\">SET SESSION AUTHORIZATION</code> 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 <code class=\"option\">-O</code>.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-r</code><br></span><span class=\"term\"><code class=\"option\">--roles-only</code></span></dt>\n<dd>\n<p>Dump only roles, no databases or tablespaces.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-s</code><br></span><span class=\"term\"><code class=\"option\">--schema-only</code></span></dt>\n<dd>\n<p>Dump only the object definitions (schema), not data.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-S <em class=\"replaceable\"><code>username</code></em></code><br></span><span class=\"term\"><code class=\"option\">--superuser=<em class=\"replaceable\"><code>username</code></em></code></span></dt>\n<dd>\n<p>Specify the superuser user name to use when disabling triggers. This is relevant only if <code class=\"option\">--disable-triggers</code> is used. (Usually, it's better to leave this out, and instead start the resulting script as superuser.)</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-t</code><br></span><span class=\"term\"><code class=\"option\">--tablespaces-only</code></span></dt>\n<dd>\n<p>Dump only tablespaces, no databases or roles.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-v</code><br></span><span class=\"term\"><code class=\"option\">--verbose</code></span></dt>\n<dd>\n<p>Specifies verbose mode. This will cause <span class=\"application\">pg_dumpall</span> 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 <span class=\"application\">pg_dump</span>.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-V</code><br></span><span class=\"term\"><code class=\"option\">--version</code></span></dt>\n<dd>\n<p>Print the <span class=\"application\">pg_dumpall</span> version and exit.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-x</code><br></span><span class=\"term\"><code class=\"option\">--no-privileges</code><br></span><span class=\"term\"><code class=\"option\">--no-acl</code></span></dt>\n<dd>\n<p>Prevent dumping of access privileges (grant/revoke commands).</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--binary-upgrade</code></span></dt>\n<dd>\n<p>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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--column-inserts</code><br></span><span class=\"term\"><code class=\"option\">--attribute-inserts</code></span></dt>\n<dd>\n<p>Dump data as <code class=\"command\">INSERT</code> commands with explicit column names (<code class=\"literal\">INSERT INTO <em class=\"replaceable\"><code>table</code></em> (<em class=\"replaceable\"><code>column</code></em>, ...) VALUES ...</code>). This will make restoration very slow; it is mainly useful for making dumps that can be loaded into non-<span class=\"productname\">PostgreSQL</span> databases.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--disable-dollar-quoting</code></span></dt>\n<dd>\n<p>This option disables the use of dollar quoting for function bodies, and forces them to be quoted using SQL standard string syntax.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--disable-triggers</code></span></dt>\n<dd>\n<p>This option is relevant only when creating a dump with data and without schema. It instructs <span class=\"application\">pg_dumpall</span> 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.</p>\n<p>Presently, the commands emitted for <code class=\"option\">--disable-triggers</code> must be done as superuser. So, you should also specify a superuser name with <code class=\"option\">-S</code>, or preferably be careful to start the resulting script as a superuser.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--exclude-database=<em class=\"replaceable\"><code>pattern</code></em></code></span></dt>\n<dd>\n<p>Do not dump databases whose name matches <em class=\"replaceable\"><code>pattern</code></em>. Multiple patterns can be excluded by writing multiple <code class=\"option\">--exclude-database</code> switches. The <em class=\"replaceable\"><code>pattern</code></em> parameter is interpreted as a pattern according to the same rules used by <span class=\"application\">psql</span>'s <code class=\"literal\">\\d</code> commands (see <a class=\"xref\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\">Patterns</a>), 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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--extra-float-digits=<em class=\"replaceable\"><code>ndigits</code></em></code></span></dt>\n<dd>\n<p>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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--filter=<em class=\"replaceable\"><code>filename</code></em></code></span></dt>\n<dd>\n<p>Specify a filename from which to read patterns for databases excluded from the dump. The patterns are interpreted according to the same rules as <code class=\"option\">--exclude-database</code>. To read from <code class=\"literal\">STDIN</code>, use <code class=\"filename\">-</code> as the filename. The <code class=\"option\">--filter</code> option can be specified in conjunction with <code class=\"option\">--exclude-database</code> for excluding databases, and can also be specified more than once for multiple filter files.</p>\n<p>The file lists one database pattern per row, with the following format:</p>\n<pre class=\"synopsis\">exclude database <em class=\"replaceable\"><code>PATTERN</code></em>\n</pre>\n<p>Lines starting with <code class=\"literal\">#</code> are considered comments and ignored. Comments can be placed after an object pattern row as well. Blank lines are also ignored. See <a class=\"xref\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\">Patterns</a> for how to perform quoting in patterns.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--if-exists</code></span></dt>\n<dd>\n<p>Use <code class=\"literal\">DROP ... IF EXISTS</code> commands to drop objects in <code class=\"option\">--clean</code> mode. This suppresses <span class=\"quote\">\u201c<span class=\"quote\">does not exist</span>\u201d</span> errors that might otherwise be reported. This option is not valid unless <code class=\"option\">--clean</code> is also specified.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--inserts</code></span></dt>\n<dd>\n<p>Dump data as <code class=\"command\">INSERT</code> commands (rather than <code class=\"command\">COPY</code>). This will make restoration very slow; it is mainly useful for making dumps that can be loaded into non-<span class=\"productname\">PostgreSQL</span> databases. Note that the restore might fail altogether if you have rearranged column order. The <code class=\"option\">--column-inserts</code> option is safer, though even slower.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--load-via-partition-root</code></span></dt>\n<dd>\n<p>When dumping data for a table partition, make the <code class=\"command\">COPY</code> or <code class=\"command\">INSERT</code> 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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--lock-wait-timeout=<em class=\"replaceable\"><code>timeout</code></em></code></span></dt>\n<dd>\n<p>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 <em class=\"replaceable\"><code>timeout</code></em>. The timeout may be specified in any of the formats accepted by <code class=\"command\">SET statement_timeout</code>.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-comments</code></span></dt>\n<dd>\n<p>Do not dump <code class=\"command\">COMMENT</code> commands.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-data</code></span></dt>\n<dd>\n<p>Do not dump data.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-policies</code></span></dt>\n<dd>\n<p>Do not dump row security policies.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-publications</code></span></dt>\n<dd>\n<p>Do not dump publications.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-role-passwords</code></span></dt>\n<dd>\n<p>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 <code class=\"structname\">pg_roles</code> instead of <code class=\"structname\">pg_authid</code>. Therefore, this option also helps if access to <code class=\"structname\">pg_authid</code> is restricted by some security policy.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-schema</code></span></dt>\n<dd>\n<p>Do not dump schema (data definitions).</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-security-labels</code></span></dt>\n<dd>\n<p>Do not dump security labels.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-statistics</code></span></dt>\n<dd>\n<p>Do not dump statistics. This is the default.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-subscriptions</code></span></dt>\n<dd>\n<p>Do not dump subscriptions.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-sync</code></span></dt>\n<dd>\n<p>By default, <code class=\"command\">pg_dumpall</code> will wait for all files to be written safely to disk. This option causes <code class=\"command\">pg_dumpall</code> 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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-table-access-method</code></span></dt>\n<dd>\n<p>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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-tablespaces</code></span></dt>\n<dd>\n<p>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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-toast-compression</code></span></dt>\n<dd>\n<p>Do not output commands to set TOAST compression methods. With this option, all columns will be restored with the default compression setting.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--no-unlogged-table-data</code></span></dt>\n<dd>\n<p>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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--on-conflict-do-nothing</code></span></dt>\n<dd>\n<p>Add <code class=\"literal\">ON CONFLICT DO NOTHING</code> to <code class=\"command\">INSERT</code> commands. This option is not valid unless <code class=\"option\">--inserts</code> or <code class=\"option\">--column-inserts</code> is also specified.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--quote-all-identifiers</code></span></dt>\n<dd>\n<p>Force quoting of all identifiers. This option is recommended when dumping a database from a server whose <span class=\"productname\">PostgreSQL</span> major version is different from <span class=\"application\">pg_dumpall</span>'s, or when the output is intended to be loaded into a server of a different major version. By default, <span class=\"application\">pg_dumpall</span> 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 <code class=\"option\">--quote-all-identifiers</code> prevents such issues, at the price of a harder-to-read dump script.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--restrict-key=<em class=\"replaceable\"><code>restrict_key</code></em></code></span></dt>\n<dd>\n<p>Use the provided string as the <span class=\"application\">psql</span> <code class=\"command\">\\restrict</code> key in the dump output. If no restrict key is specified, <span class=\"application\">pg_dumpall</span> will generate a random one as needed. Keys may contain only alphanumeric characters.</p>\n<p>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 <span class=\"application\">psql</span> with the dump output.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--rows-per-insert=<em class=\"replaceable\"><code>nrows</code></em></code></span></dt>\n<dd>\n<p>Dump data as <code class=\"command\">INSERT</code> commands (rather than <code class=\"command\">COPY</code>). Controls the maximum number of rows per <code class=\"command\">INSERT</code> 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 <code class=\"command\">INSERT</code> to be lost, rather than the entire table contents.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--statistics</code></span></dt>\n<dd>\n<p>Dump optimizer statistics.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--statistics-only</code></span></dt>\n<dd>\n<p>Dump only the statistics, not the schema (data definitions) or data. Optimizer statistics for tables, materialized views, foreign tables, and indexes are dumped.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--sequence-data</code></span></dt>\n<dd>\n<p>Include sequence data in the dump. This is the default behavior except when <code class=\"option\">--no-data</code>, <code class=\"option\">--schema-only</code>, or <code class=\"option\">--statistics-only</code> is specified.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--use-set-session-authorization</code></span></dt>\n<dd>\n<p>Output SQL-standard <code class=\"command\">SET SESSION AUTHORIZATION</code> commands instead of <code class=\"command\">ALTER OWNER</code> 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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-?</code><br></span><span class=\"term\"><code class=\"option\">--help</code></span></dt>\n<dd>\n<p>Show help about <span class=\"application\">pg_dumpall</span> command line arguments, and exit.</p>\n</dd>\n</dl>\n</div>\n<p>The following command-line options control the database connection parameters.</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-d <em class=\"replaceable\"><code>connstr</code></em></code><br></span><span class=\"term\"><code class=\"option\">--dbname=<em class=\"replaceable\"><code>connstr</code></em></code></span></dt>\n<dd>\n<p>Specifies parameters used to connect to the server, as a <a class=\"link\" href=\"/docs/18/libpq-connect.html#LIBPQ-CONNSTRING\" title=\"32.1.1.\u00a0Connection Strings\">connection string</a>; these will override any conflicting command line options.</p>\n<p>The option is called <code class=\"literal\">--dbname</code> for consistency with other client applications, but because <span class=\"application\">pg_dumpall</span> needs to connect to many databases, the database name in the connection string will be ignored. Use the <code class=\"literal\">-l</code> 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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-h <em class=\"replaceable\"><code>host</code></em></code><br></span><span class=\"term\"><code class=\"option\">--host=<em class=\"replaceable\"><code>host</code></em></code></span></dt>\n<dd>\n<p>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 <code class=\"envar\">PGHOST</code> environment variable, if set, else a Unix domain socket connection is attempted.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-l <em class=\"replaceable\"><code>dbname</code></em></code><br></span><span class=\"term\"><code class=\"option\">--database=<em class=\"replaceable\"><code>dbname</code></em></code></span></dt>\n<dd>\n<p>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 <code class=\"literal\">postgres</code> database will be used, and if that does not exist, <code class=\"literal\">template1</code> will be used.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-p <em class=\"replaceable\"><code>port</code></em></code><br></span><span class=\"term\"><code class=\"option\">--port=<em class=\"replaceable\"><code>port</code></em></code></span></dt>\n<dd>\n<p>Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the <code class=\"envar\">PGPORT</code> environment variable, if set, or a compiled-in default.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-U <em class=\"replaceable\"><code>username</code></em></code><br></span><span class=\"term\"><code class=\"option\">--username=<em class=\"replaceable\"><code>username</code></em></code></span></dt>\n<dd>\n<p>User name to connect as.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-w</code><br></span><span class=\"term\"><code class=\"option\">--no-password</code></span></dt>\n<dd>\n<p>Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a <code class=\"filename\">.pgpass</code> 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.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-W</code><br></span><span class=\"term\"><code class=\"option\">--password</code></span></dt>\n<dd>\n<p>Force <span class=\"application\">pg_dumpall</span> to prompt for a password before connecting to a database.</p>\n<p>This option is never essential, since <span class=\"application\">pg_dumpall</span> will automatically prompt for a password if the server demands password authentication. However, <span class=\"application\">pg_dumpall</span> will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing <code class=\"option\">-W</code> to avoid the extra connection attempt.</p>\n<p>Note that the password prompt will occur again for each database to be dumped. Usually, it's better to set up a <code class=\"filename\">~/.pgpass</code> file than to rely on manual password entry.</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--role=<em class=\"replaceable\"><code>rolename</code></em></code></span></dt>\n<dd>\n<p>Specifies a role name to be used to create the dump. This option causes <span class=\"application\">pg_dumpall</span> to issue a <code class=\"command\">SET ROLE</code> <em class=\"replaceable\"><code>rolename</code></em> command after connecting to the database. It is useful when the authenticated user (specified by <code class=\"option\">-U</code>) lacks privileges needed by <span class=\"application\">pg_dumpall</span>, 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.</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.15.7\">\n<h2>Environment</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"envar\">PGHOST</code><br></span><span class=\"term\"><code class=\"envar\">PGOPTIONS</code><br></span><span class=\"term\"><code class=\"envar\">PGPORT</code><br></span><span class=\"term\"><code class=\"envar\">PGUSER</code></span></dt>\n<dd>\n<p>Default connection parameters</p>\n</dd>\n<dt><span class=\"term\"><code class=\"envar\">PG_COLOR</code></span></dt>\n<dd>\n<p>Specifies whether to use color in diagnostic messages. Possible values are <code class=\"literal\">always</code>, <code class=\"literal\">auto</code> and <code class=\"literal\">never</code>.</p>\n</dd>\n</dl>\n</div>\n<p>This utility, like most other <span class=\"productname\">PostgreSQL</span> utilities, also uses the environment variables supported by <span class=\"application\">libpq</span> (see <a class=\"xref\" href=\"/docs/18/libpq-envars.html\" title=\"32.15.\u00a0Environment Variables\">Section\u00a032.15</a>).</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.15.8\">\n<h2>Notes</h2>\n<p>Since <span class=\"application\">pg_dumpall</span> calls <span class=\"application\">pg_dump</span> internally, some diagnostic messages will refer to <span class=\"application\">pg_dump</span>.</p>\n<p>The <code class=\"option\">--clean</code> option can be useful even when your intention is to restore the dump script into a fresh cluster. Use of <code class=\"option\">--clean</code> authorizes the script to drop and re-create the built-in <code class=\"literal\">postgres</code> and <code class=\"literal\">template1</code> 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.</p>\n<p>When <code class=\"option\">--statistics</code> is specified, <code class=\"command\">pg_dumpall</code> will include most optimizer statistics in the resulting dump file. This does not include all statistics, such as those created explicitly with <a class=\"xref\" href=\"/docs/18/sql-createstatistics.html\" title=\"CREATE STATISTICS\"><span class=\"refentrytitle\">CREATE STATISTICS</span></a>, custom statistics added by an extension, or statistics collected by the cumulative statistics system. Therefore, it may still be useful to run <code class=\"command\">ANALYZE</code> on each database after restoring from a dump file to ensure optimal performance. You can also run <code class=\"command\">vacuumdb -a -z</code> to analyze all databases.</p>\n<p>The dump script should not be expected to run completely without errors. In particular, because the script will issue <code class=\"command\">CREATE ROLE</code> for every role existing in the source cluster, it is certain to get a <span class=\"quote\">\u201c<span class=\"quote\">role already exists</span>\u201d</span> 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 <code class=\"option\">--clean</code> option is likely to produce additional harmless error messages about non-existent objects, although you can minimize those by adding <code class=\"option\">--if-exists</code>.</p>\n<p><span class=\"application\">pg_dumpall</span> requires all needed tablespace directories to exist before the restore; otherwise, database creation will fail for databases in non-default locations.</p>\n<p>It is generally recommended to use the <code class=\"option\">-X</code> (<code class=\"option\">--no-psqlrc</code>) option when restoring a database from a <span class=\"application\">pg_dumpall</span> script to ensure a clean restore process and prevent potential conflicts with non-default <span class=\"application\">psql</span> configurations. Additionally, because the <span class=\"application\">pg_dumpall</span> script may include <span class=\"application\">psql</span> meta-commands, it may be incompatible with clients other than <span class=\"application\">psql</span>.</p>\n</div>\n<div class=\"refsect1\" id=\"APP-PG-DUMPALL-EX\">\n<h2>Examples</h2>\n<p>To dump all databases:</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>pg_dumpall &gt; db.out</code></strong>\n</pre>\n<p>To restore database(s) from this file, you can use:</p>\n<pre class=\"screen\"><code class=\"prompt\">$</code> <strong class=\"userinput\"><code>psql -X -f db.out -d postgres</code></strong>\n</pre>\n<p>It is not important which database you connect to here since the script file created by <span class=\"application\">pg_dumpall</span> will contain the appropriate commands to create and connect to the saved databases. An exception is that if you specified <code class=\"option\">--clean</code>, you must connect to the <code class=\"literal\">postgres</code> database initially; the script will attempt to drop other databases immediately, and that will fail for the database you are connected to.</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.15.10\">\n<h2>See Also</h2>\n<p>Check <a class=\"xref\" href=\"/docs/18/app-pgdump.html\" title=\"pg_dump\"><span class=\"refentrytitle\"><span class=\"application\">pg_dump</span></span></a> for details on possible error conditions.</p>\n</div>\n</div></div>", "manual_path": "app-pg-dumpall.html", "comparison_data": {"options": [{"names": ["-a", "--data-only"], "signature": "-a --data-only", "description": "Dump only the data, not the schema (data definitions) or statistics."}, {"names": ["-c", "--clean"], "signature": "-c --clean", "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": ["-E encoding", "--encoding= encoding"], "signature": "-E encoding --encoding= encoding", "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": ["-f filename", "--file= filename"], "signature": "-f filename --file= filename", "description": "Send output to the specified file. If this is omitted, the standard output is used."}, {"names": ["-g", "--globals-only"], "signature": "-g --globals-only", "description": "Dump only global objects (roles and tablespaces), no databases."}, {"names": ["-O", "--no-owner"], "signature": "-O --no-owner", "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": ["-r", "--roles-only"], "signature": "-r --roles-only", "description": "Dump only roles, no databases or tablespaces."}, {"names": ["-s", "--schema-only"], "signature": "-s --schema-only", "description": "Dump only the object definitions (schema), not data."}, {"names": ["-S username", "--superuser= username"], "signature": "-S username --superuser= username", "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": ["-t", "--tablespaces-only"], "signature": "-t --tablespaces-only", "description": "Dump only tablespaces, no databases or roles."}, {"names": ["-v", "--verbose"], "signature": "-v --verbose", "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", "--version"], "signature": "-V --version", "description": "Print the pg_dumpall version and exit."}, {"names": ["-x", "--no-privileges", "--no-acl"], "signature": "-x --no-privileges --no-acl", "description": "Prevent dumping of access privileges (grant/revoke commands)."}, {"names": ["--binary-upgrade"], "signature": "--binary-upgrade", "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": ["--column-inserts", "--attribute-inserts"], "signature": "--column-inserts --attribute-inserts", "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": ["--disable-dollar-quoting"], "signature": "--disable-dollar-quoting", "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-triggers"], "signature": "--disable-triggers", "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": ["--exclude-database= pattern"], "signature": "--exclude-database= pattern", "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": ["--extra-float-digits= ndigits"], "signature": "--extra-float-digits= ndigits", "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": ["--filter= filename"], "signature": "--filter= filename", "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": ["--if-exists"], "signature": "--if-exists", "description": "Use DROP ... IF EXISTS commands to drop objects in --clean mode. This suppresses \u201c does not exist \u201d errors that might otherwise be reported. This option is not valid unless --clean is also specified."}, {"names": ["--inserts"], "signature": "--inserts", "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": ["--load-via-partition-root"], "signature": "--load-via-partition-root", "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": ["--lock-wait-timeout= timeout"], "signature": "--lock-wait-timeout= timeout", "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": ["--no-comments"], "signature": "--no-comments", "description": "Do not dump COMMENT commands."}, {"names": ["--no-data"], "signature": "--no-data", "description": "Do not dump data."}, {"names": ["--no-policies"], "signature": "--no-policies", "description": "Do not dump row security policies."}, {"names": ["--no-publications"], "signature": "--no-publications", "description": "Do not dump publications."}, {"names": ["--no-role-passwords"], "signature": "--no-role-passwords", "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-schema"], "signature": "--no-schema", "description": "Do not dump schema (data definitions)."}, {"names": ["--no-security-labels"], "signature": "--no-security-labels", "description": "Do not dump security labels."}, {"names": ["--no-statistics"], "signature": "--no-statistics", "description": "Do not dump statistics. This is the default."}, {"names": ["--no-subscriptions"], "signature": "--no-subscriptions", "description": "Do not dump subscriptions."}, {"names": ["--no-sync"], "signature": "--no-sync", "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-table-access-method"], "signature": "--no-table-access-method", "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-tablespaces"], "signature": "--no-tablespaces", "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-toast-compression"], "signature": "--no-toast-compression", "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-unlogged-table-data"], "signature": "--no-unlogged-table-data", "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": ["--on-conflict-do-nothing"], "signature": "--on-conflict-do-nothing", "description": "Add ON CONFLICT DO NOTHING to INSERT commands. This option is not valid unless --inserts or --column-inserts is also specified."}, {"names": ["--quote-all-identifiers"], "signature": "--quote-all-identifiers", "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": ["--restrict-key= restrict_key"], "signature": "--restrict-key= restrict_key", "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": ["--rows-per-insert= nrows"], "signature": "--rows-per-insert= nrows", "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": ["--statistics"], "signature": "--statistics", "description": "Dump optimizer statistics."}, {"names": ["--statistics-only"], "signature": "--statistics-only", "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": ["--sequence-data"], "signature": "--sequence-data", "description": "Include sequence data in the dump. This is the default behavior except when --no-data , --schema-only , or --statistics-only is specified."}, {"names": ["--use-set-session-authorization"], "signature": "--use-set-session-authorization", "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": ["-?", "--help"], "signature": "-? --help", "description": "Show help about pg_dumpall command line arguments, and exit."}, {"names": ["-d connstr", "--dbname= connstr"], "signature": "-d connstr --dbname= connstr", "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": ["-h host", "--host= host"], "signature": "-h host --host= host", "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": ["-l dbname", "--database= dbname"], "signature": "-l dbname --database= dbname", "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": ["-p port", "--port= port"], "signature": "-p port --port= port", "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": ["-U username", "--username= username"], "signature": "-U username --username= username", "description": "User name to connect as."}, {"names": ["-w", "--no-password"], "signature": "-w --no-password", "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", "--password"], "signature": "-W --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": ["--role= rolename"], "signature": "--role= rolename", "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."}], "synopsis": ["pg_dumpall [ connection-option ...] [ option ...]"], "environment": [{"name": "PGHOST PGOPTIONS PGPORT PGUSER", "description": "Default connection parameters"}, {"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}]}, "comparison_hash": "dd0edf9a9ef6de0e86b97b0a2b08127ecf99f382528014ef50f210767b2d4f6c"}, "comparison": {"left": "12", "right": "13", "status": "changed", "diff": "--- PostgreSQL 12\n+++ PostgreSQL 13\n@@ -145,6 +145,13 @@\n       \"signature\": \"--disable-triggers\"\n     },\n     {\n+      \"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 below), 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.\",\n+      \"names\": [\n+        \"--exclude-database= pattern\"\n+      ],\n+      \"signature\": \"--exclude-database= pattern\"\n+    },\n+    {\n       \"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.\",\n       \"names\": [\n         \"--extra-float-digits= ndigits\"\n@@ -152,13 +159,6 @@\n       \"signature\": \"--extra-float-digits= ndigits\"\n     },\n     {\n-      \"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.\",\n-      \"names\": [\n-        \"--exclude-database= pattern\"\n-      ],\n-      \"signature\": \"--exclude-database= pattern\"\n-    },\n-    {\n       \"description\": \"Use DROP ... IF EXISTS commands to drop objects in --clean mode. This suppresses \u201c does not exist \u201d errors that might otherwise be reported. This option is not valid unless --clean is also specified.\",\n       \"names\": [\n         \"--if-exists\"\n@@ -255,6 +255,13 @@\n         \"--quote-all-identifiers\"\n       ],\n       \"signature\": \"--quote-all-identifiers\"\n+    },\n+    {\n+      \"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.\",\n+      \"names\": [\n+        \"--restrict-key= restrict_key\"\n+      ],\n+      \"signature\": \"--restrict-key= restrict_key\"\n     },\n     {\n       \"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.\","}}