Make &FlatArray<Text> serializable #2346
Draft
isdaniel wants to merge 2 commits into
Draft
Conversation
* Text varlena element for FlatArray * Serialize FlatArray<Text> * cover mixed-stride + empty edge cases for FlatArray<Text>
isdaniel
force-pushed
the
feat/flatarray-text-serialize
branch
from
July 1, 2026 10:52
b3cfb3b to
dd1e864
Compare
Add function to calculate total length of non-null Text elements in FlatArray and add more tests for serializing FlatArray<Text>
isdaniel
force-pushed
the
feat/flatarray-text-serialize
branch
from
July 2, 2026 03:26
dd1e864 to
882693a
Compare
eeeebbbbrrrr
requested changes
Jul 11, 2026
|
|
||
| /// A borrowed Postgres `text` varlena, usable as a `FlatArray` element. | ||
| #[repr(transparent)] | ||
| pub struct Text([u8]); |
Contributor
There was a problem hiding this comment.
Without a lifetime this can lead to UB. I think this design needs a lot more thought than I'm able to give it right now.
isdaniel
marked this pull request as draft
July 16, 2026 00:30
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
The borrowed flat-array API supported scalars and CStr, but text arrays had a long-stubbed
&FlatArray<&str>placeholder unsound, since &str excludes the varlena header and breaks iteration stride. No way to serialize a borrowedtext[].Changes
Text(alphabetically between Point and Time) pushed the window forward by one, soTimestampWithTimeZone(previously 8th) dropped off into and $N others. The original fix only added Text (9 lines) without removing TimestampWithTimeZone, so it still didn't match the compiler's truncated 8-line output.