Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A bug in regexp prevents using JSONEachRow format in INSERT queries #2

Open
vibl opened this issue Jul 3, 2021 · 1 comment
Open

Comments

@vibl
Copy link

vibl commented Jul 3, 2021

There's a bug that prevents sending an INSERT query with a JSONEachRow format:

var formatRegexp = /FORMAT\s+(BlockTabSeparated|CSV|CSVWithNames|JSON|JSONCompact|JSONEachRow|Native|Null|Pretty|PrettyCompact|PrettyCompactMonoBlock|PrettyNoEscapes|PrettyCompactNoEscapes|PrettySpaceNoEscapes|PrettySpace|RowBinary|TabSeparated|TabSeparatedRaw|TabSeparatedWithNames|TabSeparatedWithNamesAndTypes|TSKV|Values|Vertical|XML)/i

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.

Could you correct this?

@Twixes
Copy link
Collaborator

Twixes commented Jul 16, 2021

Hey! Since you propose a way to fix this, we'd be super happy to take PR if you're up for it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants