Skip to content

V-L2-A1: replace hand-rolled SQL DDL parser with sqlparser crate #38

@hyperpolymath

Description

@hyperpolymath

Context

src/codegen/parser.rs::parse_sql_schema is a hand-rolled string scanner: uppercase + split on ; + comma-with-paren-respect. It misclassifies CHECK constraints, schema-qualified names, generated columns, quoted identifiers with whitespace, and any DDL containing semicolons inside comments.

What to do

Replace with the sqlparser crate (sqlparser = "0.50") using its Postgres + SQLite dialects. Migrate the existing ParsedSchema / TableDef / ColumnDef IR by walking sqlparser::ast::Statement::CreateTable. Drop split_respecting_parens.

Acceptance

  • sqlparser dependency added
  • Existing tests pass
  • New tests: schema-qualified names (s.t), quoted identifiers with spaces, CHECK clauses, GENERATED columns

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions