"Andrew Hammond" <andrew.george.hammond (AT) gmail (DOT) com> writes:
Quote:
Rules:
t2_part AS
ON INSERT TO t2
WHERE new.id > 10 DO INSTEAD INSERT INTO t2_child (id, name)
VALUES (new.id, new.name) |
"new.id" is replaced by "nextval('t2_id_seq'::regclass)" each time it
appears ... which will be four separate times, viz the two evaluations
of the WHERE clause and the two VALUES clauses.
Basically, volatile functions and rules do not mix. Consider using
a trigger on t2 instead to redirect the insert somewhere else.
regards, tom lane
---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?
http://www.postgresql.org/docs/faq