Expand description
Abstract Syntax Tree (AST) types for SQL parser
This module defines the AST node types that represent parsed SQL statements and expressions.
Structs§
- Aliased
Expression - Aliased expression (expr AS alias)
- AllAny
Expression - ALL/ANY/SOME subquery expression (e.g., x > ALL (SELECT …))
- Alter
Table Statement - ALTER TABLE statement
- Analyze
Statement - ANALYZE statement for collecting table statistics
- AsOf
Clause - AS OF clause for temporal queries
- Begin
Statement - BEGIN statement
- Between
Expression - BETWEEN expression
- Boolean
Literal - Boolean literal
- Case
Expression - CASE expression
- Cast
Expression - CAST expression
- Column
Definition - Column definition
- Commit
Statement - COMMIT statement
- Common
Table Expression - Common Table Expression
- Create
Index Statement - CREATE INDEX statement
- Create
Table Statement - CREATE TABLE statement
- Create
View Statement - CREATE VIEW statement
- CteReference
- CTE reference
- Default
Expression - DEFAULT keyword expression (for INSERT VALUES)
- Delete
Statement - DELETE statement
- Describe
Statement - DESCRIBE statement - shows table structure
- Distinct
Expression - DISTINCT expression
- Drop
Index Statement - DROP INDEX statement
- Drop
Table Statement - DROP TABLE statement
- Drop
View Statement - DROP VIEW statement
- Exists
Expression - EXISTS expression
- Explain
Statement - EXPLAIN statement
- Expression
List - Expression list (for IN values)
- Expression
Statement - Expression statement (standalone expression)
- Float
Literal - Float literal
- Foreign
KeyTable Constraint - Fields for a table-level FOREIGN KEY constraint (boxed to reduce TableConstraint enum size)
- Function
Call - Function call
- Function
Table Source - Function table source (table-valued function in FROM clause) e.g., SELECT * FROM generate_series(1, 10) AS gs(value)
- Group
ByClause - GROUP BY clause with optional ROLLUP/CUBE modifier
- Identifier
- Identifier (column name, table name, etc.)
- InExpression
- IN expression
- InHash
SetExpression - Pre-computed IN expression with HashSet for O(1) lookup
- Infix
Expression - Infix expression (a + b, a = b)
- Insert
Statement - INSERT statement
- Integer
Literal - Integer literal
- Interval
Literal - INTERVAL literal
- Join
Table Source - Join table source
- Like
Expression - LIKE expression with optional ESCAPE clause
- List
Expression - List expression (for IN clause values)
- Null
Literal - NULL literal
- Order
ByExpression - ORDER BY expression
- Parameter
- Parameter ($1, ?)
- Pragma
Statement - PRAGMA statement
- Prefix
Expression - Prefix expression (-x, NOT x)
- Program
- Program (collection of statements)
- Qualified
Identifier - Qualified identifier (table.column)
- Qualified
Star Expression - Qualified star expression (table.*)
- Release
Savepoint Statement - RELEASE SAVEPOINT statement
- Rollback
Statement - ROLLBACK statement
- Savepoint
Statement - SAVEPOINT statement
- Scalar
Subquery - Scalar subquery
- Select
Statement - SELECT statement
- SetOperation
- Set operation combining two SELECT statements
- SetStatement
- SET statement
- Show
Create Table Statement - SHOW CREATE TABLE statement
- Show
Create View Statement - SHOW CREATE VIEW statement
- Show
Indexes Statement - SHOW INDEXES statement
- Show
Tables Statement - SHOW TABLES statement
- Show
Views Statement - SHOW VIEWS statement
- Simple
Table Source - Simple table source
- Star
Expression - Star expression (*)
- String
Literal - String literal
- Subquery
Table Source - Subquery table source
- Truncate
Statement - TRUNCATE TABLE statement
- Update
Statement - UPDATE statement
- Vacuum
Statement - VACUUM statement — triggers manual cleanup of deleted rows and index compaction
- Values
Table Source - VALUES table source (e.g., VALUES (1, ‘a’), (2, ‘b’) AS t(col1, col2))
- When
Clause - WHEN clause in CASE expression
- Window
Definition - Named window definition (WINDOW w AS (…))
- Window
Expression - Window expression
- Window
Frame - Window frame specification
- With
Clause - WITH clause
Enums§
- AllAny
Type - ALL/ANY comparison type
- Alter
Table Operation - ALTER TABLE operation type
- Column
Constraint - Column constraint
- Column
OrConstraint - Helper enum for parsing - either a column definition or a table constraint
- Expression
- Expression enum representing all expression types
- Group
ByModifier - Group by modifier (ROLLUP, CUBE, GROUPING SETS, or none)
- Index
Method - Index type for USING clause
- Infix
Operator - Infix operator type (pre-computed at parse time for zero-allocation evaluation) This is a key optimization: instead of string comparison for every row, we match on a small enum which is faster and allocation-free.
- Prefix
Operator - Prefix operator type (pre-computed at parse time)
- SetOperation
Type - Set operation type for compound queries
- Statement
- Statement enum representing all statement types
- Table
Constraint - Table-level constraint (applied to the table rather than a single column)
- Window
Frame Bound - Window frame bound
- Window
Frame Unit - Window frame unit
Traits§
- Node
- Node trait - base for all AST nodes