The pg_dumpall: error: query failed: ERROR: permission denied for table pg_authid
error typically occurs when you do not have the necessary privileges to access the pg_authid
table, which stores information about database user roles and their authentication.
The doadmin
user lacks permission to access the pg_authid
table; however, it does have access to all other necessary system tables and information required for the dump.
To fix this issue, include the --no-role-passwords
flag in the pg_dumpall
command. For example:
pg_dumpall -h <your_host> -U <your_username> -p 25060 -Fc <your_database> --no-role-passwords > <path/to/your_dump_file.pgsql>
Specifying the --no-role-passwords
flag excludes role passwords from the dump. This allows the process to proceed without pg_authid
table permission errors and without comprising the security of role passwords.
To learn about the pg_dumpall
command flags, see our guide on exporting a PostgreSQL database.