-
Notifications
You must be signed in to change notification settings - Fork 690
Description
I had this error at some point
1694 passing (3s)
408 pending
1 failing
1) Test 925 - UNIQUE JSON property
E) Multiple indexes (unique and regular) on same table:
SyntaxError: Parse error on line 1:
..._data on BOM5(data->value)
-----------------------^
Expecting 'LITERAL', 'BRALITERAL', 'LPAR', 'NUMBER', 'IF', 'CURRENT_DATE', 'REPLACE', 'DATEADD', 'DATEDIFF', 'TIMESTAMPDIFF', 'INTERVAL', got 'VALUE'
at parser.parseError (dist/alasql.fs.js:2257:8)
at Parser.parse (dist/alasql.fs.js:2131:22)
at alasql.parse (dist/alasql.fs.js:4518:22)
at alasql.dexec (dist/alasql.fs.js:4774:16)
at alasql.exec (dist/alasql.fs.js:4730:17)
at alasql (dist/alasql.fs.js:137:17)
at Context.<anonymous> (test/test925.js:108:3)
at process.processImmediate (node:internal/timers:485:21)
error Command failed with exit code 1.
It got fixed by replacing the reserved word value with amount. It seems wrong that the string value or values cant be used anywhere as its in a different context of where you would use it as a command.
In SQL, the keyword "VALUE" (more commonly, "VALUES") is used with the INSERT statement to provide data that will be added to a table. You use "VALUES" to specify the new row(s) of data you want to insert. For example:[1]
INSERT INTO Employees (Name, Age, Department)
VALUES ('Jane', 25, 'HR');If you're inserting multiple rows, you use a list of values:
INSERT INTO Employees (Name, Age, Department)
VALUES ('Jane', 25, 'HR'),
('Bob', 30, 'Engineering');Sometimes, in more advanced SQL syntax or in database systems that support "DEFAULT VALUES,".
| Context | Example SQL Syntax | Explanation |
|---|---|---|
| Insert data | INSERT INTO tbl (col1, col2) VALUES (1, 'A'); |
"VALUES" introduces new row data |
| Multi-row insert | VALUES (1, 'A'), (2, 'B') |
Each group provides a set of column data |
The word "value" by itself isn't a reserved SQL keyword in most dialects, but "VALUES" is crucial in data manipulation and inserts.
In expressions and clauses, you may see "value" in function arguments or column references but not as a reserved keyword.
In alaSQL we got VALUE OF SELECT xxx
Can you please look into how we can change the grammar so we can use value as a field name, meaning it knows that its not VALUE from VALUE OF and its not VALUES as from an insert statement? This way its a reserved keyword, but only in the context it needs to be.