Skip to main content

Module parser

Module parser 

Source
Expand description

SQL parsing with mz_sql_parser.

Wraps mz_sql_parser to parse .sql files into AST statements, attaching file-path context to error messages so that parse failures point back to the originating source file.

ยงVariable Resolution and Parsing

parse_statements_with_context runs variable resolution before parsing:

  1. Resolve psql-style variables (:foo, :'foo', :"foo") via super::variables::resolve_variables
  2. Check for unresolved variables โ€” error or warning based on pragma
  3. Parse the resolved SQL via mz_sql_parser
  4. Wrap any parse errors with file path and SQL content for context

Structsยง

LocatedStatement
A parsed SQL statement paired with its byte offset within the source file.

Functionsยง

parse_statements_with_context ๐Ÿ”’
Parse SQL statements and add file context to any errors.
statement_type_name ๐Ÿ”’
Get a human-readable name for a statement type.