"Ian McFarland" <ian@xxxxxxxxxxxxxxxx> writes: > CREATE RULE table_b_insert_rule AS ON INSERT TO table_b > DO (UPDATE table_b SET active = 'f', yield = new.id WHERE table_a_id > = new.table_a_id AND id != new.id;); Rules are macros. Since what is substituted for new.id in this case is a nextval() call, you have a multiple-evaluation problem. The above is a pretty horrid way to do things anyway --- you should probably be using a trigger instead. regards, tom lane ---------------------------(end of broadcast)--------------------------- TIP 5: don't forget to increase your free space map settings