There's a \b missing on each side of the parenthese group, which makes the regexp match JSON instead of JSONEachRow.
The regexp should be:
var formatRegexp = /FORMAT\s+\b(BlockTabSeparated|CSV|CSVWithNames|JSON|JSONCompact|JSONEachRow|Native|Null|Pretty|PrettyCompact|PrettyCompactMonoBlock|PrettyNoEscapes|PrettyCompactNoEscapes|PrettySpaceNoEscapes|PrettySpace|RowBinary|TabSeparated|TabSeparatedRaw|TabSeparatedWithNames|TabSeparatedWithNamesAndTypes|TSKV|Values|Vertical|XML)\b/i;
This fixes the issue.
I filed an issue several months ago on the @apla/node-clickhouse repo but I got no answer.
There's a bug that prevents sending an INSERT query with a JSONEachRow format: https://github.com/PostHog/node-clickhouse/blob/1d45ede758e0d9a1ac9e76f065f9238d61b5cec8/src/clickhouse.js#L255
There's a
\b
missing on each side of the parenthese group, which makes the regexp matchJSON
instead ofJSONEachRow
.The regexp should be:
This fixes the issue.
I filed an issue several months ago on the @apla/node-clickhouse repo but I got no answer.
Could you correct this?