--create table
create table score (i int,s int);
create or replace function warning() returns trigger as $$
declare
wmes varchar(240):='delete from score!';
begin
raise notice '%',wmes;
return null;
end;
create trigger delete_score before delete on score for each row
create table score (i int,s int);
insert into score values(1,60);
create or replace function warning() returns trigger as $$
declare
wmes varchar(240):='delete from score!';
begin
raise notice '%',wmes;
return null;
end;
$$ language plpgsql;
create trigger delete_score before delete on score for each row
execute procedure warning();
delete from score where id=1;
输出:
highgo=# delete from score where i=1;
注意: delete from score!
DELETE 0