Closed dannflor closed 2 weeks ago
@dannflor I can't reproduce it. It works when the database option is bigquery.
const { Parser } = require('node-sql-parser');
const parser = new Parser();
const sql = "SELECT APPROX_QUANTILES(field, 100)[OFFSET(50)] AS p50 FROM mytable";
const ast = parser.astify(problemSql, { database: 'bigquery' });
console.log(ast);
You're right, I lost the database type when I was reducing to a reproduction. I believe was still running into an issue while I had the type set correctly, I'll get back to you with a better reproduction
Ok, I wasn't able to reproduce it any more. I'll create a new issue if I find it again.
Ok, I wasn't able to reproduce it any more. I'll create a new issue if I find it again.
ok~
Describe the bug Attempting to index into the result of a function like APPROX_QUANTILES fails to parse.
Database Engine BigQuery
To Reproduce On any version of node-sql-parser try to parse:
you will get
Error parsing query at line 1 offset 36: Expected \"'\", \"+\", \"-\", \"--\", \".\", \"/*\", \"\\\"\", [ \\t\\n\\r], or [0-9] but \"O\" found.
Expected behavior The ability to use OFFSET and ORDINAL within index brackets.