mirror of
https://github.com/postgres/postgres.git
synced 2025-07-28 23:42:10 +03:00
Let installcheck-world pass against a server requiring a password.
Give passwords to each user created in support of an ECPG connection test case. Use SET SESSION AUTHORIZATION, not a fresh connection, to reduce privileges during a dblink test case. To test against such a server, both the "make installcheck-world" environment and the postmaster environment must provide the default user's password; $PGPASSFILE is the principal way to do so. (The postmaster environment needs it for dblink and postgres_fdw tests.)
This commit is contained in:
@ -782,18 +782,17 @@ SELECT dblink_disconnect('dtest1');
|
||||
(1 row)
|
||||
|
||||
-- test foreign data wrapper functionality
|
||||
CREATE USER dblink_regression_test;
|
||||
CREATE ROLE dblink_regression_test;
|
||||
CREATE SERVER fdtest FOREIGN DATA WRAPPER dblink_fdw
|
||||
OPTIONS (dbname 'contrib_regression');
|
||||
CREATE USER MAPPING FOR public SERVER fdtest
|
||||
OPTIONS (server 'localhost'); -- fail, can't specify server here
|
||||
ERROR: invalid option "server"
|
||||
HINT: Valid options in this context are: user, password
|
||||
CREATE USER MAPPING FOR public SERVER fdtest;
|
||||
CREATE USER MAPPING FOR public SERVER fdtest OPTIONS (user :'USER');
|
||||
GRANT USAGE ON FOREIGN SERVER fdtest TO dblink_regression_test;
|
||||
GRANT EXECUTE ON FUNCTION dblink_connect_u(text, text) TO dblink_regression_test;
|
||||
\set ORIGINAL_USER :USER
|
||||
\c - dblink_regression_test
|
||||
SET SESSION AUTHORIZATION dblink_regression_test;
|
||||
-- should fail
|
||||
SELECT dblink_connect('myconn', 'fdtest');
|
||||
ERROR: password is required
|
||||
@ -821,7 +820,7 @@ SELECT * FROM dblink('myconn','SELECT * FROM foo') AS t(a int, b text, c text[])
|
||||
10 | k | {a10,b10,c10}
|
||||
(11 rows)
|
||||
|
||||
\c - :ORIGINAL_USER
|
||||
\c - -
|
||||
REVOKE USAGE ON FOREIGN SERVER fdtest FROM dblink_regression_test;
|
||||
REVOKE EXECUTE ON FUNCTION dblink_connect_u(text, text) FROM dblink_regression_test;
|
||||
DROP USER dblink_regression_test;
|
||||
|
Reference in New Issue
Block a user