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.
pull/31/merge
Peter Eisentraut 8 years ago
parent 32ff269117
commit 7c44b75a2a
  1. 49
      src/test/regress/expected/triggers.out
  2. 12
      src/test/regress/sql/triggers.sql

@ -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,
action_order, action_condition, action_orientation, action_timing,
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
----------------------------+--------------------+---------------------+--------------------+--------------+------------------+--------------------+---------------+----------------------------+----------------------------
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');
SELECT 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
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
----------------------+--------------------+---------------------+--------------------+--------------+--------------------------------+--------------------+---------------+----------------------------+----------------------------
after_ins_stmt_trig | INSERT | public | main_table | 1 | | STATEMENT | AFTER | |
@ -2030,29 +2034,24 @@ create trigger child3_delete_trig
SELECT 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
FROM information_schema.triggers ORDER BY 1, 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
------------------------+--------------------+---------------------+--------------------+--------------+------------------+--------------------+---------------+----------------------------+----------------------------
after_ins_stmt_trig | INSERT | public | main_table | 1 | | STATEMENT | AFTER | |
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 | |
after_upd_b_stmt_trig | UPDATE | public | main_table | 1 | | STATEMENT | AFTER | |
after_upd_stmt_trig | UPDATE | public | main_table | 2 | | STATEMENT | AFTER | |
before_ins_stmt_trig | INSERT | public | main_table | 1 | | STATEMENT | BEFORE | |
before_upd_a_stmt_trig | UPDATE | public | main_table | 1 | | STATEMENT | BEFORE | |
child1_delete_trig | DELETE | public | child1 | 1 | | STATEMENT | AFTER | old_table |
child1_insert_trig | INSERT | public | child1 | 1 | | STATEMENT | AFTER | | new_table
child1_update_trig | UPDATE | public | child1 | 1 | | STATEMENT | AFTER | old_table | new_table
child2_delete_trig | DELETE | public | child2 | 1 | | STATEMENT | AFTER | old_table |
child2_insert_trig | INSERT | public | child2 | 1 | | STATEMENT | AFTER | | new_table
child2_update_trig | UPDATE | public | child2 | 1 | | STATEMENT | AFTER | old_table | new_table
child3_delete_trig | DELETE | public | child3 | 1 | | STATEMENT | AFTER | old_table |
child3_insert_trig | INSERT | public | child3 | 1 | | STATEMENT | AFTER | | new_table
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)
FROM information_schema.triggers
WHERE event_object_table IN ('parent', 'child1', 'child2', 'child3')
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
--------------------+--------------------+---------------------+--------------------+--------------+------------------+--------------------+---------------+----------------------------+----------------------------
child1_delete_trig | DELETE | public | child1 | 1 | | STATEMENT | AFTER | old_table |
child1_insert_trig | INSERT | public | child1 | 1 | | STATEMENT | AFTER | | new_table
child1_update_trig | UPDATE | public | child1 | 1 | | STATEMENT | AFTER | old_table | new_table
child2_delete_trig | DELETE | public | child2 | 1 | | STATEMENT | AFTER | old_table |
child2_insert_trig | INSERT | public | child2 | 1 | | STATEMENT | AFTER | | new_table
child2_update_trig | UPDATE | public | child2 | 1 | | STATEMENT | AFTER | old_table | new_table
child3_delete_trig | DELETE | public | child3 | 1 | | STATEMENT | AFTER | old_table |
child3_insert_trig | INSERT | public | child3 | 1 | | STATEMENT | AFTER | | new_table
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
(12 rows)
-- insert directly into children sees respective child-format tuples
insert into child1 values ('AAA', 42);

@ -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,
action_order, action_condition, action_orientation, action_timing,
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 fkeys;
@ -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,
action_order, action_condition, action_orientation, action_timing,
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);
COPY main_table FROM stdin;
123 999
@ -1484,7 +1488,9 @@ create trigger child3_delete_trig
SELECT 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
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 into child1 values ('AAA', 42);

Loading…
Cancel
Save