SEGFAULT on a concurrent UPDATE of mix of local and foreign partitions - Mailing list pgsql-bugs

From Andrey Lepikhov
Subject SEGFAULT on a concurrent UPDATE of mix of local and foreign partitions
Date
Msg-id cb2b808d-cbaa-4772-76ee-c8809bafcf3d@postgrespro.ru
Whole thread Raw
Responses Re: SEGFAULT on a concurrent UPDATE of mix of local and foreign partitions  (Heikki Linnakangas <hlinnaka@iki.fi>)
List pgsql-bugs
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

Attachment

pgsql-bugs by date:

Previous
From: Amit Kapila
Date:
Subject: Re: BUG #17132: About "ALTER SUBSCRIPTION ... ADD/DROP PUBLICATION"
Next
From: "Naomi's strings"
Date:
Subject: pg_stat warnings keep on printing in postgres log