[PATCH] Add tests for maximum tuple and index entry sizes - Mailing list pgsql-hackers

From Henson Choi
Subject [PATCH] Add tests for maximum tuple and index entry sizes
Date
Msg-id CAAAe_zB0WpvGiaJq0ZXkiAWjKP6HKcbxJ9=rKRVk3-kZcj7gfA@mail.gmail.com
Whole thread Raw
List 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

pgsql-hackers by date:

Previous
From: Akshay Joshi
Date:
Subject: [PATCH] Add pg_get_database_ddl() function to reconstruct CREATE DATABASE statement
Next
From: Ashutosh Bapat
Date:
Subject: Re: Patch: dumping tables data in multiple chunks in pg_dump