Why is a duplicate record inserted when it should not be?
This turned out to be a red herring.  When pgadmin gets disconnected midquery, it returns the last error again even if it was an entirely different command! :)