'ERROR: SET TRANSACTION ISOLATION LEVEL must not be called in a subtransaction in YugabyteDB

[Question posted by a user on YugabyteDB Community Slack]

I am facing the following issue when I try to dump a database in YugabyteDB 2.13.0.1:

[yuga@yugadb-tserver1 ~]$ ./yugabyte-2.13.0.1/postgres/bin/ysql_dump -d ehrbase > ./backups/ehrbase_100.sql
ysql_dump: [archiver (db)] query failed: ERROR:  SET TRANSACTION ISOLATION LEVEL must not be called in a subtransaction
ysql_dump: [archiver (db)] query was: SET TRANSACTION ISOLATION LEVEL SERIALIZABLE, READ ONLY, DEFERRABLE


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source