Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit7c44b75

Browse files
committed
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 fromconcurrently running tests.
1 parent32ff269 commit7c44b75

File tree

2 files changed

+33
-28
lines changed

2 files changed

+33
-28
lines changed

‎src/test/regress/expected/triggers.out

Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,9 @@ NOTICE: check_pkeys_fkey_cascade: 1 tuple(s) of fkeys2 are deleted
9999
SELECT trigger_name, event_manipulation, event_object_schema, event_object_table,
100100
action_order, action_condition, action_orientation, action_timing,
101101
action_reference_old_table, action_reference_new_table
102-
FROM information_schema.triggers ORDER BY 1, 2;
102+
FROM information_schema.triggers
103+
WHERE event_object_table in ('pkeys', 'fkeys', 'fkeys2')
104+
ORDER BY trigger_name COLLATE "C", 2;
103105
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
104106
----------------------------+--------------------+---------------------+--------------------+--------------+------------------+--------------------+---------------+----------------------------+----------------------------
105107
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');
368370
SELECT trigger_name, event_manipulation, event_object_schema, event_object_table,
369371
action_order, action_condition, action_orientation, action_timing,
370372
action_reference_old_table, action_reference_new_table
371-
FROM information_schema.triggers ORDER BY 1, 2;
373+
FROM information_schema.triggers
374+
WHERE event_object_table IN ('main_table')
375+
ORDER BY trigger_name COLLATE "C", 2;
372376
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
373377
----------------------+--------------------+---------------------+--------------------+--------------+--------------------------------+--------------------+---------------+----------------------------+----------------------------
374378
after_ins_stmt_trig | INSERT | public | main_table | 1 | | STATEMENT | AFTER | |
@@ -2030,29 +2034,24 @@ create trigger child3_delete_trig
20302034
SELECT trigger_name, event_manipulation, event_object_schema, event_object_table,
20312035
action_order, action_condition, action_orientation, action_timing,
20322036
action_reference_old_table, action_reference_new_table
2033-
FROM information_schema.triggers ORDER BY 1, 2;
2034-
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
2035-
------------------------+--------------------+---------------------+--------------------+--------------+------------------+--------------------+---------------+----------------------------+----------------------------
2036-
after_ins_stmt_trig | INSERT | public | main_table | 1 | | STATEMENT | AFTER | |
2037-
after_upd_a_b_row_trig | UPDATE | public | main_table | 1 | | ROW | AFTER | |
2038-
after_upd_b_row_trig | UPDATE | public | main_table | 2 | | ROW | AFTER | |
2039-
after_upd_b_stmt_trig | UPDATE | public | main_table | 1 | | STATEMENT | AFTER | |
2040-
after_upd_stmt_trig | UPDATE | public | main_table | 2 | | STATEMENT | AFTER | |
2041-
before_ins_stmt_trig | INSERT | public | main_table | 1 | | STATEMENT | BEFORE | |
2042-
before_upd_a_stmt_trig | UPDATE | public | main_table | 1 | | STATEMENT | BEFORE | |
2043-
child1_delete_trig | DELETE | public | child1 | 1 | | STATEMENT | AFTER | old_table |
2044-
child1_insert_trig | INSERT | public | child1 | 1 | | STATEMENT | AFTER | | new_table
2045-
child1_update_trig | UPDATE | public | child1 | 1 | | STATEMENT | AFTER | old_table | new_table
2046-
child2_delete_trig | DELETE | public | child2 | 1 | | STATEMENT | AFTER | old_table |
2047-
child2_insert_trig | INSERT | public | child2 | 1 | | STATEMENT | AFTER | | new_table
2048-
child2_update_trig | UPDATE | public | child2 | 1 | | STATEMENT | AFTER | old_table | new_table
2049-
child3_delete_trig | DELETE | public | child3 | 1 | | STATEMENT | AFTER | old_table |
2050-
child3_insert_trig | INSERT | public | child3 | 1 | | STATEMENT | AFTER | | new_table
2051-
child3_update_trig | UPDATE | public | child3 | 1 | | STATEMENT | AFTER | old_table | new_table
2052-
parent_delete_trig | DELETE | public | parent | 1 | | STATEMENT | AFTER | old_table |
2053-
parent_insert_trig | INSERT | public | parent | 1 | | STATEMENT | AFTER | | new_table
2054-
parent_update_trig | UPDATE | public | parent | 1 | | STATEMENT | AFTER | old_table | new_table
2055-
(19 rows)
2037+
FROM information_schema.triggers
2038+
WHERE event_object_table IN ('parent', 'child1', 'child2', 'child3')
2039+
ORDER BY trigger_name COLLATE "C", 2;
2040+
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
2041+
--------------------+--------------------+---------------------+--------------------+--------------+------------------+--------------------+---------------+----------------------------+----------------------------
2042+
child1_delete_trig | DELETE | public | child1 | 1 | | STATEMENT | AFTER | old_table |
2043+
child1_insert_trig | INSERT | public | child1 | 1 | | STATEMENT | AFTER | | new_table
2044+
child1_update_trig | UPDATE | public | child1 | 1 | | STATEMENT | AFTER | old_table | new_table
2045+
child2_delete_trig | DELETE | public | child2 | 1 | | STATEMENT | AFTER | old_table |
2046+
child2_insert_trig | INSERT | public | child2 | 1 | | STATEMENT | AFTER | | new_table
2047+
child2_update_trig | UPDATE | public | child2 | 1 | | STATEMENT | AFTER | old_table | new_table
2048+
child3_delete_trig | DELETE | public | child3 | 1 | | STATEMENT | AFTER | old_table |
2049+
child3_insert_trig | INSERT | public | child3 | 1 | | STATEMENT | AFTER | | new_table
2050+
child3_update_trig | UPDATE | public | child3 | 1 | | STATEMENT | AFTER | old_table | new_table
2051+
parent_delete_trig | DELETE | public | parent | 1 | | STATEMENT | AFTER | old_table |
2052+
parent_insert_trig | INSERT | public | parent | 1 | | STATEMENT | AFTER | | new_table
2053+
parent_update_trig | UPDATE | public | parent | 1 | | STATEMENT | AFTER | old_table | new_table
2054+
(12 rows)
20562055

