Fix incorrect size check in statext_dependencies_deserialize

Ilia Evdokimov <ilya.evdokimov@tantorlabs.com>

From: Ilia Evdokimov <ilya.evdokimov@tantorlabs.com>
To: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2026-05-19T14:29:56Z
Lists: pgsql-hackers

Attachments

Hi hackers,

I noticed an issue in `statext_dependencies_deserialize()`. The sanity 
check uses `SizeOfItem` to validate the bytea size, but `SizeOfItem()` 
expects the number of attributes in a single dependency, not the number 
of dependencies. This means the check is computing the size of one 
dependency with ndeps attributes, which is incorrect.

It should use `MinSizeOfItems` instead, which correctly computes the 
minimum expected size as the header plus `ndeps` minimally-sized 
dependency items.

Notably, the similar function for ndistinct extended statistics 
`statext_ndistinct_deserialize()` already uses `MinSizeOfItems` 
correctly, which suggests this is a typo rather than an intentional choice.

--
Best regards,
Ilia Evdokimov,
Tantor Labs LLC,
https://tantorlabs.com/