The following bug has been logged on the website:
Bug reference: 14431
Logged by: Benjie Gillam
Email address: benjie(at)jemjie(dot)com
PostgreSQL version: 9.5.2
Operating system: OS X 10.11.5
Description:
I've triggered an error that "should not happen", took me a while to figure
out what I'd done.
I've managed to build a small test case that reproduces the issue (it
relates to `deferrable initially deferred`):
https://gist.github.com/benjie/9d4f8df41ebf7a0fb78788c00c75561a
I don't think it's a particularly important issue. Here's the relevant line
of code:
https://github.com/postgres/postgres/blob/6fa391be4e83139cd134d5ccfc1499809bb8c98c/src/backend/commands/trigger.c#L4027-L4029