Re: [PATCH] Optionally record Plan IDs to track plan changes for a query
Андрей Казачков <andrey.kazachkov@tantorlabs.ru>
From: Андрей Казачков <andrey.kazachkov@tantorlabs.ru>
To: Sami Imseih <samimseih@gmail.com>, Lukas Fittl <lukas@fittl.com>, Michael Paquier <michael@paquier.xyz>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>, Marko M <marko@pganalyze.com>
Date: 2025-12-25T14:27:19Z
Lists: pgsql-hackers
Attachments
- (unnamed) (text/html)
- v6-0002-Fix-jumbling-of-empty-arrays-in-plan-nodes.patch (text/x-diff)
- v6-0001-Added-plan_id-to-the-core.patch (text/x-diff)
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