From e059e02e43cd825616192d010e9e638a96ad4717 Mon Sep 17 00:00:00 2001 From: Alvaro Herrera Date: Sun, 1 Mar 2015 11:58:07 -0300 Subject: [PATCH] Fix intermittent failure in event_trigger test As evidenced by measles in buildfarm. Pointed out by Tom. --- src/test/regress/expected/event_trigger.out | 14 +++++++++++--- src/test/regress/sql/event_trigger.sql | 11 ++++++++++- 2 files changed, 21 insertions(+), 4 deletions(-) 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; -- 2.40.0