20572056
-- insert directly into children sees respective child-format tuples
20582057
insert into child1 values ('AAA', 42);

‎src/test/regress/sql/triggers.sql

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,9 @@ update pkeys set pkey1 = 7, pkey2 = '70' where pkey1 = 10 and pkey2 = '1';
9595
SELECT trigger_name, event_manipulation, event_object_schema, event_object_table,
9696
action_order, action_condition, action_orientation, action_timing,
9797
action_reference_old_table, action_reference_new_table
98-
FROMinformation_schema.triggersORDER BY1,2;
98+
FROMinformation_schema.triggers
99+
WHERE event_object_tablein ('pkeys','fkeys','fkeys2')
100+
ORDER BY trigger_name COLLATE"C",2;
99101

100102
DROPTABLE pkeys;
101103
DROPTABLE fkeys;
@@ -287,7 +289,9 @@ FOR EACH STATEMENT WHEN (true) EXECUTE PROCEDURE trigger_func('delete_when');
287289
SELECT trigger_name, event_manipulation, event_object_schema, event_object_table,
288290
action_order, action_condition, action_orientation, action_timing,
289291
action_reference_old_table, action_reference_new_table
290-
FROMinformation_schema.triggersORDER BY1,2;
292+
FROMinformation_schema.triggers
293+
WHERE event_object_tableIN ('main_table')
294+
ORDER BY trigger_name COLLATE"C",2;
291295
INSERT INTO main_table (a)VALUES (123), (456);
292296
COPY main_tableFROM stdin;
293297
123999
@@ -1484,7 +1488,9 @@ create trigger child3_delete_trig
14841488
SELECT trigger_name, event_manipulation, event_object_schema, event_object_table,
14851489
action_order, action_condition, action_orientation, action_timing,
14861490
action_reference_old_table, action_reference_new_table
1487-
FROMinformation_schema.triggersORDER BY1,2;
1491+
FROMinformation_schema.triggers
1492+
WHERE event_object_tableIN ('parent','child1','child2','child3')
1493+
ORDER BY trigger_name COLLATE"C",2;
14881494

14891495
-- insert directly into children sees respective child-format tuples
14901496
insert into child1values ('AAA',42);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp