Skip to content

PostgreSQL, ClickHouse: Keep custom data type modifiers re-parseable with a typed list - #2676

Open
LucaCappelletti94 wants to merge 2 commits into
mainfrom
custom-type-modifier-quoting
Open

LucaCappelletti94 wants to merge 2 commits into
mainfrom
custom-type-modifier-quoting

Conversation

@LucaCappelletti94

Copy link
Copy Markdown
Contributor

PostgreSQL lets user-defined types take simple constants or identifiers as modifiers (https://www.postgresql.org/docs/current/sql-createtype.html), and ClickHouse writes Object('json'). DataType::Custom stored each modifier as a bare String, so the quotes were lost on display: Object('json') was printed as Object(json), foo('a b') as foo(a b) (parsed back as two modifiers), and foo('it''s') as foo(it's), which no longer parses.

DataType::Custom now holds a Vec<TypeModifier>, which keeps identifiers (with their quote style), numbers (with the L suffix) and single-quoted strings apart, and strings are displayed with their quotes escaped. This is a public API change for code that builds or matches DataType::Custom or calls parse_optional_type_modifiers. Tests round-trip string, identifier and number modifiers in every dialect, and the ClickHouse Object test now checks the typed modifiers.

This conflicts with #2557, which also builds DataType::Custom modifiers, so whichever lands second needs a small update.

@codecov-commenter

codecov-commenter commented Oct 17, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.53%. Comparing base (424378c) to head (cdf700f).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2676      +/-   ##
==========================================
+ Coverage   81.52%   81.53%   +0.01%     
==========================================
  Files          42       42              
  Lines       34205    34214       +9     
  Branches    34205    34214       +9     
==========================================
+ Hits        27885    27896      +11     
+ Misses       2770     2768       -2     
  Partials     3550     3550              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@LucaCappelletti94
LucaCappelletti94 force-pushed the custom-type-modifier-quoting branch 2 times, most recently from 0730482 to 000f1d4 Compare October 20, 2026 11:21
@LucaCappelletti94
LucaCappelletti94 force-pushed the custom-type-modifier-quoting branch from 000f1d4 to cdf700f Compare October 21, 2026 07:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants