We were unable to construct the commit group for this pull request: None of the pull request's commits have been successfully processed as yet.

Quote a dictionary setting name that is not an identifier #121091

Open
groeneai opened 8:47pm on September 19, 2026 wants to merge 0 commits into clickhouse/clickhouse master from
quote-dictionary-ddl-names-121026

Pull Request Overview

  • Opened on September 19, 2026
  • Status Open
  • Commit count 0

Total Delta

0 Total Diff Delta

Open Days

Open 0 weekdays

Test Delta

0 Diff Delta in Test Files
Breakdown by Phase

How long has this pull request spent in each phase of its lifecycle?

Data pending calculation for pull request

Author avatar

Quote a dictionary setting name that is not an identifier

Related: https://github.com/ClickHouse/ClickHouse/issues/121026

Changelog category (leave one):


  • Bug Fix (user-visible misbehavior in an official stable release)

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

Fixed formatting of a CREATE DICTIONARY query whose SETTINGS name is not an identifier, such as SETTINGS(`my setting` = 1). The name was written back unquoted, so SHOW CREATE DICTIONARY and the stored definition of such a dictionary did not parse, and a server that had one refused to start.

Description

A dictionary setting name is read with ParserCompoundIdentifier, which accepts a back-quoted identifier, so the name can hold any byte. ASTDictionarySettings::formatImpl wrote it with no quoting, so the formatted definition came out as a different token sequence. Present since v20.4.

Measured on master:


  • On a release build CREATE DICTIONARY d (...) SETTINGS(`my setting` = 1) is accepted and writes SETTINGS(my setting = 1) into the metadata file, and the next server start fails: Code: 62 ... Cannot parse definition from metadata file ... (SYNTAX_ERROR).

  • With assertions enabled (debug and every sanitizer build) the same DDL aborts the process: Logical error: 'Inconsistent AST formatting ... cannot parse query back'.


  • SHOW CREATE DICTIONARY, formatQuery and system.tables.create_table_query return text that does not re-parse.

The name now goes through formatSettingName, the existing inverse of that parser and what ASTSetQuery::formatImpl already uses for the query-level SETTINGS clause: an identifier, or a dot-joined compound of identifiers, stays unquoted; anything else is back-quoted. ASTDictionarySettings::readJSON also gains the two boundary rejections its four siblings have: an empty name, which has no spelling ParserIdentifier accepts, and a settings list with no settings, which would format the SETTINGS() clause the parser rejects as well.

Nothing existing is respelled: over every CREATE DICTIONARY ... SETTINGS(...) statement under tests/ and docs/ no name's spelling changes, and the 21 .reference files that carry formatted dictionary output are byte-identical before and after.

121054 fixes the key, SOURCE and LAYOUT names of the same issue; this is the fourth site, ASTDictionarySettings, which that PR leaves untouched. The two diffs share no new symbol and no line range, so either merge order applies.


Workflow [PR]
Sync PR [sync-upstream/pr/121091]
<!-- CI automatic block end :ci_links: -->

Comments Threads Pending Resolution

Resolved Comment Threads

No resolved comments have been left on this PR.