{{ message }}
Repository navigation
Conversation
The DataTypes row for PostgreSQL's one-byte "char" type (OID 18)
advertised CHAR({0}), but unquoted, CHAR(n) is character(n), a different
type: a column made from it read as string, not the char its DataType
says. Advertise "char", which takes no size.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.

The
DataTypesrow for PostgreSQL's internal one-byte"char"type (OID 18) advertisesCreateFormatCHAR({0})withCreateParameterssize. Unquoted,CHAR(n)ischaracter(n)(bpchar), a different type, so a column created from the row isn't a"char"column: it reads asSystem.String, while the row'sDataTypeisSystem.Char.The cause is in
PopulateHardcodedDataTypeInfo:case "char"compares the display name, so it matches OID 18 rather thanbpchar(character), and falls through tocase "text", which adds the size. This gives"char"its own case:CreateFormatis"char"(and"char"[]for the array), with no size. The other values it had through the fall-through (literal prefix and suffix, searchable withLIKE, not the best match forSystem.Char) are unchanged.DataTypes_CreateFormat_of_internal_char_creates_that_typecreates a column from the row, checks inpg_attributethat it is type 18, and checks that the reader returns the row'sDataType. It fails onmain; allSchemaTestspass against PostgreSQL 17 (204).This touches the same
switchas #6683, which takesCreateFormatmodifiers frompg_type.typmodin; the two are independent, and I'll rebase whichever merges second.Found with the pengdows ADO.NET conformance suite, whose type-fidelity tests create a column from each
DataTypesrow and check that the type read back is the one advertised.🤖 Generated with Claude Code