diff options
author | Peter Eisentraut <peter_e@gmx.net> | 2018-02-07 14:57:19 -0500 |
---|---|---|
committer | Peter Eisentraut <peter_e@gmx.net> | 2018-02-07 14:57:19 -0500 |
commit | 7c44b75a2a0705bf17d0e7ef02b1a0a769306fa5 (patch) | |
tree | cc8ce993c779fea53cb5dfa7c9e3523e2079cab9 /src | |
parent | 32ff2691173559e5f0ca3ea9cd5db134af6ee37d (diff) | |
download | postgresql-7c44b75a2a0705bf17d0e7ef02b1a0a769306fa5.tar.gz postgresql-7c44b75a2a0705bf17d0e7ef02b1a0a769306fa5.zip |
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.
Diffstat (limited to 'src')
-rw-r--r-- | src/test/regress/expected/triggers.out | 49 | ||||
-rw-r--r-- | src/test/regress/sql/triggers.sql | 12 |
2 files changed, 33 insertions, 28 deletions
diff --git a/src/test/regress/expected/triggers.out b/src/test/regress/expected/triggers.out index 83978b610ec..98db323337b 100644 --- a/src/test/regress/expected/triggers.out +++ b/src/test/regress/expected/triggers.out @@ -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); diff --git a/src/test/regress/sql/triggers.sql b/src/test/regress/sql/triggers.sql index 7abebda4590..dba9bdd98b6 100644 --- a/src/test/regress/sql/triggers.sql +++ b/src/test/regress/sql/triggers.sql @@ -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); |