GIN tries to form a tuple with a partial compressedList during insertion
Arseniy Mukhin <arseniy.mukhin.dev@gmail.com>
From: Arseniy Mukhin <arseniy.mukhin.dev@gmail.com>
To: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2025-04-30T08:40:26Z
Lists: pgsql-hackers
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Avoid unnecessary GinFormTuple() calls for incompressible posting lists.
- 771cfe22a098 19 (unreleased) landed
Attachments
- gin_insert_invalid_compressed_list_fix.patch (text/x-patch) patch
Hi, In the functions addItemPointersToLeafTuple and buildFreshLeafTuple (in gininsert.c), the result of ginCompressPostingList() is passed to GinFormTuple without checking whether ginCompressPostingList() successfully packed all items. These GinFormTuple calls consistently fail because the resulting tuples always exceed the maximum size. While this doesn’t result in data corruption, it might still be worth addressing. Additionally, the condition if (compressedList) is unnecessary, since ginCompressPostingList() never returns NULL. Please find the attached patch fixing it. Best regards, Arseniy Mukhin