Repository navigation
Description
Many keywords that are common field names cannot be used as names in AlaSQL, while SQLite (our reference engine) accepts them. This issue collects the ones that should only need to be added to the NonReserved rule and the nonReserved list in src/alasqlparser.jison, the same way as earlier:
- Fix VALUE/VALUES as context-aware keywords - allow use as identifiers #2203
VALUE,VALUES,LEFT,RIGHT(for VALUE(S) should only be a reserved keyword in the right context #2202) - Make ORDER a context-aware keyword #2383
ORDER, Make KEY keyword usable as identifier in column and table names #2387KEY, Verify PATH keyword already works as identifier via NonReserved list #2382PATH, Add test coverage for SOURCE keyword - no grammar changes needed #2381SOURCE - Make DEFAULT keyword non-reserved in identifier contexts #2385
DEFAULT(closed, not merged)
It continues the per-keyword series (#2212 to #2261). The words in the second issue start something valid where a name stands (COUNT(, SELECT TOP), so they need a grammar change instead (#2628).
Measured on develop (3c08bbf)
Each word as a name in five places: CREATE TABLE t (w INT), SELECT w FROM t, WHERE w = 1, t.w and data->w. Every word below fails in all five in AlaSQL and works in SQLite 3.43 in all three places tested there.
| Word | Series issue |
|---|---|
target |
#2216 |
temp |
#2215 |
search |
#2221, #2257 |
plan |
#2253 |
graph |
#2249 |
remove |
#2255 |
call |
#2245 |
timeout |
#2260 |
trigger |
#2214 |
identity |
#2229 |
rename |
#2254 |
show |
#2258 |
by |
#2240 |
grouping |
#2230 |
query, store, no, rows, class, percent, offset, print, repeat, return, merge, edge, vertex, enum |
none |
output, go (these two fail only right after SELECT) |
none |
Direction
Add the words to both lists, one at a time, and test each one in the five places. A word that causes a new grammar conflict or breaks an existing test moves to #2628. grouping, percent, offset and go are the ones most likely to need more than the list.
The grammar warnings must stay at 282, and yarn jison must reproduce the committed parser.
This only accepts SQL that fails to parse today, so it is not breaking.
Already done, or not to do
- Already work in all five places, so their issues can be closed:
workLimit the impact of using the keyword: WORK #2212,transactionLimit the impact of using the keyword: TRANSACTION #2213,asciiLimit the impact of using the keyword: ASCII #2243,nextLimit the impact of using the keyword: NEXT #2252,leftLimit the impact of using the keyword: LEFT #2225 andrightLimit the impact of using the keyword: RIGHT #2256 (by Fix VALUE/VALUES as context-aware keywords - allow use as identifiers #2203). - Reserved in SQLite too, so they stay reserved and the answer is
[name]or`name`:setLimit the impact of using the keyword: Set #2219,selectLimit the impact of using the keyword: SELECT #2220,indexLimit the impact of using the keyword: INDEX #2228,groupLimit the impact of using the keyword: GROUP #2231,fromLimit the impact of using the keyword: FROM #2232,existsLimit the impact of using the keyword: EXISTS #2234,exceptLimit the impact of using the keyword: EXCEPT #2235,defaultLimit the impact of using the keyword: DEFAULT #2238,allLimit the impact of using the keyword: ALL #2241,betweenLimit the impact of using the keyword: BETWEEN #2244,caseLimit the impact of using the keyword: CASE #2247,tableLimit the impact of using the keyword: TABLE #2259,toLimit the impact of using the keyword: TO #2261.order(Limit the impact of using the keyword: ORDER #2223, closed by Make ORDER a context-aware keyword #2383) still fails right afterSELECT, as in SQLite.
Tests: test/test<id>.js with one it per word, covering the five places, plus INSERT INTO t (w) VALUES (1) and an ORDER BY w.
Activity
Make TARGET, TEMP, PLAN, CALL and SHOW context-aware keywords to close …