Report better object limits in error messages for injection points
authorMichael Paquier <michael@paquier.xyz>
Wed, 12 Nov 2025 01:18:50 +0000 (10:18 +0900)
committerMichael Paquier <michael@paquier.xyz>
Wed, 12 Nov 2025 01:18:50 +0000 (10:18 +0900)
commit6e1535308c843dc7413a02c83a41f70449c58fb3
tree4f7d9caba7bb889f6a351713d3387a0e2a9cd51a
parent79cd66f28c65abbdc0ed695a9583a530fe6ece14
Report better object limits in error messages for injection points

Previously, error messages for oversized injection point names, libraries,
and functions showed buffer sizes (64, 128, 128) instead of the usable
character limits (63, 127, 127) as it did not count for the
zero-terminated byte, which was confusing.  These messages are adjusted
to show better the reality.

The limit enforced for the private area was also too strict by one byte,
as specifying a zone worth exactly INJ_PRIVATE_MAXLEN should be able to
work because three is no zero-terminated byte in this case.

This is a stylistic change (well, mostly, a private_area size of exactly
1024 bytes can be defined with this change, something that nobody seem
to care about based on the lack of complaints).  However, this is a
testing facility let's keep the logic consistent across all the branches
where this code exists, as there is an argument in favor of out-of-core
extensions that use injection points.

Author: Xuneng Zhou <xunengzhou@gmail.com>
Co-authored-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/CABPTF7VxYp4Hny1h+7ejURY-P4O5-K8WZg79Q3GUx13cQ6B2kg@mail.gmail.com
Backpatch-through: 17
src/backend/utils/misc/injection_point.c