Commit b3a9e989 authored by Peter Eisentraut's avatar Peter Eisentraut

Extend a test case a little

This will possibly help a subsequent patch by making sure the notice
messages are distinct so that it's clear that they come out in the
right order.

Author: Fabien COELHO <coelho@cri.ensmp.fr>
Discussion: https://www.postgresql.org/message-id/alpine.DEB.2.21.1904240654120.3407%40lancre
parent 329784e1
...@@ -84,10 +84,10 @@ drop rule qqq on copydml_test; ...@@ -84,10 +84,10 @@ drop rule qqq on copydml_test;
create function qqq_trig() returns trigger as $$ create function qqq_trig() returns trigger as $$
begin begin
if tg_op in ('INSERT', 'UPDATE') then if tg_op in ('INSERT', 'UPDATE') then
raise notice '% %', tg_op, new.id; raise notice '% % %', tg_when, tg_op, new.id;
return new; return new;
else else
raise notice '% %', tg_op, old.id; raise notice '% % %', tg_when, tg_op, old.id;
return old; return old;
end if; end if;
end end
...@@ -97,16 +97,16 @@ create trigger qqqbef before insert or update or delete on copydml_test ...@@ -97,16 +97,16 @@ create trigger qqqbef before insert or update or delete on copydml_test
create trigger qqqaf after insert or update or delete on copydml_test create trigger qqqaf after insert or update or delete on copydml_test
for each row execute procedure qqq_trig(); for each row execute procedure qqq_trig();
copy (insert into copydml_test (t) values ('f') returning id) to stdout; copy (insert into copydml_test (t) values ('f') returning id) to stdout;
NOTICE: INSERT 8 NOTICE: BEFORE INSERT 8
8 8
NOTICE: INSERT 8 NOTICE: AFTER INSERT 8
copy (update copydml_test set t = 'g' where t = 'f' returning id) to stdout; copy (update copydml_test set t = 'g' where t = 'f' returning id) to stdout;
NOTICE: UPDATE 8 NOTICE: BEFORE UPDATE 8
8 8
NOTICE: UPDATE 8 NOTICE: AFTER UPDATE 8
copy (delete from copydml_test where t = 'g' returning id) to stdout; copy (delete from copydml_test where t = 'g' returning id) to stdout;
NOTICE: DELETE 8 NOTICE: BEFORE DELETE 8
8 8
NOTICE: DELETE 8 NOTICE: AFTER DELETE 8
drop table copydml_test; drop table copydml_test;
drop function qqq_trig(); drop function qqq_trig();
...@@ -70,10 +70,10 @@ drop rule qqq on copydml_test; ...@@ -70,10 +70,10 @@ drop rule qqq on copydml_test;
create function qqq_trig() returns trigger as $$ create function qqq_trig() returns trigger as $$
begin begin
if tg_op in ('INSERT', 'UPDATE') then if tg_op in ('INSERT', 'UPDATE') then
raise notice '% %', tg_op, new.id; raise notice '% % %', tg_when, tg_op, new.id;
return new; return new;
else else
raise notice '% %', tg_op, old.id; raise notice '% % %', tg_when, tg_op, old.id;
return old; return old;
end if; end if;
end end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment