Commit 7c44b75a authored by Peter Eisentraut's avatar Peter Eisentraut

Make new triggers tests more robust

Add explicit collation on the trigger name to avoid locale dependencies.
Also restrict the tables selected, to avoid interference from
concurrently running tests.
parent 32ff2691
...@@ -99,7 +99,9 @@ NOTICE: check_pkeys_fkey_cascade: 1 tuple(s) of fkeys2 are deleted ...@@ -99,7 +99,9 @@ NOTICE: check_pkeys_fkey_cascade: 1 tuple(s) of fkeys2 are deleted
SELECT trigger_name, event_manipulation, event_object_schema, event_object_table, SELECT trigger_name, event_manipulation, event_object_schema, event_object_table,
action_order, action_condition, action_orientation, action_timing, action_order, action_condition, action_orientation, action_timing,
action_reference_old_table, action_reference_new_table action_reference_old_table, action_reference_new_table
FROM information_schema.triggers ORDER BY 1, 2; FROM information_schema.triggers
WHERE event_object_table in ('pkeys', 'fkeys', 'fkeys2')
ORDER BY trigger_name COLLATE "C", 2;
trigger_name | event_manipulation | event_object_schema | event_object_table | action_order | action_condition | action_orientation | action_timing | action_reference_old_table | action_reference_new_table trigger_name | event_manipulation | event_object_schema | event_object_table | action_order | action_condition | action_orientation | action_timing | action_reference_old_table | action_reference_new_table
----------------------------+--------------------+---------------------+--------------------+--------------+------------------+--------------------+---------------+----------------------------+---------------------------- ----------------------------+--------------------+---------------------+--------------------+--------------+------------------+--------------------+---------------+----------------------------+----------------------------
check_fkeys2_fkey_restrict | DELETE | public | fkeys2 | 1 | | ROW | BEFORE | | check_fkeys2_fkey_restrict | DELETE | public | fkeys2 | 1 | | ROW | BEFORE | |
...@@ -368,7 +370,9 @@ FOR EACH STATEMENT WHEN (true) EXECUTE PROCEDURE trigger_func('delete_when'); ...@@ -368,7 +370,9 @@ FOR EACH STATEMENT WHEN (true) EXECUTE PROCEDURE trigger_func('delete_when');
SELECT trigger_name, event_manipulation, event_object_schema, event_object_table, SELECT trigger_name, event_manipulation, event_object_schema, event_object_table,
action_order, action_condition, action_orientation, action_timing, action_order, action_condition, action_orientation, action_timing,
action_reference_old_table, action_reference_new_table action_reference_old_table, action_reference_new_table
FROM information_schema.triggers ORDER BY 1, 2; FROM information_schema.triggers
WHERE event_object_table IN ('main_table')
ORDER BY trigger_name COLLATE "C", 2;
trigger_name | event_manipulation | event_object_schema | event_object_table | action_order | action_condition | action_orientation | action_timing | action_reference_old_table | action_reference_new_table trigger_name | event_manipulation | event_object_schema | event_object_table | action_order | action_condition | action_orientation | action_timing | action_reference_old_table | action_reference_new_table
----------------------+--------------------+---------------------+--------------------+--------------+--------------------------------+--------------------+---------------+----------------------------+---------------------------- ----------------------+--------------------+---------------------+--------------------+--------------+--------------------------------+--------------------+---------------+----------------------------+----------------------------
after_ins_stmt_trig | INSERT | public | main_table | 1 | | STATEMENT | AFTER | | after_ins_stmt_trig | INSERT | public | main_table | 1 | | STATEMENT | AFTER | |
...@@ -2030,29 +2034,24 @@ create trigger child3_delete_trig ...@@ -2030,29 +2034,24 @@ create trigger child3_delete_trig
SELECT trigger_name, event_manipulation, event_object_schema, event_object_table, SELECT trigger_name, event_manipulation, event_object_schema, event_object_table,
action_order, action_condition, action_orientation, action_timing, action_order, action_condition, action_orientation, action_timing,
action_reference_old_table, action_reference_new_table action_reference_old_table, action_reference_new_table
FROM information_schema.triggers ORDER BY 1, 2; FROM information_schema.triggers
trigger_name | event_manipulation | event_object_schema | event_object_table | action_order | action_condition | action_orientation | action_timing | action_reference_old_table | action_reference_new_table WHERE event_object_table IN ('parent', 'child1', 'child2', 'child3')
------------------------+--------------------+---------------------+--------------------+--------------+------------------+--------------------+---------------+----------------------------+---------------------------- ORDER BY trigger_name COLLATE "C", 2;
after_ins_stmt_trig | INSERT | public | main_table | 1 | | STATEMENT | AFTER | | trigger_name | event_manipulation | event_object_schema | event_object_table | action_order | action_condition | action_orientation | action_timing | action_reference_old_table | action_reference_new_table
after_upd_a_b_row_trig | UPDATE | public | main_table | 1 | | ROW | AFTER | | --------------------+--------------------+---------------------+--------------------+--------------+------------------+--------------------+---------------+----------------------------+----------------------------
after_upd_b_row_trig | UPDATE | public | main_table | 2 | | ROW | AFTER | | child1_delete_trig | DELETE | public | child1 | 1 | | STATEMENT | AFTER | old_table |
after_upd_b_stmt_trig | UPDATE | public | main_table | 1 | | STATEMENT | AFTER | | child1_insert_trig | INSERT | public | child1 | 1 | | STATEMENT | AFTER | | new_table
after_upd_stmt_trig | UPDATE | public | main_table | 2 | | STATEMENT | AFTER | | child1_update_trig | UPDATE | public | child1 | 1 | | STATEMENT | AFTER | old_table | new_table
before_ins_stmt_trig | INSERT | public | main_table | 1 | | STATEMENT | BEFORE | | child2_delete_trig | DELETE | public | child2 | 1 | | STATEMENT | AFTER | old_table |
before_upd_a_stmt_trig | UPDATE | public | main_table | 1 | | STATEMENT | BEFORE | | child2_insert_trig | INSERT | public | child2 | 1 | | STATEMENT | AFTER | | new_table
child1_delete_trig | DELETE | public | child1 | 1 | | STATEMENT | AFTER | old_table | child2_update_trig | UPDATE | public | child2 | 1 | | STATEMENT | AFTER | old_table | new_table
child1_insert_trig | INSERT | public | child1 | 1 | | STATEMENT | AFTER | | new_table child3_delete_trig | DELETE | public | child3 | 1 | | STATEMENT | AFTER | old_table |
child1_update_trig | UPDATE | public | child1 | 1 | | STATEMENT | AFTER | old_table | new_table child3_insert_trig | INSERT | public | child3 | 1 | | STATEMENT | AFTER | | new_table
child2_delete_trig | DELETE | public | child2 | 1 | | STATEMENT | AFTER | old_table | child3_update_trig | UPDATE | public | child3 | 1 | | STATEMENT | AFTER | old_table | new_table
child2_insert_trig | INSERT | public | child2 | 1 | | STATEMENT | AFTER | | new_table parent_delete_trig | DELETE | public | parent | 1 | | STATEMENT | AFTER | old_table |
child2_update_trig | UPDATE | public | child2 | 1 | | STATEMENT | AFTER | old_table | new_table parent_insert_trig | INSERT | public | parent | 1 | | STATEMENT | AFTER | | new_table
child3_delete_trig | DELETE | public | child3 | 1 | | STATEMENT | AFTER | old_table | parent_update_trig | UPDATE | public | parent | 1 | | STATEMENT | AFTER | old_table | new_table
child3_insert_trig | INSERT | public | child3 | 1 | | STATEMENT | AFTER | | new_table (12 rows)
child3_update_trig | UPDATE | public | child3 | 1 | | STATEMENT | AFTER | old_table | new_table
parent_delete_trig | DELETE | public | parent | 1 | | STATEMENT | AFTER | old_table |
parent_insert_trig | INSERT | public | parent | 1 | | STATEMENT | AFTER | | new_table
parent_update_trig | UPDATE | public | parent | 1 | | STATEMENT | AFTER | old_table | new_table
(19 rows)
-- insert directly into children sees respective child-format tuples -- insert directly into children sees respective child-format tuples
insert into child1 values ('AAA', 42); insert into child1 values ('AAA', 42);
......
...@@ -95,7 +95,9 @@ update pkeys set pkey1 = 7, pkey2 = '70' where pkey1 = 10 and pkey2 = '1'; ...@@ -95,7 +95,9 @@ update pkeys set pkey1 = 7, pkey2 = '70' where pkey1 = 10 and pkey2 = '1';
SELECT trigger_name, event_manipulation, event_object_schema, event_object_table, SELECT trigger_name, event_manipulation, event_object_schema, event_object_table,
action_order, action_condition, action_orientation, action_timing, action_order, action_condition, action_orientation, action_timing,
action_reference_old_table, action_reference_new_table action_reference_old_table, action_reference_new_table
FROM information_schema.triggers ORDER BY 1, 2; FROM information_schema.triggers
WHERE event_object_table in ('pkeys', 'fkeys', 'fkeys2')
ORDER BY trigger_name COLLATE "C", 2;
DROP TABLE pkeys; DROP TABLE pkeys;
DROP TABLE fkeys; DROP TABLE fkeys;
...@@ -287,7 +289,9 @@ FOR EACH STATEMENT WHEN (true) EXECUTE PROCEDURE trigger_func('delete_when'); ...@@ -287,7 +289,9 @@ FOR EACH STATEMENT WHEN (true) EXECUTE PROCEDURE trigger_func('delete_when');
SELECT trigger_name, event_manipulation, event_object_schema, event_object_table, SELECT trigger_name, event_manipulation, event_object_schema, event_object_table,
action_order, action_condition, action_orientation, action_timing, action_order, action_condition, action_orientation, action_timing,
action_reference_old_table, action_reference_new_table action_reference_old_table, action_reference_new_table
FROM information_schema.triggers ORDER BY 1, 2; FROM information_schema.triggers
WHERE event_object_table IN ('main_table')
ORDER BY trigger_name COLLATE "C", 2;
INSERT INTO main_table (a) VALUES (123), (456); INSERT INTO main_table (a) VALUES (123), (456);
COPY main_table FROM stdin; COPY main_table FROM stdin;
123 999 123 999
...@@ -1484,7 +1488,9 @@ create trigger child3_delete_trig ...@@ -1484,7 +1488,9 @@ create trigger child3_delete_trig
SELECT trigger_name, event_manipulation, event_object_schema, event_object_table, SELECT trigger_name, event_manipulation, event_object_schema, event_object_table,
action_order, action_condition, action_orientation, action_timing, action_order, action_condition, action_orientation, action_timing,
action_reference_old_table, action_reference_new_table action_reference_old_table, action_reference_new_table
FROM information_schema.triggers ORDER BY 1, 2; FROM information_schema.triggers
WHERE event_object_table IN ('parent', 'child1', 'child2', 'child3')
ORDER BY trigger_name COLLATE "C", 2;
-- insert directly into children sees respective child-format tuples -- insert directly into children sees respective child-format tuples
insert into child1 values ('AAA', 42); insert into child1 values ('AAA', 42);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment