From 28d732ea9ec7e2712818fe807bb998058beca532 Mon Sep 17 00:00:00 2001 From: Robins Tharakan Date: Thu, 3 Mar 2022 10:21:49 +0000 Subject: [PATCH] This patch allows non-superusers to successfully run the server_options regression test. The server_options test uses pg_user_mapping catalog that is only available to Postgres superusers. Thus means non-superusers fail this regression test by design. Since most of that data is already available in pg_user_mappings view, using that instead additionally allows non-superusers to pass the test. --- expected/server_options.out | 4 ++-- sql/server_options.sql | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/expected/server_options.out b/expected/server_options.out index 204570d..69d16a4 100644 --- a/expected/server_options.out +++ b/expected/server_options.out @@ -19,9 +19,9 @@ DECLARE sopts TEXT; uopts TEXT; BEGIN - SELECT e.fdwname, srvname, array_to_string(s.srvoptions, ','), array_to_string(u.umoptions, ',') + SELECT e.fdwname, s.srvname, array_to_string(s.srvoptions, ','), array_to_string(u.umoptions, ',') INTO ext, srv, sopts, uopts - FROM pg_foreign_data_wrapper e LEFT JOIN pg_foreign_server s ON e.oid = s.srvfdw LEFT JOIN pg_user_mapping u ON s.oid = u.umserver + FROM pg_foreign_data_wrapper e LEFT JOIN pg_foreign_server s ON e.oid = s.srvfdw LEFT JOIN pg_user_mappings u ON s.oid = u.srvid WHERE e.fdwname = 'mysql_fdw' ORDER BY 1, 2, 3, 4; diff --git a/sql/server_options.sql b/sql/server_options.sql index fe34989..d64dbd1 100644 --- a/sql/server_options.sql +++ b/sql/server_options.sql @@ -22,9 +22,9 @@ DECLARE sopts TEXT; uopts TEXT; BEGIN - SELECT e.fdwname, srvname, array_to_string(s.srvoptions, ','), array_to_string(u.umoptions, ',') + SELECT e.fdwname, s.srvname, array_to_string(s.srvoptions, ','), array_to_string(u.umoptions, ',') INTO ext, srv, sopts, uopts - FROM pg_foreign_data_wrapper e LEFT JOIN pg_foreign_server s ON e.oid = s.srvfdw LEFT JOIN pg_user_mapping u ON s.oid = u.umserver + FROM pg_foreign_data_wrapper e LEFT JOIN pg_foreign_server s ON e.oid = s.srvfdw LEFT JOIN pg_user_mappings u ON s.oid = u.srvid WHERE e.fdwname = 'mysql_fdw' ORDER BY 1, 2, 3, 4;