Skip to main content

store_accepts_a_max_length_identifier

Function store_accepts_a_max_length_identifier 

pub async fn store_accepts_a_max_length_identifier<F: Fixture>(
    open: impl AsyncFn() -> F,
) -> RuleOutcome
Expand description

An identifier at the documented maximum length survives, and still matches itself.

VT-14 and VT-20, deliberately. There is one round trip here and two clauses with a stake in it: VT-14 owns the boundary of validity — this is the longest value the constructors accept — and VT-20 owns the boundary of the constant, which is 255 bytes and stays there. A second rule under a second name would buy two tests that can only ever fail together.

What the rule rejects is a column narrower than the constant — VARCHAR(64), picked because nobody in the author’s domain had a longer event type. Under MySQL’s non-strict mode that truncates rather than refuses, and the truncated tag then matches no query, including the one built from the value that was written. That is why the rule reads twice: once for the bytes and once through a query, because an adapter that keeps the blob and truncates only the index passes the first read.

The tag is multi-byte at the limit for a second reason, and it is worth separating from the first because the obvious framing does not survive contact with SQL. The obvious framing is “MAX_TAG_LEN counts bytes and a VARCHAR(255) counts characters, so a multi-byte value at the limit is truncated” — and no VARCHAR(255) truncates a 255-byte value: it is 85 characters under character semantics and 255 bytes under byte semantics, and it fits either way. What the multi-byte value actually earns is Latin1IdentifierStore, the charset-lossy column, which fails this rule as well as its own — one boundary, two ways for a column to be wrong about it, and the registry records both.

NarrowIdentifierColumnStore is the compiled version.