diff options
author | Tom Lane | 2016-07-17 22:42:31 +0000 |
---|---|---|
committer | Tom Lane | 2016-07-17 22:42:43 +0000 |
commit | 18555b1323bd225c7882e80723c52f25ce60afed (patch) | |
tree | 6913712a47c4bd2de14b86b2366c6eb728a109c0 /contrib/dblink/sql | |
parent | 7482fc4600ee97f8b2570e87b8c216a83b918065 (diff) |
Establish conventions about global object names used in regression tests.
To ensure that "make installcheck" can be used safely against an existing
installation, we need to be careful about what global object names
(database, role, and tablespace names) we use; otherwise we might
accidentally clobber important objects. There's been a weak consensus that
test databases should have names including "regression", and that test role
names should start with "regress_", but we didn't have any particular rule
about tablespace names; and neither of the other rules was followed with
any consistency either.
This commit moves us a long way towards having a hard-and-fast rule that
regression test databases must have names including "regression", and that
test role and tablespace names must start with "regress_". It's not
completely there because I did not touch some test cases in rolenames.sql
that test creation of special role names like "session_user". That will
require some rethinking of exactly what we want to test, whereas the intent
of this patch is just to hit all the cases in which the needed renamings
are cosmetic.
There is no enforcement mechanism in this patch either, but if we don't
add one we can expect that the tests will soon be violating the convention
again. Again, that's not such a cosmetic change and it will require
discussion. (But I did use a quick-hack enforcement patch to find these
cases.)
Discussion: <16638.1468620817@sss.pgh.pa.us>
Diffstat (limited to 'contrib/dblink/sql')
-rw-r--r-- | contrib/dblink/sql/dblink.sql | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/contrib/dblink/sql/dblink.sql b/contrib/dblink/sql/dblink.sql index 0ebfbd2b913..681cf6a6e87 100644 --- a/contrib/dblink/sql/dblink.sql +++ b/contrib/dblink/sql/dblink.sql @@ -394,7 +394,7 @@ SELECT dblink_error_message('dtest1'); SELECT dblink_disconnect('dtest1'); -- test foreign data wrapper functionality -CREATE ROLE dblink_regression_test; +CREATE ROLE regress_dblink_user; DO $d$ BEGIN EXECUTE $$CREATE SERVER fdtest FOREIGN DATA WRAPPER dblink_fdw @@ -408,10 +408,10 @@ CREATE USER MAPPING FOR public SERVER fdtest OPTIONS (server 'localhost'); -- fail, can't specify server here 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; +GRANT USAGE ON FOREIGN SERVER fdtest TO regress_dblink_user; +GRANT EXECUTE ON FUNCTION dblink_connect_u(text, text) TO regress_dblink_user; -SET SESSION AUTHORIZATION dblink_regression_test; +SET SESSION AUTHORIZATION regress_dblink_user; -- should fail SELECT dblink_connect('myconn', 'fdtest'); -- should succeed @@ -419,9 +419,9 @@ SELECT dblink_connect_u('myconn', 'fdtest'); SELECT * FROM dblink('myconn','SELECT * FROM foo') AS t(a int, b text, c text[]); \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; +REVOKE USAGE ON FOREIGN SERVER fdtest FROM regress_dblink_user; +REVOKE EXECUTE ON FUNCTION dblink_connect_u(text, text) FROM regress_dblink_user; +DROP USER regress_dblink_user; DROP USER MAPPING FOR public SERVER fdtest; DROP SERVER fdtest; |