Skip to main content

Module ast

Module ast 

Source
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§

AliasedExpression
Aliased expression (expr AS alias)
AllAnyExpression
ALL/ANY/SOME subquery expression (e.g., x > ALL (SELECT …))
AlterTableStatement
ALTER TABLE statement
AnalyzeStatement
ANALYZE statement for collecting table statistics
AsOfClause
AS OF clause for temporal queries
BeginStatement
BEGIN statement
BetweenExpression
BETWEEN expression
BooleanLiteral
Boolean literal
CaseExpression
CASE expression
CastExpression
CAST expression
ColumnDefinition
Column definition
CommitStatement
COMMIT statement
CommonTableExpression
Common Table Expression
CreateIndexStatement
CREATE INDEX statement
CreateTableStatement
CREATE TABLE statement
CreateViewStatement
CREATE VIEW statement
CteReference
CTE reference
DefaultExpression
DEFAULT keyword expression (for INSERT VALUES)
DeleteStatement
DELETE statement
DescribeStatement
DESCRIBE statement - shows table structure
DistinctExpression
DISTINCT expression
DropIndexStatement
DROP INDEX statement
DropTableStatement
DROP TABLE statement
DropViewStatement
DROP VIEW statement
ExistsExpression
EXISTS expression
ExplainStatement
EXPLAIN statement
ExpressionList
Expression list (for IN values)
ExpressionStatement
Expression statement (standalone expression)
FloatLiteral
Float literal
ForeignKeyTableConstraint
Fields for a table-level FOREIGN KEY constraint (boxed to reduce TableConstraint enum size)
FunctionCall
Function call
FunctionTableSource
Function table source (table-valued function in FROM clause) e.g., SELECT * FROM generate_series(1, 10) AS gs(value)
GroupByClause
GROUP BY clause with optional ROLLUP/CUBE modifier
Identifier
Identifier (column name, table name, etc.)
InExpression
IN expression
InHashSetExpression
Pre-computed IN expression with HashSet for O(1) lookup
InfixExpression
Infix expression (a + b, a = b)
InsertStatement
INSERT statement
IntegerLiteral
Integer literal
IntervalLiteral
INTERVAL literal
JoinTableSource
Join table source
LikeExpression
LIKE expression with optional ESCAPE clause
ListExpression
List expression (for IN clause values)
NullLiteral
NULL literal
OrderByExpression
ORDER BY expression
Parameter
Parameter ($1, ?)
PragmaStatement
PRAGMA statement
PrefixExpression
Prefix expression (-x, NOT x)
Program
Program (collection of statements)
QualifiedIdentifier
Qualified identifier (table.column)
QualifiedStarExpression
Qualified star expression (table.*)
ReleaseSavepointStatement
RELEASE SAVEPOINT statement
RollbackStatement
ROLLBACK statement
SavepointStatement
SAVEPOINT statement
ScalarSubquery
Scalar subquery
SelectStatement
SELECT statement
SetOperation
Set operation combining two SELECT statements
SetStatement
SET statement
ShowCreateTableStatement
SHOW CREATE TABLE statement
ShowCreateViewStatement
SHOW CREATE VIEW statement
ShowIndexesStatement
SHOW INDEXES statement
ShowTablesStatement
SHOW TABLES statement
ShowViewsStatement
SHOW VIEWS statement
SimpleTableSource
Simple table source
StarExpression
Star expression (*)
StringLiteral
String literal
SubqueryTableSource
Subquery table source
TruncateStatement
TRUNCATE TABLE statement
UpdateStatement
UPDATE statement
VacuumStatement
VACUUM statement — triggers manual cleanup of deleted rows and index compaction
ValuesTableSource
VALUES table source (e.g., VALUES (1, ‘a’), (2, ‘b’) AS t(col1, col2))
WhenClause
WHEN clause in CASE expression
WindowDefinition
Named window definition (WINDOW w AS (…))
WindowExpression
Window expression
WindowFrame
Window frame specification
WithClause
WITH clause

Enums§

AllAnyType
ALL/ANY comparison type
AlterTableOperation
ALTER TABLE operation type
ColumnConstraint
Column constraint
ColumnOrConstraint
Helper enum for parsing - either a column definition or a table constraint
Expression
Expression enum representing all expression types
GroupByModifier
Group by modifier (ROLLUP, CUBE, GROUPING SETS, or none)
IndexMethod
Index type for USING clause
InfixOperator
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.
PrefixOperator
Prefix operator type (pre-computed at parse time)
SetOperationType
Set operation type for compound queries
Statement
Statement enum representing all statement types
TableConstraint
Table-level constraint (applied to the table rather than a single column)
WindowFrameBound
Window frame bound
WindowFrameUnit
Window frame unit

Traits§

Node
Node trait - base for all AST nodes