Re: [PATCH] Optionally record Plan IDs to track plan changes for a query

From: Андрей Казачков <andrey(dot)kazachkov(at)tantorlabs(dot)ru>
To: Sami Imseih <samimseih(at)gmail(dot)com>, Lukas Fittl <lukas(at)fittl(dot)com>, Michael Paquier <michael(at)paquier(dot)xyz>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Marko M <marko(at)pganalyze(dot)com>
Subject: Re: [PATCH] Optionally record Plan IDs to track plan changes for a query
Date: 2025-12-25 14:27:19
Message-ID: 1459301766672119@mail.360.yandex.ru
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers



Dear PostgreSQL Hackers,


 


I’d like to propose a follow-up fix for a crash caused by jumbling of empty


array fields in Plan structures that was introduced in the v5-0003 patch.


 


For your convenience, I attached a minimal reproducible example:


```


create table foo as select i as num from generate_series(1, 1000) i;


set compute_plan_id to true;


 


-- server closed the connection unexpectedly


explain (costs off, verbose)


select min(num) from foo;


```


In this case the scalar aggregate operator `min(num)` is expressed as an Agg


node with an empty array of GROUP BY attributes. The jumble logic can’t handle


emptiness and terminates the backend. Similar behavior could happen during


jumbling an arbitrary plan node which contains an array.


 


Patchset overview:


v6-0001


-----------


Aggregates changes from v5-0001..v5-0003 and rebases onto master


commit b39013b7b1b116b5d9be51f0919b472b58b3a28d.


 


v6-0002


-----------


Fixes the lack of empty-array handling during jumbling (originally applies on


top of v6-0000). For anyone testing on the v5 versions, v6-0001 can be easily


applied on top of v5-0003.


 


--


Sincerely, Andrey Kazachkov

Attachment Content-Type Size
unknown_filename text/html 1.5 KB
v6-0002-Fix-jumbling-of-empty-arrays-in-plan-nodes.patch text/x-diff 1020 bytes
v6-0001-Added-plan_id-to-the-core.patch text/x-diff 43.9 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Андрей Казачков 2025-12-25 14:33:11 Re: [PATCH] Optionally record Plan IDs to track plan changes for a query
Previous Message Chao Li 2025-12-25 13:34:06 Re: Fix incorrect assertion in heapgettup_pagemode()