so found example:
create function eager.account_insert() returns trigger security definer language plpgsql $$ begin insert eager.account_balances(name) values(new.name); return new; end; $$; create trigger account_insert after insert on accounts each row execute procedure eager.account_insert();
the thing can't understand: function eager.account_insert()
not take arguments, however, operates variable new
. returns it, should't return trigger
?
also, this: insert eager.account_balances(name)
, not record chosen, this?
the new
(and old
when it's update statement) record
you're inserting or updating. can columns , whatever want them. many times before insert
triggers check valid values etc.
the function must return record
same columns table, or null
if insert should not happen (usually instead
triggers).
the insert statement regular insert 1 column specified of table , value taken newly inserted record
's column name
.
the documentation explains triggers well.
Comments
Post a Comment