<snip>
|> I've tried multiple iterations of how to accomplish this and keep getting
stuck. With the one above, postgres yells and says:
|> ERROR: infinite recursion detected in rules for relation "visit"
|>
|> Any ideas?
</snip>
Look at http://www.postgresql.org/docs/8.3/interactive/plpgsql-trigger.html