@@ -248,7 +248,7 @@ export const clickhouse: DialectOptions = {
248248 reservedKeywords : keywords ,
249249 reservedDataTypes : dataTypes ,
250250 reservedFunctionNames : functions ,
251- extraParens : [ '[]' ] ,
251+ extraParens : [ '[]' , '{}' ] ,
252252 lineCommentTypes : [ '#' , '--' ] ,
253253 nestedBlockComments : false ,
254254 underscoresInNumbers : true ,
@@ -258,7 +258,12 @@ export const clickhouse: DialectOptions = {
258258 // https://clickhouse.com/docs/sql-reference/syntax#defining-and-using-query-parameters
259259 custom : [
260260 {
261- regex : String . raw `\{[^:]+:[^}]+\}` ,
261+ // Parameters are like {foo:Uint64} or {foo:Map(String, String)}
262+ // We include `'` in the negated character class to be a little sneaky:
263+ // map literals have quoted keys, and we use this to avoid confusing
264+ // them for named parameters. This means that the map literal `{'foo':1}`
265+ // will be formatted as `{'foo': 1}` rather than `{foo: 1}`.
266+ regex : String . raw `\{[^:']+:[^}]+\}` ,
262267 key : v => {
263268 const match = / \{ ( [ ^ : ] + ) : / . exec ( v ) ;
264269 return match ? match [ 1 ] . trim ( ) : v ;
0 commit comments