Fix incorrect size check in statext_dependencies_deserialize

From: Ilia Evdokimov <ilya(dot)evdokimov(at)tantorlabs(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Fix incorrect size check in statext_dependencies_deserialize
Date: 2026-05-19 14:29:56
Message-ID: 4b8d299d-2505-4c30-bf80-0f697410db35@tantorlabs.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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/

Attachment Content-Type Size
v1-0001-Fix-size-check-in-statext_dependencies_deserializ.patch text/x-patch 1.3 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Ayush Tiwari 2026-05-19 15:15:50 Re: [Bug]Assertion failure in LATERAL GRAPH_TABLE with multi-label pattern
Previous Message vignesh C 2026-05-19 14:00:43 Re: Proposal: Conflict log history table for Logical Replication