Skip to content

bug: two oracle divergences the parser tickets left behind (#696/#698 scope gaps) #725

Description

@dpsiderius

Both live in src/parser/, both are that ticket's own stated scope rather than
new work, and one PR closes both.

2a — an unterminated block comment is rejected where SQLite ignores it.

input: "/* unterminated"                     oracle rc=0    ours rc=1
input: "CREATE TABLE t(a); /* unterminated"   oracle rc=0    ours rc=1

In the second case the table IS created by both engines, so we do the work and
then report failure — the worst combination for a script runner. Same on
origin/main: PR #713 fixed five comment forms and left this sixth diverging.
Tokenizer::tokenize emits a TokenKind::Error for an unterminated comment and
skip_leading_trivia does not treat that span as trivia, so the fragment
survives as a bogus statement.

2b — bare aliases without AS reject all 89 fallback keywords. PR #714
accepts them via AS but disables them for bare aliases entirely, because
allowing them broke NATURAL JOIN/LEFT JOIN. Correct for the ~7 join
keywords, overbroad for the other ~82:

SELECT key.a FROM t key      oracle: 7                      ours: syntax error
SELECT first.a FROM t first  oracle: 7                      ours: syntax error
SELECT left.a FROM t left    oracle: error (join keyword)    ours: error   (correct)

Verified for key first row match glob like offset view temp. #696's own
acceptance criteria asked for all 89 to work as aliases.

Scope: an unterminated block comment is trivia to end-of-input, keeping
test_malformed_input_never_panics passing and comments inside string literals
literal. Permit fallback keywords as bare aliases except the join keywords
(CROSS FULL INNER LEFT NATURAL OUTER RIGHT), matching parse.y's precedence.
Correct .openspec/grammar/sqlite.ebnf, whose result-column/table-ref rules
permit a bare identifier (now including fallback-keyword) without encoding
the AS-only carve-out the code enforces; make check-grammar-drift must pass.
Oracle-diff both comment forms, an unterminated comment mid-script and inside a
string literal, and each of the 89 words as a bare alias.

Note: 2b's fully-qualified form (SELECT key.a FROM t key) cannot be tested
end to end until ticket 1b lands, since alias-qualified references fail for a
plain alias too. The unqualified form (SELECT a FROM t key) is testable now.

Complexity

Estimate: small-medium
Reasoning:

Refs: 002/Req-1, 002/Req-2, #696, #698, #713, #714

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions