On Thu, 2006-11-16 at 11:34 -0800, Jeremy Smith wrote: > Example: > > ------------------------ Begin example SQL > create table parent ( > id serial primary key, > foo integer, > ); > > create table child ( > id integer references parent(id) on delete cascade, > bar integer > ) > > create view child_with_parent_explicit as > select parent.id, parent.foo, child.bar from parent join child using(id); > > -- this next one is just a copy of the first, to differentiate the two scenarios > create view child_with_parent_implicit as > select parent.id, parent.foo, child.bar from parent join child using(id); > > create rule "child_with_parent_explicit_insert" as > on insert to child_with_parent_explicit do instead ( > insert into parent(id, foo) values(new.id, new.foo); > insert into child(id, bar) values(new.id, new.bar); > ); > create rule "child_with_parent_explicit_insert" as on insert to child_with_parent_explicit do instead ( insert into parent(id, foo) values(COALESCE (new.id,NEXTVAL('parent_id_seq')), new.foo); insert into child(id, bar) values(COALESCE (new.id,CURRVAL('parent_id_seq')), new.bar); ); I'm not sure if this is what you're looking for, but does this help? Regards, Jeff Davis