Stéphan BEUZE <stephan.beuze@douane.finances.gouv.fr> writes:
>> So the question is about used extensions or contrib. (it can be loaded
>> by server, or in a session with LOAD, it can be auto-explain,
>> pg_stat_statement, ....).
> I don't use any used extensions or contrib.
Well, you're doing *something* that you have not told us about. As
Robert said, the only places where that error can be thrown are
simple_heap_update and simple_heap_delete, and neither of those are
reachable from an INSERT command unless something is happening behind
the scenes. Maybe you have an ON INSERT trigger on that table?
Another point here is that the NOT EXISTS coding seems to be trying to
prevent insertion of any duplicate rows into my_stat, but it will fail
miserably as soon as there are multiple processes doing that command
concurrently, since the NOT EXISTS check will only examine rows that were
committed before the command starts, not any that get committed while
it runs. I wonder whether you have code you've not shown us that
depends on the assumption of no duplicates in my_stat, and will lead to
multiple-update attempts somewhere else as soon as such duplicates appear.
regards, tom lane