Closed UnamedRus closed 2 years ago
Hi, I published a fix for your case. Could you please upgrade the package and test it?
@TimonKK thanks a ton for the fix, this seems to do the trick indeed. I used the code below that fails with version 2.4.2
with unexpected json, but works with the latest 2.4.4
.
const CTE_SQL = `
WITH yolo AS (
SELECT rand() AS a, rand(1) AS b, rand(number) AS c
FROM numbers(3)
)
SELECT a, b, c FROM yolo
`
const OPTS = {
url, port, ...,
format: 'json',
}
async function main() {
const rows = await ck.connect(OPTS).query(CTE_SQL).toPromise()
console.log(rows)
// { a: 560152421, b: 3052471433, c: 25746393 },
// { a: 3317286345, b: 3388181787, c: 2905723273 },
// { a: 3213018093, b: 2268847078, c: 3820230708 }
}
main()
I do believe it happens because of this regexp.
https://github.com/TimonKK/clickhouse/blob/a84d890a1d2d509f1377b1c9abf7da28307a42fc/index.js#L495
Workaround is: manually write FORMAT JSON or whatever in your query.