You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Settings profile with a Map setting (http_response_headers) does not survive a serialization round trip #114591
An access entity with a Map-valued setting — e.g. a settings profile with http_response_headers — is serialized into a form that ClickHouse's own parser cannot read back. The stored entity becomes permanently unloadable.
How to reproduce
-- A string literal is the only accepted way to write a Map setting in a profile-- (map literals {...}, array literals [...], and map(...) are all rejected here):
CREATE SETTINGS PROFILE test_profile SETTINGS http_response_headers ='{''Content-Type'':''application/json'', ''Access-Control-Allow-Origin'':''*''}' CONST;
SHOW CREATE SETTINGS PROFILE test_profile;
-- CREATE SETTINGS PROFILE `test_profile` SETTINGS http_response_headers = [('Content-Type', 'application/json'), ('Access-Control-Allow-Origin', '*')] CONST-- Feeding the emitted statement back — which is exactly what DiskAccessStorage and-- ReplicatedAccessStorage store and re-parse via deserializeAccessEntity:
CREATE SETTINGS PROFILE test_profile2 SETTINGS http_response_headers = [('Content-Type', 'application/json'), ('Access-Control-Allow-Origin', '*')] CONST;
-- Code: 62. DB::Exception: Syntax error: failed at position 72 ([):-- Expected one of: literal, NULL, NULL, number, Bool, TRUE, FALSE, string literal, end of query
No value of the setting round-trips — even an empty map serializes as [] CONST, which is rejected the same way.
Root cause
The write path and the read path disagree:
Write: SettingsProfileElement (src/Access/SettingsProfileElement.cpp) casts the value to the setting's native type (Map), and the AST formats the Field as a literal, producing an array-of-tuples literal [('k', 'v'), ...].
Read: ParserSettingsProfileElement (src/Parsers/Access/ParserSettingsProfileElement.cpp) parses the value with a scalar-only literal parser. Unlike the query-level SETTINGS clause parser, it was never extended to accept collection literals (cf. Cannot use map() in SETTINGS #75065, where the query-level parser expects literal or map, ..., OpeningCurlyBrace).
So serializeAccessEntity → deserializeAccessEntity fails for any user/role/profile whose profile elements contain a collection-valued setting (http_response_headers, additional_table_filters, ...).
Acknowledged - reproduced on master (26.8.1.1), and the persistence half is confirmed too: the stored access/<uuid>.sql holds ATTACH SETTINGS PROFILE pers SETTINGS http_response_headers = [('a', 'b')] CONST;, and the next startup fails the whole access-storage load with Code: 62 ... Could not parse .../access/<uuid>.sql, not just that one entity.
Your root cause matches the source: parseValue in ParserSettingsProfileElement.cpp uses scalar-only ParserLiteral, while the query-level SETTINGS parser (ParserSetQuery.cpp) uses ParserAllCollectionsOfLiterals. additional_table_filters and the empty-map case reproduce identically, so I will fix the collection-valued class rather than the one setting. I will follow up here with the PR.
The write side was at fault, so the change is there: when a profile element's value, MIN or MAX holds a Map and the setting is builtin, it is emitted as the setting's canonical text in a quoted string instead of [('k', 'v')]. No grammar change. Custom settings are excluded, since castValueUtil returns their value unchanged and a string would come back a String.
Covers CREATE USER/ROLE, ALTER ... SETTINGS and MIN/MAX, and additional_table_filters as well. A downgrade is safe: a pre-fix binary reads the new form correctly, so no format versioning is involved.
Activity
pufit commentedon Aug 13, 2026
@groeneai fix this
groeneai commentedon Aug 13, 2026
Acknowledged - reproduced on master (26.8.1.1), and the persistence half is confirmed too: the stored
access/<uuid>.sqlholdsATTACH SETTINGS PROFILEpersSETTINGS http_response_headers = [('a', 'b')] CONST;, and the next startup fails the whole access-storage load withCode: 62 ... Could not parse .../access/<uuid>.sql, not just that one entity.Your root cause matches the source:
parseValuein ParserSettingsProfileElement.cpp uses scalar-onlyParserLiteral, while the query-level SETTINGS parser (ParserSetQuery.cpp) usesParserAllCollectionsOfLiterals.additional_table_filtersand the empty-map case reproduce identically, so I will fix the collection-valued class rather than the one setting. I will follow up here with the PR.groeneai commentedon Aug 13, 2026
Fix is up: #114620
The write side was at fault, so the change is there: when a profile element's value, MIN or MAX holds a
Mapand the setting is builtin, it is emitted as the setting's canonical text in a quoted string instead of[('k', 'v')]. No grammar change. Custom settings are excluded, sincecastValueUtilreturns their value unchanged and a string would come back aString.Covers
CREATE USER/ROLE,ALTER ... SETTINGSand MIN/MAX, andadditional_table_filtersas well. A downgrade is safe: a pre-fix binary reads the new form correctly, so no format versioning is involved.Fix serialization of Map-valued settings in access entities