So, from top to bottom I see the following elements: * backend is executing a query * this query is getting captured by pg_stat_statements * the query is also getting captured by autoexplain, in chain from pg_stat_statements * autoexplain runs the query, which invokes a plpgsql function * this plpgsql function runs another query, and this one is captured by pg_stat_statements * and also by autoexplain * The autoexplain run of this inner query invokes a trigger * .. which is a FK trigger, and therefore runs ri_PerformCheck which runs another query * This FK check query gets captured by pg_stat_statements * and also by autoexplain, which runs it * this autoexplain run of the third query invokes SeqNext * this does a heap access, which uses HeapTupleSatisfiesMVCC * this one tries to read the update XID and gets an assertion failure.
Oh my. Would it be possible for you to provide a self-contained setup that behaves like this? I think a "bt full" would be useful since it'd provide the queries at each of the three stages. I'm not quite clear on why the third query, the one in ri_PerformCheck, is invoking a sequence. AFAICS it's this: /* ---------- * The query string built is * SELECT 1 FROM ONLY <pktable> x WHERE pkatt1 = $1 [AND ...] * FOR KEY SHARE OF x * The type id's for the $ parameters are those of the * corresponding FK attributes. * ---------- */ so either I'm misreading the whole thing, or there is something very odd going on here. Are you aware of something unusual in the FK setups? -- Álvaro Herrera http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers