Skip to content

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

Merged
LucaCappelletti94 merged 3 commits into
mainfrom
custom-type-modifier-quoting
Oct 24, 2026
Merged

LucaCappelletti94 merged 3 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.55%. Comparing base (28e9868) to head (321bc63).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2676      +/-   ##
==========================================
+ Coverage   81.54%   81.55%   +0.01%     
==========================================
  Files          42       42              
  Lines       34239    34248       +9     
  Branches    34239    34248       +9     
==========================================
+ Hits        27920    27931      +11     
+ Misses       2770     2768       -2     
  Partials     3549     3549              

☔ 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
@LucaCappelletti94
LucaCappelletti94 force-pushed the custom-type-modifier-quoting branch from cdf700f to 321bc63 Compare October 23, 2026 22:23
@LucaCappelletti94
LucaCappelletti94 added this pull request to the merge queue Oct 24, 2026
Merged via the queue into main with commit 13ce307 Oct 24, 2026
10 checks passed
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