[PATCH] Add tests for maximum tuple and index entry sizes

From: Henson Choi <assam258(at)gmail(dot)com>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: [PATCH] Add tests for maximum tuple and index entry sizes
Date: 2025-11-12 12:34:13
Message-ID: CAAAe_zB0WpvGiaJq0ZXkiAWjKP6HKcbxJ9=rKRVk3-kZcj7gfA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi hackers,

I'd like to propose adding regression tests that verify size limit
enforcement
for heap tuples and index entries at their boundaries. These tests ensure
that
the limits are correctly applied and appropriate error messages are shown
when
exceeded.

The patch adds three boundary tests:

1. Heap tuple maximum size (8160 bytes)
Tests inserting 8128-byte and 8129-byte text values. The former succeeds
while the latter fails because MAXALIGN rounds the 8161-byte tuple to
8168
bytes, exceeding the limit.

2. B-tree index maximum entry size (approximately 2704 bytes)
Tests indexing 2692-byte and 2693-byte text values. The limit is 1/3 of
page size to ensure proper page splits.

3. GiST index maximum siglen parameter (2024)
Tests creating indexes with siglen=2024 and siglen=2025. The limit comes
from the page size constraints for GiST index tuples.

These boundary tests use values that differ by only 1 byte or unit to
clearly
demonstrate the exact limits, making it easier to catch regressions if these
limits change in the future.

The tests are added to existing test files (insert.sql, btree_index.sql, and
tsearch.sql) with their corresponding expected outputs.

Tested on: REL_14_STABLE through master
Note: Applies cleanly to REL_15_STABLE and later.
REL_14_STABLE requires minor adjustments due to test file differences.

Patch attached.

Best regards,
Henson Choi

Attachment Content-Type Size
0001-Add-tests-for-maximum-tuple-and-index-entry-sizes.patch application/x-patch 7.4 KB
0002-Add-tests-for-maximum-tuple-and-index-entry-sizes-REL14.patch application/x-patch 7.4 KB

Browse pgsql-hackers by date

  From Date Subject
Next Message Ashutosh Bapat 2025-11-12 12:59:33 Re: Patch: dumping tables data in multiple chunks in pg_dump
Previous Message Akshay Joshi 2025-11-12 12:04:44 [PATCH] Add pg_get_database_ddl() function to reconstruct CREATE DATABASE statement