yugabyte-db
yugabyte-db copied to clipboard
[YSQL] ysql_dump: Database user isn't backed up
Jira Link: DB-2977
Description
See the example below:
CREATE USER abcdefg;
SET SESSION AUTHORIZATION abcdefg;
// backup && restore
SET SESSION AUTHORIZATION abcdefg;
ERROR: role "abcdefg" does not exist
Currently, ysql_dumpall
has the functionality to dump global objects: database roles and tablespaces.
However, yb_backup.py
runs ysql_dump
for each database to back up its schema, and it runs ysql_dumpall
to only back up tablespaces when --use_tablespaces flag is passed.
In source code of yb_backup.py
:
self.run_ysql_dumpall(['--tablespaces-only', '--file=' + sql_tbsp_dump_path])