"Karen Hill" <[EMAIL PROTECTED]> writes: > Tried it but didn't work. It gave me a hint though to try triggers. > Can anyone show me how to do an insert into a view using triggers?
I hope it said rules, because you can't put a trigger on a view. regression=# create table t(f1 int, f2 text); CREATE TABLE regression=# create view v as select * from t; CREATE VIEW regression=# insert into v values(22, 'foo'); ERROR: cannot insert into a view HINT: You need an unconditional ON INSERT DO INSTEAD rule. regression=# create rule r as on insert to v do instead regression-# insert into t values(new.*); CREATE RULE regression=# insert into v values(22, 'foo'); INSERT 0 1 regression=# select * from t; f1 | f2 ----+----- 22 | foo (1 row) regards, tom lane ---------------------------(end of broadcast)--------------------------- TIP 2: Don't 'kill -9' the postmaster