From: Alvaro Herrera Date: Sun, 1 Mar 2015 14:58:07 +0000 (-0300) Subject: Fix intermittent failure in event_trigger test X-Git-Tag: REL9_5_ALPHA1~693 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e059e02e43cd825616192d010e9e638a96ad4717;p=postgresql Fix intermittent failure in event_trigger test As evidenced by measles in buildfarm. Pointed out by Tom. --- diff --git a/src/test/regress/expected/event_trigger.out b/src/test/regress/expected/event_trigger.out index 8462fbff1c..eaf47f0527 100644 --- a/src/test/regress/expected/event_trigger.out +++ b/src/test/regress/expected/event_trigger.out @@ -370,13 +370,21 @@ alter table rewriteme NOTICE: Table 'rewriteme' is being rewritten (reason = 6) -- shouldn't trigger a table_rewrite event alter table rewriteme alter column foo type numeric(12,4); --- typed tables are rewritten when their type changes +-- typed tables are rewritten when their type changes. Don't emit table +-- name, because firing order is not stable. +CREATE OR REPLACE FUNCTION test_evtrig_no_rewrite() RETURNS event_trigger +LANGUAGE plpgsql AS $$ +BEGIN + RAISE NOTICE 'Table is being rewritten (reason = %)', + pg_event_trigger_table_rewrite_reason(); +END; +$$; create type rewritetype as (a int); create table rewritemetoo1 of rewritetype; create table rewritemetoo2 of rewritetype; alter type rewritetype alter attribute a type text cascade; -NOTICE: Table 'rewritemetoo1' is being rewritten (reason = 4) -NOTICE: Table 'rewritemetoo2' is being rewritten (reason = 4) +NOTICE: Table is being rewritten (reason = 4) +NOTICE: Table is being rewritten (reason = 4) -- but this doesn't work create table rewritemetoo3 (a rewritetype); alter type rewritetype alter attribute a type varchar cascade; diff --git a/src/test/regress/sql/event_trigger.sql b/src/test/regress/sql/event_trigger.sql index 4baad80b1d..bd672e1243 100644 --- a/src/test/regress/sql/event_trigger.sql +++ b/src/test/regress/sql/event_trigger.sql @@ -276,7 +276,16 @@ alter table rewriteme -- shouldn't trigger a table_rewrite event alter table rewriteme alter column foo type numeric(12,4); --- typed tables are rewritten when their type changes +-- typed tables are rewritten when their type changes. Don't emit table +-- name, because firing order is not stable. +CREATE OR REPLACE FUNCTION test_evtrig_no_rewrite() RETURNS event_trigger +LANGUAGE plpgsql AS $$ +BEGIN + RAISE NOTICE 'Table is being rewritten (reason = %)', + pg_event_trigger_table_rewrite_reason(); +END; +$$; + create type rewritetype as (a int); create table rewritemetoo1 of rewritetype; create table rewritemetoo2 of rewritetype;