Repository navigation
GuidSet reads Guid.Parse's grammar, not uuid_in's: accepts (…), refuses hyphen groups #129
Description
GuidSet reads Guid.Parse's grammar instead of uuid_in's, in both directions. Measured on main (3ecfa10) against PostgreSQL 17.10:
GuidSet.Parse("{(6f9619ff-8b86-d011-b42d-00c04fc964ff)}", null); // parses: Guid's "P" format
GuidSet.Parse("{6f96-19ff-8b86-d011-b42d-00c0-4fc9-64ff}", null); // FormatExceptionSELECT '{(6f9619ff-8b86-d011-b42d-00c04fc964ff)}'::uuid[]; -- invalid input syntax for type uuid
SELECT '{6f96-19ff-8b86-d011-b42d-00c0-4fc9-64ff}'::uuid[]; -- {6f9619ff-8b86-d011-b42d-00c04fc964ff}GuidSet and GuidSet<T>. Found by LiteralCorpusProbeTests (#123), families parentheses and hyphen groups. The same cause as #78 (whitespace Guid.Parse trims and uuid_in rejects), which this sweep registers separately; one fix can close both.
Authority. docs/value-sets.md#parse-and-print-literals: "The grammar is PostgreSQL's array_in", with each element read by the element type's input function, and docs/serialization.md: the text is "the same text the server itself reads".
Cause. GuidSet.ParseValue is Guid.Parse(s), which takes the N, D, B, P and X formats and trims whitespace. uuid_in takes 32 hex digits, optionally in braces, with a hyphen after any group of four.
Fix (10.0.0). Parse uuid_in's grammar: refuse (…) (and X), accept hyphen groups. Refusing input that parses today is breaking, so it goes in the major.
Activity
CaffeinatedCoder commentedon Oct 18, 2026
The clone-divergence sweep (#140) names a third parse site for the fix: the
GuidSet<>wrapper-family bridge inSetTypeRegistryreads withGuid.Parse(text, Invariant)directly rather than throughGuidSet.ParseValue. Today that is the same grammar, so it is waived intest/oracles/clone-waivers.jsonwith a pointer here; a fix toGuidSet.ParseValuealone would leave a boundGuidSet<T>element readingGuid.Parse's grammar. Route the bridge throughGuidSet.ParseValue(as the integer bridges already do) in the same change, then the waiver goes stale and is removed.test: clone-divergence sweep over the hand-copied type families
CaffeinatedCoder commentedon Oct 18, 2026
Fixed in #162 (with #78):
UuidLiteralis the oneuuid_ingrammar — 32 hex digits, a hyphen allowed after any group of four, optional braces, nothing else — read byGuidSet.ParseValue, byGuidSet<T>.ParseValue(which now hands the element theDform, as the numeric arities hand theirs the primitive's text) and by the EF bridge forGuidSet<>, which goes throughGuidSet.ParseValueso the clone waiver named here is gone.{(…)}throws,{6f96-19ff-…}parses. Proven by reverting the fix.