From d2ad900bc56283a05a6565c11cf6c8050017dcd5 Mon Sep 17 00:00:00 2001 From: Akshay Joshi Date: Wed, 2 Nov 2022 17:55:06 +0530 Subject: [PATCH] Fixed Role dependency test case for PG 15. --- .../python_test_utils/test_utils.py | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/web/regression/python_test_utils/test_utils.py b/web/regression/python_test_utils/test_utils.py index c89070017..b5a46579e 100644 --- a/web/regression/python_test_utils/test_utils.py +++ b/web/regression/python_test_utils/test_utils.py @@ -161,6 +161,26 @@ def create_database(server, db_name, encoding=None): if oid: db_id = oid[0] connection.close() + + # In PostgreSQL 15 the default public schema that every database has + # will have a different set of permissions. In fact, before PostgreSQL + # 15, every user could manipulate the public schema of a database he is + # not owner. Since the upcoming new version, only the database owner + # will be granted full access to the public schema, while other users + # will need to get an explicit GRANT + connection = get_db_connection( + db_name, + server['username'], + server['db_password'], + server['host'], + server['port'], + server['sslmode'] + ) + pg_cursor = connection.cursor() + pg_cursor.execute('''GRANT ALL ON SCHEMA public TO PUBLIC''') + connection.commit() + connection.close() + return db_id except Exception: traceback.print_exc(file=sys.stderr)