Martijn van Oosterhout <kleptog@svana.org> writes:
> I don't think rules can do what you want.
A trigger might work, ignoring the problem of race conditions between
two inserts happening concurrently (which a rule can't handle either).
regards, tom lane