mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 15:42:02 +00:00
Fix double escaping in the metadata of FORMAT JSON
This commit is contained in:
parent
2bdc926572
commit
4828be7fc4
@ -529,7 +529,12 @@ namespace JSONUtils
|
||||
writeObjectStart(out, 2);
|
||||
|
||||
writeTitle<true>("name", out, 3);
|
||||
writeDoubleQuoted(fields[i].name, out);
|
||||
|
||||
/// The field names are pre-escaped to be put into JSON string literal.
|
||||
writeChar('"', out);
|
||||
writeString(fields[i].name, out);
|
||||
writeChar('"', out);
|
||||
|
||||
writeFieldDelimiter(out);
|
||||
writeTitle<true>("type", out, 3);
|
||||
writeJSONString(fields[i].type->getName(), out, settings);
|
||||
|
@ -72,7 +72,7 @@ protected:
|
||||
|
||||
size_t field_number = 0;
|
||||
size_t row_count = 0;
|
||||
NamesAndTypes fields;
|
||||
NamesAndTypes fields; /// The field names are pre-escaped to be put into JSON string literal.
|
||||
|
||||
Statistics statistics;
|
||||
FormatSettings settings;
|
||||
|
@ -0,0 +1,18 @@
|
||||
{
|
||||
"meta":
|
||||
[
|
||||
{
|
||||
"name": "\"",
|
||||
"type": "String"
|
||||
}
|
||||
],
|
||||
|
||||
"data":
|
||||
[
|
||||
{
|
||||
"\"": "\\"
|
||||
}
|
||||
],
|
||||
|
||||
"rows": 1
|
||||
}
|
1
tests/queries/0_stateless/02375_double_escaping_json.sql
Normal file
1
tests/queries/0_stateless/02375_double_escaping_json.sql
Normal file
@ -0,0 +1 @@
|
||||
SELECT '\\' AS `"` FORMAT JSON SETTINGS output_format_write_statistics = 0;
|
Loading…
Reference in New Issue
Block a user