On Tue, Jun 17, 2008 at 10:15 AM, Michael Shulman <shulman@xxxxxxxxxxxx> wrote: > <philippe.gregoire@xxxxxxxxxxxxx> wrote: >> CREATE RULE studentinro_insert AS ON INSERT TO studentinfo >> DO INSTEAD >> ( >> INSERT INTO person ...; >> INSERT INTO student(person_id,...) VALUES >> (currval('person_person_id_seq'),...); >> ); This does, however, break if someone tries to insert more than one row at a time. INSERT INTO studentinfo (...) VALUES (...), (...); produces ERROR: duplicate key value violates unique constraint. I expect that what happens is that first all the inserts into person happen, then all the inserts into student happen, and all the latter ones try to use the same currval. Mike