Expand description
SQL Abstract Syntax Tree (AST) types
Modules§
- data_
type π - ddl πAST types specific to CREATE/ALTER variants of
crate::ast::Statement
(commonly referred to as Data Definition Language, or DDL) - legacy_
source πContent of this file can be deleted once we stop supportingcreate source
syntax v1. New features shall NOT touch this file. - operator π
- query π
- statement π
- value π
Macros§
Structs§
- For array type
ARRAY[..]
or[..]
- SQL assignment
foo = { expr | DEFAULT }
as used in SQLUpdate - String literal. The difference with String is that it is displayed with single-quotes.
- SQL column definition
- An optionally-named
ColumnOption
:[ CONSTRAINT <name> ] <column-option>
. CORRESPONDING [ BY <left paren> <corresponding column list> <right paren> ]
- Postgres specific feature.
- A single CTE (used after
WITH
):alias [(col1, col2, ...)] AS ( query )
- An escape character, to represent ββ or a single character.
FORMAT ... ENCODE ... [(a=b, ...)] [KEY ENCODE ...]
- A function call
- A list of function arguments, including additional modifiers like
DISTINCT
orORDER BY
. This basically holds all the information between the(
and)
in a function call. - Function describe in DROP FUNCTION.
- An identifier, decomposed into its value or character data and the quote style.
- A hive LATERAL VIEW with potential column aliases
- A name of a table, view, custom type, etc., possibly multi-part, i.e. db.schema.obj
- Function argument in CREATE FUNCTION.
- An
ORDER BY
expression - Qualified custom operator https://www.postgresql.org/docs/15/sql-expressions.html#SQL-EXPRESSIONS-OPERATOR-CALLS
- The most complete variant of a
SELECT
query expression, optionally includingWITH
,UNION
/ other set operations, andORDER BY
. - A restricted variant of
SELECT
(without CTEs/ORDER BY
), which may appear either as the only body item of anSQLQuery
, or as an operand to a set operation likeUNION
. - The watermark on source.
WATERMARK FOR <column> AS (<expr>)
- Table column definition
- Specifies the data processed by a window function, e.g.
RANGE UNBOUNDED PRECEDING
orROWS BETWEEN 5 PRECEDING AND CURRENT ROW
. - A window specification (i.e.
OVER (PARTITION BY .. ORDER BY .. etc.)
)
Enums§
- A privilege on a database object (table, sequence, etc.).
- An
ALTER COLUMN
(Statement::AlterTable
) operation - An
ALTER TABLE
(Statement::AlterTable
) operation - The mode of an argument in CREATE FUNCTION.
- This trait is used to replace
Option
becausefmt::Display
can not be implemented forOption<T>
. - Binary operators
ColumnOption
s are modifiers that follow a column definition in aCREATE TABLE
statement.- Return types of a function.
- SQL data types
- An
ALL
,DISTINCT
orDISTINCT ON (expr, ...)
afterSELECT
. - Function describe in DROP FUNCTION.
- Check
CONNECTORS_COMPATIBLE_FORMATS
for whatFORMAT ... ENCODE ...
combinations are allowed. - An SQL expression of any type.
- FORMAT means how to get the operation(Insert/Delete) from the input.
- These attributes inform the query optimizer about the behavior of the function.
- Objects on which privileges are granted in a GRANT statement.
- Privileges granted in a GRANT statement or revoked in a REVOKE statement.
<referential_action> = { RESTRICT | CASCADE | SET NULL | NO ACTION | SET DEFAULT }
- 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 anALTER TABLE ADD <constraint>
statement. - A table name or a parenthesized subquery with an optional alias
- Unary operators
- Primitive SQL values such as number and string
- Frame exclusion option of WindowFrame.
Statics§
Traits§
- Consumes token from the parser into an AST node.