mirror of
https://github.com/postgres/postgres.git
synced 2026-02-13 15:53:13 -05:00
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>
115 lines
3 KiB
SQL
115 lines
3 KiB
SQL
--
|
|
-- regproc
|
|
--
|
|
|
|
/* If objects exist, return oids */
|
|
|
|
CREATE ROLE regress_regrole_test;
|
|
|
|
-- without schemaname
|
|
|
|
SELECT regoper('||/');
|
|
SELECT regoperator('+(int4,int4)');
|
|
SELECT regproc('now');
|
|
SELECT regprocedure('abs(numeric)');
|
|
SELECT regclass('pg_class');
|
|
SELECT regtype('int4');
|
|
|
|
SELECT to_regoper('||/');
|
|
SELECT to_regoperator('+(int4,int4)');
|
|
SELECT to_regproc('now');
|
|
SELECT to_regprocedure('abs(numeric)');
|
|
SELECT to_regclass('pg_class');
|
|
SELECT to_regtype('int4');
|
|
|
|
-- with schemaname
|
|
|
|
SELECT regoper('pg_catalog.||/');
|
|
SELECT regoperator('pg_catalog.+(int4,int4)');
|
|
SELECT regproc('pg_catalog.now');
|
|
SELECT regprocedure('pg_catalog.abs(numeric)');
|
|
SELECT regclass('pg_catalog.pg_class');
|
|
SELECT regtype('pg_catalog.int4');
|
|
|
|
SELECT to_regoper('pg_catalog.||/');
|
|
SELECT to_regproc('pg_catalog.now');
|
|
SELECT to_regprocedure('pg_catalog.abs(numeric)');
|
|
SELECT to_regclass('pg_catalog.pg_class');
|
|
SELECT to_regtype('pg_catalog.int4');
|
|
|
|
-- schemaname not applicable
|
|
|
|
SELECT regrole('regress_regrole_test');
|
|
SELECT regrole('"regress_regrole_test"');
|
|
SELECT regnamespace('pg_catalog');
|
|
SELECT regnamespace('"pg_catalog"');
|
|
|
|
SELECT to_regrole('regress_regrole_test');
|
|
SELECT to_regrole('"regress_regrole_test"');
|
|
SELECT to_regnamespace('pg_catalog');
|
|
SELECT to_regnamespace('"pg_catalog"');
|
|
|
|
/* If objects don't exist, raise errors. */
|
|
|
|
DROP ROLE regress_regrole_test;
|
|
|
|
-- without schemaname
|
|
|
|
SELECT regoper('||//');
|
|
SELECT regoperator('++(int4,int4)');
|
|
SELECT regproc('know');
|
|
SELECT regprocedure('absinthe(numeric)');
|
|
SELECT regclass('pg_classes');
|
|
SELECT regtype('int3');
|
|
|
|
-- with schemaname
|
|
|
|
SELECT regoper('ng_catalog.||/');
|
|
SELECT regoperator('ng_catalog.+(int4,int4)');
|
|
SELECT regproc('ng_catalog.now');
|
|
SELECT regprocedure('ng_catalog.abs(numeric)');
|
|
SELECT regclass('ng_catalog.pg_class');
|
|
SELECT regtype('ng_catalog.int4');
|
|
|
|
-- schemaname not applicable
|
|
|
|
SELECT regrole('regress_regrole_test');
|
|
SELECT regrole('"regress_regrole_test"');
|
|
SELECT regrole('Nonexistent');
|
|
SELECT regrole('"Nonexistent"');
|
|
SELECT regrole('foo.bar');
|
|
SELECT regnamespace('Nonexistent');
|
|
SELECT regnamespace('"Nonexistent"');
|
|
SELECT regnamespace('foo.bar');
|
|
|
|
/* If objects don't exist, return NULL with no error. */
|
|
|
|
-- without schemaname
|
|
|
|
SELECT to_regoper('||//');
|
|
SELECT to_regoperator('++(int4,int4)');
|
|
SELECT to_regproc('know');
|
|
SELECT to_regprocedure('absinthe(numeric)');
|
|
SELECT to_regclass('pg_classes');
|
|
SELECT to_regtype('int3');
|
|
|
|
-- with schemaname
|
|
|
|
SELECT to_regoper('ng_catalog.||/');
|
|
SELECT to_regoperator('ng_catalog.+(int4,int4)');
|
|
SELECT to_regproc('ng_catalog.now');
|
|
SELECT to_regprocedure('ng_catalog.abs(numeric)');
|
|
SELECT to_regclass('ng_catalog.pg_class');
|
|
SELECT to_regtype('ng_catalog.int4');
|
|
|
|
-- schemaname not applicable
|
|
|
|
SELECT to_regrole('regress_regrole_test');
|
|
SELECT to_regrole('"regress_regrole_test"');
|
|
SELECT to_regrole('foo.bar');
|
|
SELECT to_regrole('Nonexistent');
|
|
SELECT to_regrole('"Nonexistent"');
|
|
SELECT to_regrole('foo.bar');
|
|
SELECT to_regnamespace('Nonexistent');
|
|
SELECT to_regnamespace('"Nonexistent"');
|
|
SELECT to_regnamespace('foo.bar');
|