-- access rights and superuser
-- ===================================================================
-- Non-superuser cannot create a FDW without a password in the connstr
-CREATE ROLE nosuper NOSUPERUSER;
-GRANT USAGE ON FOREIGN DATA WRAPPER postgres_fdw TO nosuper;
-SET ROLE nosuper;
+CREATE ROLE regress_nosuper NOSUPERUSER;
+GRANT USAGE ON FOREIGN DATA WRAPPER postgres_fdw TO regress_nosuper;
+SET ROLE regress_nosuper;
SHOW is_superuser;
is_superuser
--------------
HINT: Target server's authentication method must be changed or password_required=false set in the user mapping attributes.
RESET ROLE;
-- But the superuser can
-ALTER USER MAPPING FOR nosuper SERVER loopback_nopw OPTIONS (ADD password_required 'false');
-SET ROLE nosuper;
+ALTER USER MAPPING FOR regress_nosuper SERVER loopback_nopw OPTIONS (ADD password_required 'false');
+SET ROLE regress_nosuper;
-- Should finally work now
SELECT * FROM ft1_nopw LIMIT 1;
c1 | c2 | c3 | c4 | c5 | c6 | c7 | c8
1111 | 2 | | | | | ft1 |
(1 row)
+-- cleanup
+DROP USER MAPPING FOR public SERVER loopback_nopw;
+DROP OWNED BY regress_nosuper;
+DROP ROLE regress_nosuper;
-- Clean-up
RESET enable_partitionwise_aggregate;
-- Two-phase transactions are not supported.
-- ===================================================================
-- Non-superuser cannot create a FDW without a password in the connstr
-CREATE ROLE nosuper NOSUPERUSER;
+CREATE ROLE regress_nosuper NOSUPERUSER;
-GRANT USAGE ON FOREIGN DATA WRAPPER postgres_fdw TO nosuper;
+GRANT USAGE ON FOREIGN DATA WRAPPER postgres_fdw TO regress_nosuper;
-SET ROLE nosuper;
+SET ROLE regress_nosuper;
SHOW is_superuser;
RESET ROLE;
-- But the superuser can
-ALTER USER MAPPING FOR nosuper SERVER loopback_nopw OPTIONS (ADD password_required 'false');
+ALTER USER MAPPING FOR regress_nosuper SERVER loopback_nopw OPTIONS (ADD password_required 'false');
-SET ROLE nosuper;
+SET ROLE regress_nosuper;
-- Should finally work now
SELECT * FROM ft1_nopw LIMIT 1;
-- mapping option, but will work because the current user is a superuser.
SELECT * FROM ft1_nopw LIMIT 1;
+-- cleanup
+DROP USER MAPPING FOR public SERVER loopback_nopw;
+DROP OWNED BY regress_nosuper;
+DROP ROLE regress_nosuper;
+
-- Clean-up
RESET enable_partitionwise_aggregate;