Skip to content

SQLite: Fix parsing of INSERT DEFAULT VALUES syntax #4010

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 2, 2025

Conversation

kyleconroy
Copy link
Collaborator

Summary

This PR fixes issue #3998 where SQLite's parser couldn't handle the valid SQL syntax INSERT INTO table DEFAULT VALUES.

Problem

The SQLite parser was incorrectly structured, with DEFAULT VALUES as an alternative to the entire INSERT statement rather than as a valid option within the INSERT INTO clause. This caused the parser to fail with:

no viable alternative at input 'workspace DEFAULT'

Solution

  1. Updated ANTLR Grammar: Moved DEFAULT VALUES to be a proper option within the INSERT statement structure in SQLiteParser.g4
  2. Added Converter Support: Updated convert.go to detect and handle the DEFAULT VALUES case, creating an appropriate AST structure
  3. Regenerated Parser: Used ANTLR 4.13.1 to regenerate the parser from the updated grammar

Test Plan

  • Added a new end-to-end test case insert_default_values that verifies the syntax works correctly
  • Verified all existing SQLite INSERT tests still pass
  • Manually tested that INSERT INTO workspace DEFAULT VALUES now generates valid Go code

Fixes #3998

🤖 Generated with Claude Code

This commit fixes issue #3998 where SQLite's parser couldn't handle
the valid SQL syntax "INSERT INTO table DEFAULT VALUES".

The fix involves:
1. Updating the ANTLR grammar to properly support DEFAULT VALUES
   as part of the INSERT statement structure
2. Adding handling in convert.go for the DEFAULT VALUES case
3. Regenerating the parser from the updated grammar

Fixes #3998

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. 🔧 golang labels Jul 2, 2025
@kyleconroy kyleconroy merged commit b34aa37 into main Jul 2, 2025
7 checks passed
@kyleconroy kyleconroy deleted the fix-sqlite-default-values branch July 2, 2025 00:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size:M This PR changes 30-99 lines, ignoring generated files. 🔧 golang
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DEFAULT VALUES doesn't work on sqlite
1 participant