mirror of
https://github.com/postgres/postgres.git
synced 2025-07-27 12:41:57 +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:
@ -359,25 +359,24 @@ SELECT dblink_error_message('dtest1');
|
||||
SELECT dblink_disconnect('dtest1');
|
||||
|
||||
-- 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
|
||||
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');
|
||||
-- should succeed
|
||||
SELECT dblink_connect_u('myconn', 'fdtest');
|
||||
SELECT * FROM dblink('myconn','SELECT * FROM foo') AS t(a int, b text, c text[]);
|
||||
|
||||
\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