Skip to content

TUR-315: Cypher: accept every keyword as a map key or a property name - #1187

Open
sulaimansuhas wants to merge 1 commit into
mainfrom
fix/add-reserved-keywords
Open

sulaimansuhas wants to merge 1 commit into
mainfrom
fix/add-reserved-keywords

Conversation

@sulaimansuhas

Copy link
Copy Markdown
Contributor

Accept every keyword as a map key or a property name.

@sulaimansuhas
sulaimansuhas requested a review from rjb32 as a code owner October 23, 2026 12:55
@sulaimansuhas

Copy link
Copy Markdown
Contributor Author

Note

AI-generated summary.

Summary

Goal. Let a keyword the engine uses for its own statements stand as a map key, a property key or a label. {from: 1}, n.graph and :Graph were syntax errors. Part of TUR-243, tracked as TUR-315.

Approach. One grammar change: 23 keyword tokens join reservedWord, which name already accepts beside symbol. Every rule that takes a name (map pairs, property access, labels) accepts them with no change of its own. Variable names go through symbol, so MATCH (s3:Supplier) is unchanged and stays open in TUR-243.

Where to look.

  • query/parser/CypherParser.y:2265 reservedWord — the 23 added tokens; check none should stay reserved.
  • query/parser/CypherParser.y:2212 name — why adding to reservedWord reaches map keys, property keys and labels.

Grammar: 23 keyword tokens join reservedWord, which feeds name, which map keys, property keys and labels use

Open the animated diagram

 name
     : symbol
     | reservedWord

 reservedWord
     : PROCEDURES
+    | MERGE_DATAPARTS | SHORTESTPATH | EMBEDDINGS | DIMENSION | CONNECT | INDEXES | PARQUET
+    | COSINE | EUCLID | METRIC | REDUCE | SEARCH | VECTOR | GRAPH | INDEX | FLAT | FROM
+    | HNSW | LOAD | PULL | PUSH | GML | S3
     ...

The grammar keeps %expect 0: bison reports no new conflict, because each token only reaches name where a name is expected.

Evidence

  • Before: UNWIND [1] AS x WITH x WHERE {from: 1} = {from: 1} RETURN count(x) → syntax error, unexpected FROM
    After: 1
  • Before: CREATE (:Tagged {from: 'a', graph: 'b', index: 3}) → syntax error
    After: MATCH (n:Tagged {from: 'a'}) RETURN n.from, n.graph, n.index → a, b, 3

test_query_ir_keyword_name (test/query/ir/map/KeywordNameTest.cpp): 4/4 pass. The statements that use these tokens as keywords still parse: the 78 vector, load and call tests pass. Full ctest: 864/864 on this commit alone, 894/894 with the stack on f1dac52a.

Merge Danger

Door: two-way

Grammar only. Reverting restores the old rejections.

Blast Radius: parser

A query that used one of these words where a name is expected now parses instead of failing. No query that parsed before changes meaning.

@sulaimansuhas
sulaimansuhas added this pull request to stack #1193 October 23, 2026 13:53
@sulaimansuhas
sulaimansuhas force-pushed the fix/add-reserved-keywords branch from e98a1c2 to f29720d Compare October 23, 2026 13:54

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants