Skip to content

Refuse the write and transaction statements by name - #211

Merged
tamnd merged 1 commit into
mainfrom
refuse-the-write-statements-by-name
Aug 16, 2026
Merged

tamnd merged 1 commit into
mainfrom
refuse-the-write-statements-by-name

Conversation

@tamnd

@tamnd tamnd commented Aug 16, 2026

Copy link
Copy Markdown
Owner

First piece of G3 (#118), and it is a message fix rather than a feature.

The reserved keyword list in the parser exists so that a statement the v0 core does not parse is turned away by name, and the comment above it says exactly that. It was missing the statement most likely to be typed. GQL spells element creation INSERT, CREATE is the Cypher spelling of something GQL does not have, and only CREATE was in the list. Writing INSERT (x:Person {name: 'Zoe'}) came back with expected MATCH, OPTIONAL MATCH, CALL, UNWIND, WITH, or RETURN, which sends a reader hunting for a typo in a statement they spelled correctly.

This adds INSERT, REMOVE, START, COMMIT, ROLLBACK, SESSION, FINISH and FOR next to the keywords already there. Nothing new parses and no conformance case changes outcome. Eleven cases that were failing on a misleading message now fail on an accurate one: the gd01, gd02 and gd04 write cases, performance/write/insert-one-node and gq10/for-over-list all name the statement they are waiting on, which is where G3 and G8 will pick them up.

Two tests. One walks every reserved statement and checks the refusal names the keyword. The other guards the risk the change carries: ORDER, SKIP and LIMIT belong to the projection in front of them, so reserving keywords at the head of a clause must not reach inside a RETURN that is parsing normally.

cargo fmt --check, cargo clippy -p zu-query --all-targets and cargo test --workspace are green.

The reserved keyword list exists so that a statement the v0 core does not parse is turned away by name, and its comment says as much, but the list was missing the one statement most likely to be typed. GQL spells element creation INSERT, CREATE is the Cypher spelling of something GQL does not have, and only CREATE was listed. So INSERT (x:Person {name: 'Zoe'}) came back as expected MATCH, OPTIONAL MATCH, CALL, UNWIND, WITH, or RETURN, which sends a reader looking for a typo in a statement they spelled correctly.

Adds INSERT, REMOVE, START, COMMIT, ROLLBACK, SESSION, FINISH and FOR alongside the keywords already there. Nothing new parses and no case changes outcome; eleven conformance cases that were failing on a misleading message now fail on an accurate one, which is where G3 and G8 will pick them up.

Two tests. One walks every reserved statement and checks the refusal names the keyword. The other guards the risk the change carries: ORDER, SKIP and LIMIT belong to the projection in front of them, so reserving keywords at the head of a clause must not reach inside a RETURN that is parsing normally.
@tamnd
tamnd merged commit a5903cd into main Aug 16, 2026
28 checks passed
@tamnd
tamnd deleted the refuse-the-write-statements-by-name branch August 16, 2026 01:39
@tamnd tamnd mentioned this pull request Aug 16, 2026
32 tasks
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.

1 participant