GIN tries to form a tuple with a partial compressedList during insertion

From: Arseniy Mukhin <arseniy(dot)mukhin(dot)dev(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: GIN tries to form a tuple with a partial compressedList during insertion
Date: 2025-04-30 08:40:26
Message-ID: CAE7r3M+C=jcpTD93f_RBHrQp3C+=TAXFs+k4tTuZuuxboK8AvA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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

Attachment Content-Type Size
gin_insert_invalid_compressed_list_fix.patch text/x-patch 1.9 KB

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2025-04-30 09:15:20 Re: Doc: fix the rewrite condition when executing ALTER TABLE ADD COLUMN
Previous Message David Rowley 2025-04-30 07:29:30 Re: Typo in multixact.c and jsonfuncs.c documentation