mirror of
https://github.com/postgres/postgres.git
synced 2025-06-11 20:28:21 +03:00
Fix regression tests to use only global names beginning with "regress_".
In commit 18555b132
we tentatively established a rule that regression
tests should use names containing "regression" for databases, and names
starting with "regress_" for all other globally-visible object names, so
as to circumscribe the side-effects that "make installcheck" could have on
an existing installation. However, no enforcement mechanism was created,
so it's unsurprising that some new violations have crept in since then.
In fact, a whole new *category* of violations has crept in, to wit we now
also have globally-visible subscription and replication origin names, and
"make installcheck" could very easily clobber user-created objects of
those types. So it's past time to do something about this.
This commit sanitizes the tests enough that they will pass (i.e. not
generate any visible warnings) with the enforcement mechanism I'll add
in the next commit. There are some TAP tests that still trigger the
warnings, but the warnings do not cause test failure. Since these tests
do not actually run against a pre-existing installation, there's no need
to worry whether they could conflict with user-created objects.
The problem with rolenames.sql testing special role names like "user"
is still there, and is dealt with only very cosmetically in this patch
(by hiding the warnings :-(). What we actually need to do to be safe is
to take that test script out of "make installcheck" altogether, but that
seems like material for a separate patch.
Discussion: https://postgr.es/m/16638.1468620817@sss.pgh.pa.us
This commit is contained in:
@ -13,7 +13,7 @@ CREATE FUNCTION exec(text) returns void language plpgsql volatile
|
||||
EXECUTE $1;
|
||||
END;
|
||||
$f$;
|
||||
CREATE ROLE justforcomments NOLOGIN;
|
||||
CREATE ROLE regress_justforcomments NOLOGIN;
|
||||
|
||||
SELECT exec(
|
||||
format($outer$CREATE FUNCTION iamalongfunction() RETURNS TEXT IMMUTABLE LANGUAGE SQL AS $f$SELECT text %L$f$$outer$,
|
||||
@ -22,7 +22,7 @@ SELECT exec(
|
||||
format($outer$COMMENT ON FUNCTION iamalongfunction() IS %L$outer$,
|
||||
iamalongfunction()));
|
||||
SELECT exec(
|
||||
format($outer$COMMENT ON ROLE JUSTFORCOMMENTS IS %L$outer$,
|
||||
format($outer$COMMENT ON ROLE REGRESS_JUSTFORCOMMENTS IS %L$outer$,
|
||||
iamalongfunction()));
|
||||
CREATE TABLE iamalargetable AS SELECT iamalongfunction() longfunctionoutput;
|
||||
|
||||
@ -104,4 +104,4 @@ SELECT pg_drop_replication_slot('regression_slot');
|
||||
DROP TABLE IF EXISTS replication_example;
|
||||
DROP FUNCTION iamalongfunction();
|
||||
DROP FUNCTION exec(text);
|
||||
DROP ROLE justforcomments;
|
||||
DROP ROLE regress_justforcomments;
|
||||
|
Reference in New Issue
Block a user