SEGFAULT on a concurrent UPDATE of mix of local and foreign partitions
Andrei Lepikhov <a.lepikhov@postgrespro.ru>
From: Andrey Lepikhov <a.lepikhov@postgrespro.ru>
To: PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>
Cc: Heikki Linnakangas <hlinnaka@iki.fi>
Date: 2021-08-06T05:34:30Z
Lists: pgsql-bugs
Attachments
- 0001-Share-es_result_relations-of-parent-EState-in-EPQSta.patch (text/plain) patch 0001
- t.sql (application/sql)
- backtrace.txt (text/plain)
Hi, Postgres SEGFAULT'ed on the UPDATE of mix of local and foreign partitions. Initialization - see t.sql For replaying this segfault just execute in parallel: UPDATE test SET x = x - 1; The problem was introduced by commit 1375422. ExecUpdate has found a concurrently updated tuples and starts subplan evaluation. This operation creates new EState for EPQState and sets es_result_relations in NULL value. Next, ExecInitNode(subplan) is launched and underlying ExecInitForeignScan tries to access to an element of es_result_relations. This causes SEGFAULT. I studied this problem shortly. I think, EPQState can use es_result_relations of a parent EState. Patch in attachment fixes this. check-world passed clearly. -- regards, Andrey Lepikhov Postgres Professional
Commits
-
Fix segfault during EvalPlanQual with mix of local and foreign partitions.
- 6458ed18fe40 14.0 landed
- c3928b467a4f 15.0 landed
-
Create ResultRelInfos later in InitPlan, index them by RT index.
- 1375422c7826 14.0 cited