Re: ERROR : 'tuple concurrently updated' - Mailing list pgsql-hackers

From Tom Lane
Subject Re: ERROR : 'tuple concurrently updated'
Date
Msg-id 8765.1382109465@sss.pgh.pa.us
Whole thread Raw
In response to Re: ERROR : 'tuple concurrently updated'  (Stéphan BEUZE <stephan.beuze@douane.finances.gouv.fr>)
List pgsql-hackers
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



pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: Updatable view columns
Next
From: Robert Haas
Date:
Subject: Re: Review: Patch to compute Max LSN of Data Pages