Module sqlparser::ast

source ·
Expand description

SQL Abstract Syntax Tree (AST) types

Modules

Structs

  • Represents an Array Expression, either ARRAY[..], or [..]
  • An ARRAY_AGG invocation ARRAY_AGG( [ DISTINCT ] <expr> [ORDER BY <expr>] [LIMIT <n>] ) Or ARRAY_AGG( [ DISTINCT ] <expr> ) [ WITHIN GROUP ( ORDER BY <expr> ) ] ORDER BY position is defined differently for BigQuery, Postgres and Snowflake.
  • SQL assignment foo = expr as used in SQLUpdate
  • SQL column definition
  • An optionally-named ColumnOption: [ CONSTRAINT <name> ] <column-option>.
  • Postgres specific feature.
  • 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.
  • Function describe in DROP FUNCTION.
  • Bigquery EXCEPT information, with at least one column.
  • A function call
  • An identifier, decomposed into its value or character data and the quote style.
  • Single aliased identifier
  • Represents an INTERVAL expression, roughly in the following format: INTERVAL '<value>' [ <leading_field> [ (<leading_precision>) ] ] [ TO <last_field> [ (<fractional_seconds_precision>) ] ], e.g. INTERVAL '123:45.67' MINUTE(3) TO SECOND(2).
  • A single column definition in MySQL’s JSON_TABLE table valued function.
  • A hive LATERAL VIEW with potential column aliases
  • A LISTAGG invocation LISTAGG( [ DISTINCT ] <expr>[, <separator> ] [ON OVERFLOW <on_overflow>] ) ) [ WITHIN GROUP (ORDER BY <within_group1>[, ...] ) ]
  • NAME = <EXPR> arguments for DuckDB macros
  • A name of a table, view, custom type, etc., possibly multi-part, i.e. db.schema.obj
  • Function argument in CREATE OR DROP FUNCTION.
  • An ORDER BY expression
  • PARTITION statement used in ALTER TABLE et al. such as in Hive SQL
  • The most complete variant of a SELECT query expression, optionally including WITH, UNION / other set operations, and ORDER BY.
  • Syntax
  • Bigquery REPLACE information.
  • A restricted variant of SELECT (without CTEs/ORDER BY), which may appear either as the only body item of a Query, or as an operand to a set operation like UNION.
  • A field definition within a struct.
  • SQL user defined type attribute definition
  • Additional options for wildcards, e.g. Snowflake EXCLUDE/RENAME and Bigquery EXCEPT.
  • 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

Traits

  • A type that can be visited by a Visitor. See Visitor for recursively visiting parsed SQL statements.
  • A type that can be visited by a VisitorMut. See VisitorMut for recursively visiting parsed SQL statements.
  • A visitor that can be used to walk an AST tree.
  • A visitor that can be used to mutate an AST tree.

Functions

  • Invokes the provided closure on all expressions (e.g. 1 + 2) present in v
  • Invokes the provided closure iteratively with a mutable reference to all expressions present in v.
  • Invokes the provided closure on all relations (e.g. table names) present in v
  • Invokes the provided closure with a mutable reference to all relations (e.g. table names) present in v.
  • Invokes the provided closure iteratively with a mutable reference to all statements present in v (e.g. SELECT, CREATE TABLE, etc).
  • Invokes the provided closure on all statements (e.g. SELECT, CREATE TABLE, etc) present in v