Skip to content

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

Open
LucaCappelletti94 wants to merge 1 commit into
mainfrom
custom-type-modifier-quoting
Open

LucaCappelletti94 wants to merge 1 commit 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

❌ Patch coverage is 92.85714% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 81.28%. Comparing base (ada8314) to head (0730482).

Files with missing lines Patch % Lines
src/ast/data_type.rs 85.71% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2676   +/-   ##
=======================================
  Coverage   81.28%   81.28%           
=======================================
  Files          42       42           
  Lines       33920    33929    +9     
  Branches    33920    33929    +9     
=======================================
+ Hits        27571    27579    +8     
  Misses       2785     2785           
- Partials     3564     3565    +1     

☔ 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 from 960fc8a to 0730482 Compare October 18, 2026 14:17
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.

2 participants