Skip to content

Integer literals refuse the 0x/0o/0b and digit-separator forms PostgreSQL 16+ reads #127

Closed

Description

@CaffeinatedCoder

Integer bounds and set elements refuse the non-decimal and digit-separator forms PostgreSQL 16+ reads. Loud (a FormatException), not a wrong value. Measured on main (3ecfa10) against PostgreSQL 17.10:

Int32Range.Parse("[0x1F,)", null);       // FormatException
Int32Set.Parse("{1_000,0o17,0b101}", null); // FormatException
SELECT '[0x1F,)'::int4range, '{1_000,0o17,0b101}'::int[];   -- [31,) | {1000,15,5}

Int32Range, Int64Range, their multiranges, Int16Set, Int32Set, Int64Set and the wrapper arities. Found by LiteralCorpusProbeTests (#123), families non-decimal integer and digit separator integer.

Authority. docs/serialization.md: the text is "the PostgreSQL literal, the same text the server itself reads". For numeric the document names the grammar (sign, digits, point and exponent, J06), so the same refusal there is documented; for the integer types nothing says so. PostgreSQL 15 and older refuse these forms too.

Cause. ParseValue is int.Parse(s, NumberStyles.Integer, …).

Options. Read 0x/0o/0b and _ as PostgreSQL 16 does, or document the integer grammar as decimal digits only (one sentence next to J06). Not breaking either way.

Activity

  1. added
    bugSomething isn't working
    found-by/oracleFound by the generated-oracle machinery (claims × API surfaces)
    area/literalsParse, TryParse and formatting
    package/coreAffects CodoMetis.ValueRanges
    severity/lowCosmetic, message or documentation-level difference
    on Oct 17, 2026
  2. added this to the 10.0.0 milestone on Oct 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/literalsParse, TryParse and formattingbugSomething isn't workingfound-by/oracleFound by the generated-oracle machinery (claims × API surfaces)package/coreAffects CodoMetis.ValueRangesseverity/lowCosmetic, message or documentation-level difference

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions