Commit 80217709 authored by Tom Lane's avatar Tom Lane

Further stabilize postgres_fdw test.

The queries involving ft1_nopw don't stably return the same row
anymore.  I surmise that an autovacuum hitting "S 1"."T 1"
right after the updates introduced by f61db909/5843659d freed
some space, changing where subsequent insertions get stored.
It's only by good luck that these results were stable before,
though, since a LIMIT without ORDER BY isn't well defined,
and it's not like we've ever treated that table as append-only
in this test script.

Since we only really care whether these commands succeed or not,
just replace "SELECT *" with "SELECT 1".

Report: https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=crake&dt=2021-06-23%2019%3A52%3A08
parent 9b8ed0f5
...@@ -9225,7 +9225,7 @@ CREATE FOREIGN TABLE ft1_nopw ( ...@@ -9225,7 +9225,7 @@ CREATE FOREIGN TABLE ft1_nopw (
c7 char(10) default 'ft1', c7 char(10) default 'ft1',
c8 user_enum c8 user_enum
) SERVER loopback_nopw OPTIONS (schema_name 'public', table_name 'ft1'); ) SERVER loopback_nopw OPTIONS (schema_name 'public', table_name 'ft1');
SELECT * FROM ft1_nopw LIMIT 1; SELECT 1 FROM ft1_nopw LIMIT 1;
ERROR: password is required ERROR: password is required
DETAIL: Non-superusers must provide a password in the user mapping. DETAIL: Non-superusers must provide a password in the user mapping.
-- If we add a password to the connstr it'll fail, because we don't allow passwords -- If we add a password to the connstr it'll fail, because we don't allow passwords
...@@ -9244,7 +9244,7 @@ PL/pgSQL function inline_code_block line 3 at EXECUTE ...@@ -9244,7 +9244,7 @@ PL/pgSQL function inline_code_block line 3 at EXECUTE
-- --
-- This won't work with installcheck, but neither will most of the FDW checks. -- This won't work with installcheck, but neither will most of the FDW checks.
ALTER USER MAPPING FOR CURRENT_USER SERVER loopback_nopw OPTIONS (ADD password 'dummypw'); ALTER USER MAPPING FOR CURRENT_USER SERVER loopback_nopw OPTIONS (ADD password 'dummypw');
SELECT * FROM ft1_nopw LIMIT 1; SELECT 1 FROM ft1_nopw LIMIT 1;
ERROR: password is required ERROR: password is required
DETAIL: Non-superuser cannot connect if the server does not request a password. DETAIL: Non-superuser cannot connect if the server does not request a password.
HINT: Target server's authentication method must be changed or password_required=false set in the user mapping attributes. HINT: Target server's authentication method must be changed or password_required=false set in the user mapping attributes.
...@@ -9252,7 +9252,7 @@ HINT: Target server's authentication method must be changed or password_require ...@@ -9252,7 +9252,7 @@ HINT: Target server's authentication method must be changed or password_require
ALTER USER MAPPING FOR CURRENT_USER SERVER loopback_nopw OPTIONS (ADD password_required 'false'); ALTER USER MAPPING FOR CURRENT_USER SERVER loopback_nopw OPTIONS (ADD password_required 'false');
ERROR: password_required=false is superuser-only ERROR: password_required=false is superuser-only
HINT: User mappings with the password_required option set to false may only be created or modified by the superuser HINT: User mappings with the password_required option set to false may only be created or modified by the superuser
SELECT * FROM ft1_nopw LIMIT 1; SELECT 1 FROM ft1_nopw LIMIT 1;
ERROR: password is required ERROR: password is required
DETAIL: Non-superuser cannot connect if the server does not request a password. DETAIL: Non-superuser cannot connect if the server does not request a password.
HINT: Target server's authentication method must be changed or password_required=false set in the user mapping attributes. HINT: Target server's authentication method must be changed or password_required=false set in the user mapping attributes.
...@@ -9261,10 +9261,10 @@ RESET ROLE; ...@@ -9261,10 +9261,10 @@ RESET ROLE;
ALTER USER MAPPING FOR regress_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 regress_nosuper; SET ROLE regress_nosuper;
-- Should finally work now -- Should finally work now
SELECT * FROM ft1_nopw LIMIT 1; SELECT 1 FROM ft1_nopw LIMIT 1;
c1 | c2 | c3 | c4 | c5 | c6 | c7 | c8 ?column?
------+----+----+----+----+----+------------+---- ----------
1111 | 2 | | | | | ft1 | 1
(1 row) (1 row)
-- unpriv user also cannot set sslcert / sslkey on the user mapping -- unpriv user also cannot set sslcert / sslkey on the user mapping
...@@ -9281,16 +9281,16 @@ HINT: User mappings with the sslcert or sslkey options set may only be created ...@@ -9281,16 +9281,16 @@ HINT: User mappings with the sslcert or sslkey options set may only be created
DROP USER MAPPING FOR CURRENT_USER SERVER loopback_nopw; DROP USER MAPPING FOR CURRENT_USER SERVER loopback_nopw;
-- This will fail again as it'll resolve the user mapping for public, which -- This will fail again as it'll resolve the user mapping for public, which
-- lacks password_required=false -- lacks password_required=false
SELECT * FROM ft1_nopw LIMIT 1; SELECT 1 FROM ft1_nopw LIMIT 1;
ERROR: password is required ERROR: password is required
DETAIL: Non-superusers must provide a password in the user mapping. DETAIL: Non-superusers must provide a password in the user mapping.
RESET ROLE; RESET ROLE;
-- The user mapping for public is passwordless and lacks the password_required=false -- The user mapping for public is passwordless and lacks the password_required=false
-- mapping option, but will work because the current user is a superuser. -- mapping option, but will work because the current user is a superuser.
SELECT * FROM ft1_nopw LIMIT 1; SELECT 1 FROM ft1_nopw LIMIT 1;
c1 | c2 | c3 | c4 | c5 | c6 | c7 | c8 ?column?
------+----+----+----+----+----+------------+---- ----------
1111 | 2 | | | | | ft1 | 1
(1 row) (1 row)
-- cleanup -- cleanup
......
...@@ -2746,7 +2746,7 @@ CREATE FOREIGN TABLE ft1_nopw ( ...@@ -2746,7 +2746,7 @@ CREATE FOREIGN TABLE ft1_nopw (
c8 user_enum c8 user_enum
) SERVER loopback_nopw OPTIONS (schema_name 'public', table_name 'ft1'); ) SERVER loopback_nopw OPTIONS (schema_name 'public', table_name 'ft1');
SELECT * FROM ft1_nopw LIMIT 1; SELECT 1 FROM ft1_nopw LIMIT 1;
-- If we add a password to the connstr it'll fail, because we don't allow passwords -- If we add a password to the connstr it'll fail, because we don't allow passwords
-- in connstrs only in user mappings. -- in connstrs only in user mappings.
...@@ -2764,13 +2764,13 @@ $d$; ...@@ -2764,13 +2764,13 @@ $d$;
ALTER USER MAPPING FOR CURRENT_USER SERVER loopback_nopw OPTIONS (ADD password 'dummypw'); ALTER USER MAPPING FOR CURRENT_USER SERVER loopback_nopw OPTIONS (ADD password 'dummypw');
SELECT * FROM ft1_nopw LIMIT 1; SELECT 1 FROM ft1_nopw LIMIT 1;
-- Unpriv user cannot make the mapping passwordless -- Unpriv user cannot make the mapping passwordless
ALTER USER MAPPING FOR CURRENT_USER SERVER loopback_nopw OPTIONS (ADD password_required 'false'); ALTER USER MAPPING FOR CURRENT_USER SERVER loopback_nopw OPTIONS (ADD password_required 'false');
SELECT * FROM ft1_nopw LIMIT 1; SELECT 1 FROM ft1_nopw LIMIT 1;
RESET ROLE; RESET ROLE;
...@@ -2780,7 +2780,7 @@ ALTER USER MAPPING FOR regress_nosuper SERVER loopback_nopw OPTIONS (ADD passwor ...@@ -2780,7 +2780,7 @@ ALTER USER MAPPING FOR regress_nosuper SERVER loopback_nopw OPTIONS (ADD passwor
SET ROLE regress_nosuper; SET ROLE regress_nosuper;
-- Should finally work now -- Should finally work now
SELECT * FROM ft1_nopw LIMIT 1; SELECT 1 FROM ft1_nopw LIMIT 1;
-- unpriv user also cannot set sslcert / sslkey on the user mapping -- unpriv user also cannot set sslcert / sslkey on the user mapping
-- first set password_required so we see the right error messages -- first set password_required so we see the right error messages
...@@ -2794,13 +2794,13 @@ DROP USER MAPPING FOR CURRENT_USER SERVER loopback_nopw; ...@@ -2794,13 +2794,13 @@ DROP USER MAPPING FOR CURRENT_USER SERVER loopback_nopw;
-- This will fail again as it'll resolve the user mapping for public, which -- This will fail again as it'll resolve the user mapping for public, which
-- lacks password_required=false -- lacks password_required=false
SELECT * FROM ft1_nopw LIMIT 1; SELECT 1 FROM ft1_nopw LIMIT 1;
RESET ROLE; RESET ROLE;
-- The user mapping for public is passwordless and lacks the password_required=false -- The user mapping for public is passwordless and lacks the password_required=false
-- mapping option, but will work because the current user is a superuser. -- mapping option, but will work because the current user is a superuser.
SELECT * FROM ft1_nopw LIMIT 1; SELECT 1 FROM ft1_nopw LIMIT 1;
-- cleanup -- cleanup
DROP USER MAPPING FOR public SERVER loopback_nopw; DROP USER MAPPING FOR public SERVER loopback_nopw;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment