Re: BUG #19484: Segmentation fault triggered by FDW
От
Etsuro Fujita
Тема
Re: BUG #19484: Segmentation fault triggered by FDW
Дата
Msg-id
CAPmGK14N3wzUuPUcgnKZXt2TQT5LwSFU348fRBSusOE518DGRg@mail.gmail.com
Ответ на
Re: BUG #19484: Segmentation fault triggered by FDW (Ayush Tiwari)
Список
Дерево обсуждения
Re: Add vacuum_delay_point() to GiST empty-page deletion pass Paul Kim <mok03127@gmail.com>
Hi, On Wed, May 20, 2026 at 5:37 AM Ayush Tiwari wrote: > On Wed, 20 May 2026 at 03:59, PG Bug reporting form wrote: >> I found the following test case triggers a segmentation fault: [snip] > Thanks for the very precise repro, that made this easy to track down. > > I reproduced the crash on master. The plan EXPLAIN under > force_generic_plan shows runtime pruning is in effect: > > Update on pt > Foreign Update on pt_p2 pt_2 > -> Append > Subplans Removed: 1 > -> Foreign Update on pt_p2 pt_2 > > The SEGV happens inside postgresBeginForeignModify() because > ExecInitModifyTable() builds re-indexed "kept" copies of several > parallel per-result-relation lists after dropping pruned relations - > withCheckOptionLists, returningLists, updateColnosLists, > mergeActionLists and mergeJoinConditions, however two members were > missed: > > - node->fdwPrivLists, read with list_nth(node->fdwPrivLists, i) when > BeginForeignModify() is called, and > - node->fdwDirectModifyPlans, checked with bms_is_member(i, ...) when > setting ri_usesFdwDirectModify. > > Both were still indexed against the original (pre-pruning) positions > while the surrounding loop's "i" is now the kept position. When the > foreign partition's kept-index no longer matched its original index, > BeginForeignModify() got the wrong fdw_private and crashed. > > Attached patch builds re-indexed kept copies for these two arrays in > the same loop as the other parallel lists, and uses them at the two > call sites. Thanks Chi for the report, and Ayush for the analysis and patch! Will review. Best regards, Etsuro Fujita
В списке pgsql-bugs по дате отправления