postgresql - PL/pgSQL: Delete (update) row matching a record -
i'm writing 3 triggers in pl/pgsql. in each case, have record variable , want insert table, delete table, or update represent second record variable.
adding easy: insert mytable values (new.*);
deleting isn't easy, there doesn't seem syntax this:
delete mytable * = old.*; updating has same problem. there easy solution, short of generating matching sql queries compare each attribute using ideas this answer?
you can use trick delete
create table t(a int, b int); create table ta(a int, b int); create function t1_delete() returns trigger $$ begin delete ta ta = old; return null; end $$ language plpgsql;
but trick doesn't work update. simple trigger in pl/pgsql not possible simply.
Comments
Post a Comment