mirror of
https://github.com/postgres/postgres.git
synced 2025-05-06 19:59:18 +03:00
Move rowsecurity event trigger test
The event trigger test for rowsecurity can cause problems for other tests which are run in parallel with it. Instead of running that test in the rowsecurity set, move it to the event_trigger set, which runs isolated from other tests. Also reverts 7161b08, which moved rowsecurity into its own test group. That's no longer necessary, now that the event trigger test is gone from the rowsecurity set of tests. Pointed out by Tom.
This commit is contained in:
parent
f454144a34
commit
c219cbfed3
@ -373,3 +373,46 @@ alter table rewriteme alter column foo type numeric(12,4);
|
||||
drop table rewriteme;
|
||||
drop event trigger no_rewrite_allowed;
|
||||
drop function test_evtrig_no_rewrite();
|
||||
-- test Row Security Event Trigger
|
||||
RESET SESSION AUTHORIZATION;
|
||||
CREATE TABLE event_trigger_test (a integer, b text);
|
||||
CREATE OR REPLACE FUNCTION start_command()
|
||||
RETURNS event_trigger AS $$
|
||||
BEGIN
|
||||
RAISE NOTICE '% - ddl_command_start', tg_tag;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
CREATE OR REPLACE FUNCTION end_command()
|
||||
RETURNS event_trigger AS $$
|
||||
BEGIN
|
||||
RAISE NOTICE '% - ddl_command_end', tg_tag;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
CREATE OR REPLACE FUNCTION drop_sql_command()
|
||||
RETURNS event_trigger AS $$
|
||||
BEGIN
|
||||
RAISE NOTICE '% - sql_drop', tg_tag;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
CREATE EVENT TRIGGER start_rls_command ON ddl_command_start
|
||||
WHEN TAG IN ('CREATE POLICY', 'ALTER POLICY', 'DROP POLICY') EXECUTE PROCEDURE start_command();
|
||||
CREATE EVENT TRIGGER end_rls_command ON ddl_command_end
|
||||
WHEN TAG IN ('CREATE POLICY', 'ALTER POLICY', 'DROP POLICY') EXECUTE PROCEDURE end_command();
|
||||
CREATE EVENT TRIGGER sql_drop_command ON sql_drop
|
||||
WHEN TAG IN ('DROP POLICY') EXECUTE PROCEDURE drop_sql_command();
|
||||
CREATE POLICY p1 ON event_trigger_test USING (FALSE);
|
||||
NOTICE: CREATE POLICY - ddl_command_start
|
||||
NOTICE: CREATE POLICY - ddl_command_end
|
||||
ALTER POLICY p1 ON event_trigger_test USING (TRUE);
|
||||
NOTICE: ALTER POLICY - ddl_command_start
|
||||
NOTICE: ALTER POLICY - ddl_command_end
|
||||
ALTER POLICY p1 ON event_trigger_test RENAME TO p2;
|
||||
NOTICE: ALTER POLICY - ddl_command_start
|
||||
NOTICE: ALTER POLICY - ddl_command_end
|
||||
DROP POLICY p2 ON event_trigger_test;
|
||||
NOTICE: DROP POLICY - ddl_command_start
|
||||
NOTICE: DROP POLICY - sql_drop
|
||||
NOTICE: DROP POLICY - ddl_command_end
|
||||
DROP EVENT TRIGGER start_rls_command;
|
||||
DROP EVENT TRIGGER end_rls_command;
|
||||
DROP EVENT TRIGGER sql_drop_command;
|
||||
|
@ -1998,51 +1998,6 @@ EXPLAIN (COSTS OFF) SELECT * FROM t1;
|
||||
One-Time Filter: false
|
||||
(2 rows)
|
||||
|
||||
--
|
||||
-- Event Triggers
|
||||
--
|
||||
RESET SESSION AUTHORIZATION;
|
||||
CREATE TABLE event_trigger_test (a integer, b text);
|
||||
CREATE OR REPLACE FUNCTION start_command()
|
||||
RETURNS event_trigger AS $$
|
||||
BEGIN
|
||||
RAISE NOTICE '% - ddl_command_start', tg_tag;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
CREATE OR REPLACE FUNCTION end_command()
|
||||
RETURNS event_trigger AS $$
|
||||
BEGIN
|
||||
RAISE NOTICE '% - ddl_command_end', tg_tag;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
CREATE OR REPLACE FUNCTION drop_sql_command()
|
||||
RETURNS event_trigger AS $$
|
||||
BEGIN
|
||||
RAISE NOTICE '% - sql_drop', tg_tag;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
CREATE EVENT TRIGGER start_rls_command ON ddl_command_start
|
||||
WHEN TAG IN ('CREATE POLICY', 'ALTER POLICY', 'DROP POLICY') EXECUTE PROCEDURE start_command();
|
||||
CREATE EVENT TRIGGER end_rls_command ON ddl_command_end
|
||||
WHEN TAG IN ('CREATE POLICY', 'ALTER POLICY', 'DROP POLICY') EXECUTE PROCEDURE end_command();
|
||||
CREATE EVENT TRIGGER sql_drop_command ON sql_drop
|
||||
WHEN TAG IN ('DROP POLICY') EXECUTE PROCEDURE drop_sql_command();
|
||||
CREATE POLICY p1 ON event_trigger_test USING (FALSE);
|
||||
NOTICE: CREATE POLICY - ddl_command_start
|
||||
NOTICE: CREATE POLICY - ddl_command_end
|
||||
ALTER POLICY p1 ON event_trigger_test USING (TRUE);
|
||||
NOTICE: ALTER POLICY - ddl_command_start
|
||||
NOTICE: ALTER POLICY - ddl_command_end
|
||||
ALTER POLICY p1 ON event_trigger_test RENAME TO p2;
|
||||
NOTICE: ALTER POLICY - ddl_command_start
|
||||
NOTICE: ALTER POLICY - ddl_command_end
|
||||
DROP POLICY p2 ON event_trigger_test;
|
||||
NOTICE: DROP POLICY - ddl_command_start
|
||||
NOTICE: DROP POLICY - sql_drop
|
||||
NOTICE: DROP POLICY - ddl_command_end
|
||||
DROP EVENT TRIGGER start_rls_command;
|
||||
DROP EVENT TRIGGER end_rls_command;
|
||||
DROP EVENT TRIGGER sql_drop_command;
|
||||
--
|
||||
-- COPY TO/FROM
|
||||
--
|
||||
|
@ -78,15 +78,12 @@ ignore: random
|
||||
# ----------
|
||||
# Another group of parallel tests
|
||||
# ----------
|
||||
test: select_into select_distinct select_distinct_on select_implicit select_having subselect union case join aggregates transactions random portals arrays btree_index hash_index update delete namespace prepared_xacts
|
||||
test: select_into select_distinct select_distinct_on select_implicit select_having subselect union case join aggregates transactions random portals arrays btree_index hash_index update namespace prepared_xacts delete
|
||||
|
||||
# ----------
|
||||
# Another group of parallel tests
|
||||
# ----------
|
||||
test: brin gin gist spgist privileges security_label collate matview lock replica_identity object_address
|
||||
|
||||
# rowsecurity creates an event trigger, so don't run it in parallel
|
||||
test: rowsecurity
|
||||
test: brin gin gist spgist privileges security_label collate matview lock replica_identity rowsecurity object_address
|
||||
|
||||
# ----------
|
||||
# Another group of parallel tests
|
||||
|
@ -105,8 +105,8 @@ test: collate
|
||||
test: matview
|
||||
test: lock
|
||||
test: replica_identity
|
||||
test: object_address
|
||||
test: rowsecurity
|
||||
test: object_address
|
||||
test: alter_generic
|
||||
test: misc
|
||||
test: psql
|
||||
|
@ -279,3 +279,46 @@ alter table rewriteme alter column foo type numeric(12,4);
|
||||
drop table rewriteme;
|
||||
drop event trigger no_rewrite_allowed;
|
||||
drop function test_evtrig_no_rewrite();
|
||||
|
||||
-- test Row Security Event Trigger
|
||||
RESET SESSION AUTHORIZATION;
|
||||
CREATE TABLE event_trigger_test (a integer, b text);
|
||||
|
||||
CREATE OR REPLACE FUNCTION start_command()
|
||||
RETURNS event_trigger AS $$
|
||||
BEGIN
|
||||
RAISE NOTICE '% - ddl_command_start', tg_tag;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
|
||||
CREATE OR REPLACE FUNCTION end_command()
|
||||
RETURNS event_trigger AS $$
|
||||
BEGIN
|
||||
RAISE NOTICE '% - ddl_command_end', tg_tag;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
|
||||
CREATE OR REPLACE FUNCTION drop_sql_command()
|
||||
RETURNS event_trigger AS $$
|
||||
BEGIN
|
||||
RAISE NOTICE '% - sql_drop', tg_tag;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
|
||||
CREATE EVENT TRIGGER start_rls_command ON ddl_command_start
|
||||
WHEN TAG IN ('CREATE POLICY', 'ALTER POLICY', 'DROP POLICY') EXECUTE PROCEDURE start_command();
|
||||
|
||||
CREATE EVENT TRIGGER end_rls_command ON ddl_command_end
|
||||
WHEN TAG IN ('CREATE POLICY', 'ALTER POLICY', 'DROP POLICY') EXECUTE PROCEDURE end_command();
|
||||
|
||||
CREATE EVENT TRIGGER sql_drop_command ON sql_drop
|
||||
WHEN TAG IN ('DROP POLICY') EXECUTE PROCEDURE drop_sql_command();
|
||||
|
||||
CREATE POLICY p1 ON event_trigger_test USING (FALSE);
|
||||
ALTER POLICY p1 ON event_trigger_test USING (TRUE);
|
||||
ALTER POLICY p1 ON event_trigger_test RENAME TO p2;
|
||||
DROP POLICY p2 ON event_trigger_test;
|
||||
|
||||
DROP EVENT TRIGGER start_rls_command;
|
||||
DROP EVENT TRIGGER end_rls_command;
|
||||
DROP EVENT TRIGGER sql_drop_command;
|
||||
|
@ -769,51 +769,6 @@ SET SESSION AUTHORIZATION rls_regress_user1;
|
||||
SELECT * FROM t1;
|
||||
EXPLAIN (COSTS OFF) SELECT * FROM t1;
|
||||
|
||||
--
|
||||
-- Event Triggers
|
||||
--
|
||||
RESET SESSION AUTHORIZATION;
|
||||
CREATE TABLE event_trigger_test (a integer, b text);
|
||||
|
||||
CREATE OR REPLACE FUNCTION start_command()
|
||||
RETURNS event_trigger AS $$
|
||||
BEGIN
|
||||
RAISE NOTICE '% - ddl_command_start', tg_tag;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
|
||||
CREATE OR REPLACE FUNCTION end_command()
|
||||
RETURNS event_trigger AS $$
|
||||
BEGIN
|
||||
RAISE NOTICE '% - ddl_command_end', tg_tag;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
|
||||
CREATE OR REPLACE FUNCTION drop_sql_command()
|
||||
RETURNS event_trigger AS $$
|
||||
BEGIN
|
||||
RAISE NOTICE '% - sql_drop', tg_tag;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
|
||||
CREATE EVENT TRIGGER start_rls_command ON ddl_command_start
|
||||
WHEN TAG IN ('CREATE POLICY', 'ALTER POLICY', 'DROP POLICY') EXECUTE PROCEDURE start_command();
|
||||
|
||||
CREATE EVENT TRIGGER end_rls_command ON ddl_command_end
|
||||
WHEN TAG IN ('CREATE POLICY', 'ALTER POLICY', 'DROP POLICY') EXECUTE PROCEDURE end_command();
|
||||
|
||||
CREATE EVENT TRIGGER sql_drop_command ON sql_drop
|
||||
WHEN TAG IN ('DROP POLICY') EXECUTE PROCEDURE drop_sql_command();
|
||||
|
||||
CREATE POLICY p1 ON event_trigger_test USING (FALSE);
|
||||
ALTER POLICY p1 ON event_trigger_test USING (TRUE);
|
||||
ALTER POLICY p1 ON event_trigger_test RENAME TO p2;
|
||||
DROP POLICY p2 ON event_trigger_test;
|
||||
|
||||
DROP EVENT TRIGGER start_rls_command;
|
||||
DROP EVENT TRIGGER end_rls_command;
|
||||
DROP EVENT TRIGGER sql_drop_command;
|
||||
|
||||
--
|
||||
-- COPY TO/FROM
|
||||
--
|
||||
|
Loading…
x
Reference in New Issue
Block a user