Module mz_sql::ast

source · []
Expand description

SQL abstract syntax tree.

Modules

Transformation of an owned AST.

Provides a publicly available interface to transform our SQL ASTs.

Traversal of an immutable AST.

Traversal of a mutable AST.

Structs

ALTER INDEX ... {RESET, SET}

ALTER <OBJECT> ... RENAME TO

ALTER SECRET ... AS

SQL assignment foo = expr as used in SQLUpdate

CLOSE ...

SQL column definition

An optionally-named ColumnOption: [ CONSTRAINT <name> ] <column-option>.

COMMIT [ TRANSACTION | WORK ] [ AND [ NO ] CHAIN ]

CREATE CLUSTER REPLICA ..

CREATE CLUSTER ..

CREATE CONNECTION

CREATE DATABASE

A CREATE ROLE statement.

CREATE SCHEMA

A CREATE SECRET statement.

CREATE SOURCE

CREATE TYPE ..

A single CTE (used after WITH): alias [(col1, col2, ...)] AS ( query ) The names in the column list before AS, when specified, replace the names of the columns returned by the query. The parser does not validate that the number of columns in the query matches the number of columns in the query.

DEALLOCATE ...

DECLARE ...

EXECUTE ...

FETCH ...

A function call

An identifier.

An intermediate value for Intervals, which tracks all data from the user, as well as the computed ParsedDateTime.

A reference to an operator.

SQL ORDER BY expression

Information about upstream Postgres tables used for replication sources

PREPARE ...

The most complete variant of a SELECT query expression, optionally including WITH, UNION / other set operations, and ORDER BY.

RAISE ...

An option in a CREATE CLUSTER or CREATE CLUSTER REPLICA statement.

RESET <variable>

ROLLBACK [ TRANSACTION | WORK ] [ AND [ NO ] CHAIN ]

A restricted variant of SELECT (without CTEs/ORDER BY), which may appear either as the only body item of an SQLQuery, or as an operand to a set operation like UNION.

SET TRANSACTION ...

SET <variable>

SHOW CREATE INDEX <index>

SHOW CREATE SINK <sink>

SHOW CREATE SOURCE <source>

SHOW CREATE TABLE <table>

SHOW CREATE VIEW <view>

SHOW DATABASES

SHOW INDEX|INDEXES|KEYS

SHOW <object>S

SHOW <variable>

{ BEGIN [ TRANSACTION | WORK ] | START TRANSACTION } ...

A name of a database

A name of a table, view, custom type, etc., possibly multi-part, i.e. db.schema.obj

A name of a schema

Specifies the data processed by a window function, e.g. RANGE UNBOUNDED PRECEDING or ROWS BETWEEN 5 PRECEDING AND CURRENT ROW.

A window specification (i.e. OVER (PARTITION BY .. ORDER BY .. etc.))

Enums

An option in a CREATE CLUSTER statement.

ColumnOptions are modifiers that follow a column definition in a CREATE TABLE statement.

Options that can be attached to CreateRoleStatement.

CREATE TYPE .. AS <TYPE>

Specifies what Statement::Explain is actually explaining

An SQL expression of any type.

Arguments for a function call.

An option in a CREATE CLUSTER statement.

A key constraint, specified in a CREATE SOURCE.

SQL data types

The key sources specified in the S3 source’s DISCOVER OBJECTS clause.

One item of the comma-separated list following SELECT

A node in a tree, representing a “query body” expression, roughly: SELECT ... [ {UNION|EXCEPT|INTERSECT} SELECT ...]

A top-level statement (SELECT, INSERT, CREATE, etc.)

A table-level constraint, specified in a CREATE TABLE or an ALTER TABLE ADD <constraint> statement.

A table name or a parenthesized subquery with an optional alias

Primitive SQL values.

Specifies WindowFrame’s start_bound and end_bound

Traits

This represents the metadata that lives next to an AST, as we take it through various stages in the planning process.