In the wake of commit
b073c3ccd, it's necessary to grant create
permissions on the public schema to PUBLIC to get many of the
core regression test scripts to pass. That commit did so via the
quick-n-dirty expedient of adding the GRANT to the tablespace test,
which runs first. This is problematic for single-machine
replication testing, though. The least painful way to run the
regression tests on such a setup is to skip the tablespace test,
and that no longer works.
To fix, let's invent a separate "test_setup" script to run first,
and put the GRANT there. Revert
b073c3ccd's changes to
the tablespace.source files.
In the future it might be good to try to reduce coupling between
the various test scripts by having test_setup create widely-used
objects, with the goal that most of the scripts could run after
having run only test_setup. That's going to take some effort,
so this commit just addresses my immediate pain point.
Discussion: https://postgr.es/m/
1363170.
1639763559@sss.pgh.pa.us
--- /dev/null
+-- Postgres formerly made the public schema read/write by default,
+-- and most of the core regression tests still expect that.
+GRANT ALL ON SCHEMA public TO public;
ALTER TABLE testschema.tablespace_acl OWNER TO regress_tablespace_user2;
SET SESSION ROLE regress_tablespace_user2;
-CREATE TEMP TABLE tablespace_table (i int) TABLESPACE regress_tblspace; -- fail
+CREATE TABLE tablespace_table (i int) TABLESPACE regress_tblspace; -- fail
ALTER TABLE testschema.tablespace_acl ALTER c TYPE bigint;
REINDEX (TABLESPACE regress_tblspace) TABLE tablespace_table; -- fail
REINDEX (TABLESPACE regress_tblspace, CONCURRENTLY) TABLE tablespace_table; -- fail
DROP ROLE regress_tablespace_user1;
DROP ROLE regress_tablespace_user2;
-
--- Rest of this suite can use the public schema freely.
-GRANT ALL ON SCHEMA public TO public;
CREATE INDEX k ON testschema.tablespace_acl (c) TABLESPACE regress_tblspace;
ALTER TABLE testschema.tablespace_acl OWNER TO regress_tablespace_user2;
SET SESSION ROLE regress_tablespace_user2;
-CREATE TEMP TABLE tablespace_table (i int) TABLESPACE regress_tblspace; -- fail
+CREATE TABLE tablespace_table (i int) TABLESPACE regress_tblspace; -- fail
ERROR: permission denied for tablespace regress_tblspace
ALTER TABLE testschema.tablespace_acl ALTER c TYPE bigint;
REINDEX (TABLESPACE regress_tblspace) TABLE tablespace_table; -- fail
drop cascades to table testschema.tablespace_acl
DROP ROLE regress_tablespace_user1;
DROP ROLE regress_tablespace_user2;
--- Rest of this suite can use the public schema freely.
-GRANT ALL ON SCHEMA public TO public;
# this limits the number of connections needed to run the tests.
# ----------
-# run tablespace by itself, and first, because it forces a checkpoint;
+# required setup steps
+test: test_setup
+
+# run tablespace by itself, and early, because it forces a checkpoint;
# we'd prefer not to have checkpoints later in the tests because that
# interferes with crash-recovery testing.
test: tablespace
--- /dev/null
+-- Postgres formerly made the public schema read/write by default,
+-- and most of the core regression tests still expect that.
+GRANT ALL ON SCHEMA public TO public;