SEGFAULT on a concurrent UPDATE of mix of local and foreign partitions

From: Andrey Lepikhov <a(dot)lepikhov(at)postgrespro(dot)ru>
To: PostgreSQL mailing lists <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Cc: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
Subject: SEGFAULT on a concurrent UPDATE of mix of local and foreign partitions
Date: 2021-08-06 05:34:30
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

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.

Andrey Lepikhov
Postgres Professional

Attachment Content-Type Size
0001-Share-es_result_relations-of-parent-EState-in-EPQSta.patch text/plain 1.3 KB
t.sql application/sql 552 bytes
backtrace.txt text/plain 3.0 KB


Browse pgsql-bugs by date

  From Date Subject
Next Message Naomi's strings 2021-08-06 06:47:46 pg_stat warnings keep on printing in postgres log
Previous Message Amit Kapila 2021-08-06 05:23:55 Re: BUG #17132: About "ALTER SUBSCRIPTION ... ADD/DROP PUBLICATION"