varlena_alignment
varlena_alignment · pgrx test extension documenting varlena alignment behavior in pgrx set_varsize helpers.
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 100924 | varlena_alignment | varlena_alignment | 0.0.0 | FEAT | Unknown | Rust |
PostgreSQL · 11, 12, 13, 14, 15, 16
Usage
Sources:
varlena_alignment version 0.0.0 is a developer reproduction for a historical pgrx alignment bug. It demonstrates that casting a one-byte-aligned PostgreSQL varlena pointer to four-byte-aligned varattrib_4b in set_varsize_4b can invoke undefined behavior.
Intended Workflow
The repository defines only #[pg_test] cases. It exports no application SQL functions, types, operators, or configuration, so installing it with CREATE EXTENSION provides no user-facing workflow. Its purpose is to run the pgrx test harness against the pinned dependency:
One test calls set_varsize_1b on a deliberately offset allocation and is expected to succeed. The other calls set_varsize_4b on the same one-byte-aligned varlena pointer to reproduce the stricter-alignment failure visible with Rust debug pointer checks.
Developer Boundary
This project pins pgrx version 0.11.1 and declares PostgreSQL feature sets from pg11 through pg16. It is evidence about that implementation context, not a general runtime diagnostic and not a fix. Do not install it in production or treat a passing release build as proof that an unsafe cast is valid; assess the relevant pgrx version and memory-alignment contract directly.