Skip to content

2.25.1.0-b338

@OlegLoginov OlegLoginov tagged this 12 Feb 12:30
Summary:
In the dump from the `ysql_dumpall` tool for any Role we have the block like:
```
\set role_exists false
\if :ignore_existing_roles
    SELECT EXISTS(SELECT 1 FROM pg_roles WHERE rolname = 'postgres') AS role_exists \gset
\endif
\if :role_exists
    \echo 'Role postgres already exists.'
\else
    CREATE ROLE postgres;
\endif

ALTER ROLE postgres WITH SUPERUSER INHERIT CREATEROLE CREATEDB LOGIN REPLICATION BYPASSRLS;
```
If the Role exists, the `CREATE ROLE` statement must be skipped.
But `ALTER ROLE` is called anyway.

The fix moves `ALTER ROLE` after `CREATE ROLE` - to call them only together.

Note: The diff also prohibits usage of the flags `--binary-upgrade` and `--include-yb-metadata`  together.
Reason: dump for PG binary upgrade & dump for YB usual backup - are different and should not be requested
at the same time.

Test Plan:
./yb_build.sh --java-test  org.yb.pgsql.TestYsqlDump#ysqlDumpAllWithYbMetadata
./yb_build.sh --java-test  org.yb.pgsql.TestYsqlDump#ysqlDumpAllWithoutYbMetadata

Reviewers: mihnea, sanketh, hsunder

Reviewed By: hsunder

Subscribers: smishra, yql

Differential Revision: https://phorge.dev.yugabyte.com/D41416
Assets 2
Loading