Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 8021770

Browse files
committed
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 f61db90/5843659d0 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
1 parent 9b8ed0f commit 8021770

File tree

2 files changed

+18
-18
lines changed

2 files changed

+18
-18
lines changed

contrib/postgres_fdw/expected/postgres_fdw.out

+12-12
Original file line numberDiff line numberDiff line change
@@ -9225,7 +9225,7 @@ CREATE FOREIGN TABLE ft1_nopw (
92259225
c7 char(10) default 'ft1',
92269226
c8 user_enum
92279227
) SERVER loopback_nopw OPTIONS (schema_name 'public', table_name 'ft1');
9228-
SELECT * FROM ft1_nopw LIMIT 1;
9228+
SELECT 1 FROM ft1_nopw LIMIT 1;
92299229
ERROR: password is required
92309230
DETAIL: Non-superusers must provide a password in the user mapping.
92319231
-- If we add a password to the connstr it'll fail, because we don't allow passwords
@@ -9244,15 +9244,15 @@ PL/pgSQL function inline_code_block line 3 at EXECUTE
92449244
--
92459245
-- This won't work with installcheck, but neither will most of the FDW checks.
92469246
ALTER USER MAPPING FOR CURRENT_USER SERVER loopback_nopw OPTIONS (ADD password 'dummypw');
9247-
SELECT * FROM ft1_nopw LIMIT 1;
9247+
SELECT 1 FROM ft1_nopw LIMIT 1;
92489248
ERROR: password is required
92499249
DETAIL: Non-superuser cannot connect if the server does not request a password.
92509250
HINT: Target server's authentication method must be changed or password_required=false set in the user mapping attributes.
92519251
-- Unpriv user cannot make the mapping passwordless
92529252
ALTER USER MAPPING FOR CURRENT_USER SERVER loopback_nopw OPTIONS (ADD password_required 'false');
92539253
ERROR: password_required=false is superuser-only
92549254
HINT: User mappings with the password_required option set to false may only be created or modified by the superuser
9255-
SELECT * FROM ft1_nopw LIMIT 1;
9255+
SELECT 1 FROM ft1_nopw LIMIT 1;
92569256
ERROR: password is required
92579257
DETAIL: Non-superuser cannot connect if the server does not request a password.
92589258
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;
92619261
ALTER USER MAPPING FOR regress_nosuper SERVER loopback_nopw OPTIONS (ADD password_required 'false');
92629262
SET ROLE regress_nosuper;
92639263
-- Should finally work now
9264-
SELECT * FROM ft1_nopw LIMIT 1;
9265-
c1 | c2 | c3 | c4 | c5 | c6 | c7 | c8
9266-
------+----+----+----+----+----+------------+----
9267-
1111 | 2 | | | | | ft1 |
9264+
SELECT 1 FROM ft1_nopw LIMIT 1;
9265+
?column?
9266+
----------
9267+
1
92689268
(1 row)
92699269

92709270
-- 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
92819281
DROP USER MAPPING FOR CURRENT_USER SERVER loopback_nopw;
92829282
-- This will fail again as it'll resolve the user mapping for public, which
92839283
-- lacks password_required=false
9284-
SELECT * FROM ft1_nopw LIMIT 1;
9284+
SELECT 1 FROM ft1_nopw LIMIT 1;
92859285
ERROR: password is required
92869286
DETAIL: Non-superusers must provide a password in the user mapping.
92879287
RESET ROLE;
92889288
-- The user mapping for public is passwordless and lacks the password_required=false
92899289
-- mapping option, but will work because the current user is a superuser.
9290-
SELECT * FROM ft1_nopw LIMIT 1;
9291-
c1 | c2 | c3 | c4 | c5 | c6 | c7 | c8
9292-
------+----+----+----+----+----+------------+----
9293-
1111 | 2 | | | | | ft1 |
9290+
SELECT 1 FROM ft1_nopw LIMIT 1;
9291+
?column?
9292+
----------
9293+
1
92949294
(1 row)
92959295

92969296
-- cleanup

contrib/postgres_fdw/sql/postgres_fdw.sql

+6-6
Original file line numberDiff line numberDiff line change
@@ -2746,7 +2746,7 @@ CREATE FOREIGN TABLE ft1_nopw (
27462746
c8 user_enum
27472747
) SERVER loopback_nopw OPTIONS (schema_name 'public', table_name 'ft1');
27482748

2749-
SELECT * FROM ft1_nopw LIMIT 1;
2749+
SELECT 1 FROM ft1_nopw LIMIT 1;
27502750

27512751
-- If we add a password to the connstr it'll fail, because we don't allow passwords
27522752
-- in connstrs only in user mappings.
@@ -2764,13 +2764,13 @@ $d$;
27642764

27652765
ALTER USER MAPPING FOR CURRENT_USER SERVER loopback_nopw OPTIONS (ADD password 'dummypw');
27662766

2767-
SELECT * FROM ft1_nopw LIMIT 1;
2767+
SELECT 1 FROM ft1_nopw LIMIT 1;
27682768

27692769
-- Unpriv user cannot make the mapping passwordless
27702770
ALTER USER MAPPING FOR CURRENT_USER SERVER loopback_nopw OPTIONS (ADD password_required 'false');
27712771

27722772

2773-
SELECT * FROM ft1_nopw LIMIT 1;
2773+
SELECT 1 FROM ft1_nopw LIMIT 1;
27742774

27752775
RESET ROLE;
27762776

@@ -2780,7 +2780,7 @@ ALTER USER MAPPING FOR regress_nosuper SERVER loopback_nopw OPTIONS (ADD passwor
27802780
SET ROLE regress_nosuper;
27812781

27822782
-- Should finally work now
2783-
SELECT * FROM ft1_nopw LIMIT 1;
2783+
SELECT 1 FROM ft1_nopw LIMIT 1;
27842784

27852785
-- unpriv user also cannot set sslcert / sslkey on the user mapping
27862786
-- first set password_required so we see the right error messages
@@ -2794,13 +2794,13 @@ DROP USER MAPPING FOR CURRENT_USER SERVER loopback_nopw;
27942794

27952795
-- This will fail again as it'll resolve the user mapping for public, which
27962796
-- lacks password_required=false
2797-
SELECT * FROM ft1_nopw LIMIT 1;
2797+
SELECT 1 FROM ft1_nopw LIMIT 1;
27982798

27992799
RESET ROLE;
28002800

28012801
-- The user mapping for public is passwordless and lacks the password_required=false
28022802
-- mapping option, but will work because the current user is a superuser.
2803-
SELECT * FROM ft1_nopw LIMIT 1;
2803+
SELECT 1 FROM ft1_nopw LIMIT 1;
28042804

28052805
-- cleanup
28062806
DROP USER MAPPING FOR public SERVER loopback_nopw;

0 commit comments

Comments
 (0)