alibaba / alibaba/nquery

Add support with escaped FROM

Open
#19 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
385
Forks
117
PR merge metrics
No merged PRs in 30d

Description

If there is an escaped table in the FROM statement it throws an error.

Example:
```
var parse = require('node-sqlparser').parse;
var stringify = require('node-sqlparser').stringify;

// ERROR
var sql = 'SELECT `id` FROM `Tb`'; // escaped `Tb`
var astObj = parse(sql); // ERROR

// OK
var sqlOK = 'SELECT `id` FROM Tb';
var astObjOK = parse(sql); // OK
```

Example of the error:

```
throw peg$buildException(null, peg$maxFailExpected, peg$maxFailPos);
^
SyntaxError: Expected "$", WHITE_SPACE or [A-Za-z_] but "`" found.
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at the parse entry point shown in the report and reproduce the failure with SELECT `id` FROM `Tb`, comparing it with the unescaped-table example. Trace the SQL grammar or parser rule that handles the FROM table name and add a regression test for escaped identifiers. Done means both examples parse successfully without the reported SyntaxError.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, sql
Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.