Enum sqlparser::ast::Statement

source ·
pub enum Statement {
Show 80 variants Analyze { table_name: ObjectName, partitions: Option<Vec<Expr>>, for_columns: bool, columns: Vec<Ident>, cache_metadata: bool, noscan: bool, compute_statistics: bool, }, Truncate { table_name: ObjectName, partitions: Option<Vec<Expr>>, table: bool, }, Msck { table_name: ObjectName, repair: bool, partition_action: Option<AddDropSync>, }, Query(Box<Query>), Insert(Insert), Install { extension_name: Ident, }, Load { extension_name: Ident, }, Directory { overwrite: bool, local: bool, path: String, file_format: Option<FileFormat>, source: Box<Query>, }, Call(Function), Copy { source: CopySource, to: bool, target: CopyTarget, options: Vec<CopyOption>, legacy_options: Vec<CopyLegacyOption>, values: Vec<Option<String>>, }, CopyIntoSnowflake { into: ObjectName, from_stage: ObjectName, from_stage_alias: Option<Ident>, stage_params: StageParamsObject, from_transformations: Option<Vec<StageLoadSelectItem>>, files: Option<Vec<String>>, pattern: Option<String>, file_format: DataLoadingOptions, copy_options: DataLoadingOptions, validation_mode: Option<String>, }, Close { cursor: CloseCursor, }, Update { table: TableWithJoins, assignments: Vec<Assignment>, from: Option<TableWithJoins>, selection: Option<Expr>, returning: Option<Vec<SelectItem>>, }, Delete(Delete), CreateView { or_replace: bool, materialized: bool, name: ObjectName, columns: Vec<ViewColumnDef>, query: Box<Query>, options: CreateTableOptions, cluster_by: Vec<Ident>, with_no_schema_binding: bool, if_not_exists: bool, temporary: bool, }, CreateTable {
Show 31 fields or_replace: bool, temporary: bool, external: bool, global: Option<bool>, if_not_exists: bool, transient: bool, name: ObjectName, columns: Vec<ColumnDef>, constraints: Vec<TableConstraint>, hive_distribution: HiveDistributionStyle, hive_formats: Option<HiveFormat>, table_properties: Vec<SqlOption>, with_options: Vec<SqlOption>, file_format: Option<FileFormat>, location: Option<String>, query: Option<Box<Query>>, without_rowid: bool, like: Option<ObjectName>, clone: Option<ObjectName>, engine: Option<String>, comment: Option<String>, auto_increment_offset: Option<u32>, default_charset: Option<String>, collation: Option<String>, on_commit: Option<OnCommit>, on_cluster: Option<String>, order_by: Option<Vec<Ident>>, partition_by: Option<Box<Expr>>, cluster_by: Option<Vec<Ident>>, options: Option<Vec<SqlOption>>, strict: bool,
}, CreateVirtualTable { name: ObjectName, if_not_exists: bool, module_name: Ident, module_args: Vec<Ident>, }, CreateIndex { name: Option<ObjectName>, table_name: ObjectName, using: Option<Ident>, columns: Vec<OrderByExpr>, unique: bool, concurrently: bool, if_not_exists: bool, include: Vec<Ident>, nulls_distinct: Option<bool>, predicate: Option<Expr>, }, CreateRole {
Show 18 fields names: Vec<ObjectName>, if_not_exists: bool, login: Option<bool>, inherit: Option<bool>, bypassrls: Option<bool>, password: Option<Password>, superuser: Option<bool>, create_db: Option<bool>, create_role: Option<bool>, replication: Option<bool>, connection_limit: Option<Expr>, valid_until: Option<Expr>, in_role: Vec<Ident>, in_group: Vec<Ident>, role: Vec<Ident>, user: Vec<Ident>, admin: Vec<Ident>, authorization_owner: Option<ObjectName>,
}, CreateSecret { or_replace: bool, temporary: Option<bool>, if_not_exists: bool, name: Option<Ident>, storage_specifier: Option<Ident>, secret_type: Ident, options: Vec<SecretOption>, }, AlterTable { name: ObjectName, if_exists: bool, only: bool, operations: Vec<AlterTableOperation>, location: Option<HiveSetLocation>, }, AlterIndex { name: ObjectName, operation: AlterIndexOperation, }, AlterView { name: ObjectName, columns: Vec<Ident>, query: Box<Query>, with_options: Vec<SqlOption>, }, AlterRole { name: Ident, operation: AlterRoleOperation, }, AttachDatabase { schema_name: Ident, database_file_name: Expr, database: bool, }, AttachDuckDBDatabase { if_not_exists: bool, database: bool, database_path: Ident, database_alias: Option<Ident>, attach_options: Vec<AttachDuckDBDatabaseOption>, }, DetachDuckDBDatabase { if_exists: bool, database: bool, database_alias: Ident, }, Drop { object_type: ObjectType, if_exists: bool, names: Vec<ObjectName>, cascade: bool, restrict: bool, purge: bool, temporary: bool, }, DropFunction { if_exists: bool, func_desc: Vec<DropFunctionDesc>, option: Option<ReferentialAction>, }, DropSecret { if_exists: bool, temporary: Option<bool>, name: Ident, storage_specifier: Option<Ident>, }, Declare { stmts: Vec<Declare>, }, CreateExtension { name: Ident, if_not_exists: bool, cascade: bool, schema: Option<Ident>, version: Option<Ident>, }, Fetch { name: Ident, direction: FetchDirection, into: Option<ObjectName>, }, Flush { object_type: FlushType, location: Option<FlushLocation>, channel: Option<String>, read_lock: bool, export: bool, tables: Vec<ObjectName>, }, Discard { object_type: DiscardObject, }, SetRole { context_modifier: ContextModifier, role_name: Option<Ident>, }, SetVariable { local: bool, hivevar: bool, variable: ObjectName, value: Vec<Expr>, }, SetTimeZone { local: bool, value: Expr, }, SetNames { charset_name: String, collation_name: Option<String>, }, SetNamesDefault {}, ShowFunctions { filter: Option<ShowStatementFilter>, }, ShowVariable { variable: Vec<Ident>, }, ShowStatus { filter: Option<ShowStatementFilter>, global: bool, session: bool, }, ShowVariables { filter: Option<ShowStatementFilter>, global: bool, session: bool, }, ShowCreate { obj_type: ShowCreateObject, obj_name: ObjectName, }, ShowColumns { extended: bool, full: bool, table_name: ObjectName, filter: Option<ShowStatementFilter>, }, ShowTables { extended: bool, full: bool, db_name: Option<Ident>, filter: Option<ShowStatementFilter>, }, ShowCollation { filter: Option<ShowStatementFilter>, }, Use { db_name: Ident, }, StartTransaction { modes: Vec<TransactionMode>, begin: bool, modifier: Option<TransactionModifier>, }, SetTransaction { modes: Vec<TransactionMode>, snapshot: Option<Value>, session: bool, }, Comment { object_type: CommentObject, object_name: ObjectName, comment: Option<String>, if_exists: bool, }, Commit { chain: bool, }, Rollback { chain: bool, savepoint: Option<Ident>, }, CreateSchema { schema_name: SchemaName, if_not_exists: bool, }, CreateDatabase { db_name: ObjectName, if_not_exists: bool, location: Option<String>, managed_location: Option<String>, }, CreateFunction { or_replace: bool, temporary: bool, name: ObjectName, args: Option<Vec<OperateFunctionArg>>, return_type: Option<DataType>, params: CreateFunctionBody, }, CreateProcedure { or_alter: bool, name: ObjectName, params: Option<Vec<ProcedureParam>>, body: Vec<Statement>, }, CreateMacro { or_replace: bool, temporary: bool, name: ObjectName, args: Option<Vec<MacroArg>>, definition: MacroDefinition, }, CreateStage { or_replace: bool, temporary: bool, if_not_exists: bool, name: ObjectName, stage_params: StageParamsObject, directory_table_params: DataLoadingOptions, file_format: DataLoadingOptions, copy_options: DataLoadingOptions, comment: Option<String>, }, Assert { condition: Expr, message: Option<Expr>, }, Grant { privileges: Privileges, objects: GrantObjects, grantees: Vec<Ident>, with_grant_option: bool, granted_by: Option<Ident>, }, Revoke { privileges: Privileges, objects: GrantObjects, grantees: Vec<Ident>, granted_by: Option<Ident>, cascade: bool, }, Deallocate { name: Ident, prepare: bool, }, Execute { name: Ident, parameters: Vec<Expr>, using: Vec<Expr>, }, Prepare { name: Ident, data_types: Vec<DataType>, statement: Box<Statement>, }, Kill { modifier: Option<KillType>, id: u64, }, ExplainTable { describe_alias: DescribeAlias, hive_format: Option<HiveDescribeFormat>, table_name: ObjectName, }, Explain { describe_alias: DescribeAlias, analyze: bool, verbose: bool, statement: Box<Statement>, format: Option<AnalyzeFormat>, }, Savepoint { name: Ident, }, ReleaseSavepoint { name: Ident, }, Merge { into: bool, table: TableFactor, source: TableFactor, on: Box<Expr>, clauses: Vec<MergeClause>, }, Cache { table_flag: Option<ObjectName>, table_name: ObjectName, has_as: bool, options: Vec<SqlOption>, query: Option<Query>, }, UNCache { table_name: ObjectName, if_exists: bool, }, CreateSequence { temporary: bool, if_not_exists: bool, name: ObjectName, data_type: Option<DataType>, sequence_options: Vec<SequenceOptions>, owned_by: Option<ObjectName>, }, CreateType { name: ObjectName, representation: UserDefinedTypeRepresentation, }, Pragma { name: ObjectName, value: Option<Value>, is_eq: bool, }, LockTables { tables: Vec<LockTable>, }, UnlockTables, Unload { query: Box<Query>, to: Ident, with: Vec<SqlOption>, },
}
Expand description

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

Variants§

§

Analyze

ANALYZE

Analyze (Hive)

Fields

§table_name: ObjectName
§partitions: Option<Vec<Expr>>
§for_columns: bool
§columns: Vec<Ident>
§cache_metadata: bool
§noscan: bool
§compute_statistics: bool
§

Truncate

TRUNCATE

Truncate (Hive)

Fields

§table_name: ObjectName
§partitions: Option<Vec<Expr>>
§table: bool

TABLE - optional keyword;

§

Msck

MSCK

Msck (Hive)

Fields

§table_name: ObjectName
§repair: bool
§partition_action: Option<AddDropSync>
§

Query(Box<Query>)

SELECT
§

Insert(Insert)

INSERT
§

Install

INSTALL

Fields

§extension_name: Ident

Only for DuckDB

§

Load

LOAD

Fields

§extension_name: Ident

Only for DuckDB

§

Directory

Fields

§overwrite: bool
§local: bool
§path: String
§file_format: Option<FileFormat>
§source: Box<Query>
§

Call(Function)

CALL <function>
§

Copy

COPY [TO | FROM] ...

Fields

§source: CopySource

The source of ‘COPY TO’, or the target of ‘COPY FROM’

§to: bool

If true, is a ‘COPY TO’ statement. If false is a ‘COPY FROM’

§target: CopyTarget

The target of ‘COPY TO’, or the source of ‘COPY FROM’

§options: Vec<CopyOption>

WITH options (from PostgreSQL version 9.0)

§legacy_options: Vec<CopyLegacyOption>

WITH options (before PostgreSQL version 9.0)

§values: Vec<Option<String>>

VALUES a vector of values to be copied

§

CopyIntoSnowflake

COPY INTO

See https://docs.snowflake.com/en/sql-reference/sql/copy-into-table Copy Into syntax available for Snowflake is different than the one implemented in Postgres. Although they share common prefix, it is reasonable to implement them in different enums. This can be refactored later once custom dialects are allowed to have custom Statements.

Fields

§from_stage: ObjectName
§from_stage_alias: Option<Ident>
§stage_params: StageParamsObject
§from_transformations: Option<Vec<StageLoadSelectItem>>
§pattern: Option<String>
§copy_options: DataLoadingOptions
§validation_mode: Option<String>
§

Close

CLOSE

Closes the portal underlying an open cursor.

Fields

§cursor: CloseCursor

Cursor name

§

Update

UPDATE

Fields

§table: TableWithJoins

TABLE

§assignments: Vec<Assignment>

Column assignments

§from: Option<TableWithJoins>

Table which provide value to be set

§selection: Option<Expr>

WHERE

§returning: Option<Vec<SelectItem>>

RETURNING

§

Delete(Delete)

DELETE
§

CreateView

CREATE VIEW

Fields

§or_replace: bool
§materialized: bool
§name: ObjectName

View name

§query: Box<Query>
§cluster_by: Vec<Ident>
§with_no_schema_binding: bool

if true, has RedShift [WITH NO SCHEMA BINDING] clause https://docs.aws.amazon.com/redshift/latest/dg/r_CREATE_VIEW.html

§if_not_exists: bool

if true, has SQLite IF NOT EXISTS clause https://www.sqlite.org/lang_createview.html

§temporary: bool

if true, has SQLite TEMP or TEMPORARY clause https://www.sqlite.org/lang_createview.html

§

CreateTable

CREATE TABLE

Fields

§or_replace: bool
§temporary: bool
§external: bool
§global: Option<bool>
§if_not_exists: bool
§transient: bool
§name: ObjectName

Table name

§columns: Vec<ColumnDef>

Optional schema

§constraints: Vec<TableConstraint>
§hive_distribution: HiveDistributionStyle
§hive_formats: Option<HiveFormat>
§table_properties: Vec<SqlOption>
§with_options: Vec<SqlOption>
§file_format: Option<FileFormat>
§location: Option<String>
§query: Option<Box<Query>>
§without_rowid: bool
§engine: Option<String>
§comment: Option<String>
§auto_increment_offset: Option<u32>
§default_charset: Option<String>
§collation: Option<String>
§on_commit: Option<OnCommit>
§on_cluster: Option<String>
§order_by: Option<Vec<Ident>>

ClickHouse “ORDER BY “ clause. Note that omitted ORDER BY is different than empty (represented as ()), the latter meaning “no sorting”. https://clickhouse.com/docs/en/sql-reference/statements/create/table/

§strict: bool

SQLite “STRICT” clause. if the “STRICT” table-option keyword is added to the end, after the closing “)”, then strict typing rules apply to that table.

§

CreateVirtualTable

CREATE VIRTUAL TABLE .. USING <module_name> (<module_args>)`

Sqlite specific statement

Fields

§if_not_exists: bool
§module_name: Ident
§module_args: Vec<Ident>
§

CreateIndex

`CREATE INDEX`

Fields

§name: Option<ObjectName>

index name

§table_name: ObjectName
§using: Option<Ident>
§columns: Vec<OrderByExpr>
§unique: bool
§concurrently: bool
§if_not_exists: bool
§include: Vec<Ident>
§nulls_distinct: Option<bool>
§predicate: Option<Expr>
§

CreateRole

CREATE ROLE

See postgres

Fields

§if_not_exists: bool
§login: Option<bool>
§inherit: Option<bool>
§bypassrls: Option<bool>
§password: Option<Password>
§superuser: Option<bool>
§create_db: Option<bool>
§create_role: Option<bool>
§replication: Option<bool>
§connection_limit: Option<Expr>
§valid_until: Option<Expr>
§in_role: Vec<Ident>
§in_group: Vec<Ident>
§role: Vec<Ident>
§user: Vec<Ident>
§admin: Vec<Ident>
§authorization_owner: Option<ObjectName>
§

CreateSecret

CREATE SECRET

See duckdb

Fields

§or_replace: bool
§temporary: Option<bool>
§if_not_exists: bool
§storage_specifier: Option<Ident>
§secret_type: Ident
§

AlterTable

ALTER TABLE

Fields

§name: ObjectName

Table name

§if_exists: bool
§only: bool
§

AlterIndex

ALTER INDEX

Fields

§

AlterView

ALTER VIEW

Fields

§name: ObjectName

View name

§columns: Vec<Ident>
§query: Box<Query>
§with_options: Vec<SqlOption>
§

AlterRole

ALTER ROLE

Fields

§name: Ident
§

AttachDatabase

ATTACH DATABASE 'path/to/file' AS alias

(SQLite-specific)

Fields

§schema_name: Ident

The name to bind to the newly attached database

§database_file_name: Expr

An expression that indicates the path to the database file

§database: bool

true if the syntax is ‘ATTACH DATABASE’, false if it’s just ‘ATTACH’

§

AttachDuckDBDatabase

(DuckDB-specific)

ATTACH 'sqlite_file.db' AS sqlite_db (READ_ONLY, TYPE SQLITE);

See https://duckdb.org/docs/sql/statements/attach.html

Fields

§if_not_exists: bool
§database: bool

true if the syntax is ‘ATTACH DATABASE’, false if it’s just ‘ATTACH’

§database_path: Ident

An expression that indicates the path to the database file

§database_alias: Option<Ident>
§

DetachDuckDBDatabase

(DuckDB-specific)

DETACH db_alias;

See https://duckdb.org/docs/sql/statements/attach.html

Fields

§if_exists: bool
§database: bool

true if the syntax is ‘DETACH DATABASE’, false if it’s just ‘DETACH’

§database_alias: Ident
§

Drop

DROP [TABLE, VIEW, ...]

Fields

§object_type: ObjectType

The type of the object to drop: TABLE, VIEW, etc.

§if_exists: bool

An optional IF EXISTS clause. (Non-standard.)

§names: Vec<ObjectName>

One or more objects to drop. (ANSI SQL requires exactly one.)

§cascade: bool

Whether CASCADE was specified. This will be false when RESTRICT or no drop behavior at all was specified.

§restrict: bool

Whether RESTRICT was specified. This will be false when CASCADE or no drop behavior at all was specified.

§purge: bool

Hive allows you specify whether the table’s stored data will be deleted along with the dropped table

§temporary: bool

MySQL-specific “TEMPORARY” keyword

§

DropFunction

DROP FUNCTION

Fields

§if_exists: bool
§func_desc: Vec<DropFunctionDesc>

One or more function to drop

§option: Option<ReferentialAction>

CASCADE or RESTRICT

§

DropSecret

DROP SECRET

Fields

§if_exists: bool
§temporary: Option<bool>
§name: Ident
§storage_specifier: Option<Ident>
§

Declare

DECLARE

Declare Cursor Variables

Note: this is a PostgreSQL-specific statement, but may also compatible with other SQL.

Fields

§stmts: Vec<Declare>
§

CreateExtension

CREATE EXTENSION [ IF NOT EXISTS ] extension_name
    [ WITH ] [ SCHEMA schema_name ]
             [ VERSION version ]
             [ CASCADE ]

Note: this is a PostgreSQL-specific statement,

Fields

§name: Ident
§if_not_exists: bool
§cascade: bool
§schema: Option<Ident>
§version: Option<Ident>
§

Fetch

FETCH

Retrieve rows from a query using a cursor

Note: this is a PostgreSQL-specific statement, but may also compatible with other SQL.

Fields

§name: Ident

Cursor name

§direction: FetchDirection
§into: Option<ObjectName>

Optional, It’s possible to fetch rows form cursor to the table

§

Flush

FLUSH [NO_WRITE_TO_BINLOG | LOCAL] flush_option [, flush_option] ... | tables_option

Note: this is a Mysql-specific statement, but may also compatible with other SQL.

Fields

§object_type: FlushType
§channel: Option<String>
§read_lock: bool
§export: bool
§tables: Vec<ObjectName>
§

Discard

DISCARD [ ALL | PLANS | SEQUENCES | TEMPORARY | TEMP ]

Note: this is a PostgreSQL-specific statement, but may also compatible with other SQL.

Fields

§object_type: DiscardObject
§

SetRole

SET [ SESSION | LOCAL ] ROLE role_name

Sets sesssion state. Examples: ANSI, Postgresql, MySQL, and Oracle

Fields

§context_modifier: ContextModifier

Non-ANSI optional identifier to inform if the role is defined inside the current session (SESSION) or transaction (LOCAL).

§role_name: Option<Ident>

Role name. If NONE is specified, then the current role name is removed.

§

SetVariable

SET <variable>

Note: this is not a standard SQL statement, but it is supported by at least MySQL and PostgreSQL. Not all MySQL-specific syntatic forms are supported yet.

Fields

§local: bool
§hivevar: bool
§variable: ObjectName
§value: Vec<Expr>
§

SetTimeZone

SET TIME ZONE <value>

Note: this is a PostgreSQL-specific statements SET TIME ZONE <value> is an alias for SET timezone TO <value> in PostgreSQL

Fields

§local: bool
§value: Expr
§

SetNames

SET NAMES 'charset_name' [COLLATE 'collation_name']

Note: this is a MySQL-specific statement.

Fields

§charset_name: String
§collation_name: Option<String>
§

SetNamesDefault

SET NAMES DEFAULT

Note: this is a MySQL-specific statement.

§

ShowFunctions

SHOW FUNCTIONS

Note: this is a Presto-specific statement.

§

ShowVariable

SHOW <variable>

Note: this is a PostgreSQL-specific statement.

Fields

§variable: Vec<Ident>
§

ShowStatus

SHOW [GLOBAL | SESSION] STATUS [LIKE 'pattern' | WHERE expr]

Note: this is a MySQL-specific statement.

Fields

§global: bool
§session: bool
§

ShowVariables

SHOW VARIABLES

Note: this is a MySQL-specific statement.

Fields

§global: bool
§session: bool
§

ShowCreate

SHOW CREATE TABLE

Note: this is a MySQL-specific statement.

Fields

§obj_name: ObjectName
§

ShowColumns

SHOW COLUMNS

Note: this is a MySQL-specific statement.

Fields

§extended: bool
§full: bool
§table_name: ObjectName
§

ShowTables

SHOW TABLES

Note: this is a MySQL-specific statement.

Fields

§extended: bool
§full: bool
§db_name: Option<Ident>
§

ShowCollation

SHOW COLLATION

Note: this is a MySQL-specific statement.

§

Use

USE

Note: This is a MySQL-specific statement.

Fields

§db_name: Ident
§

StartTransaction

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

If begin is false.

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

If begin is true

Fields

§begin: bool
§modifier: Option<TransactionModifier>

Only for SQLite

§

SetTransaction

SET TRANSACTION ...

Fields

§snapshot: Option<Value>
§session: bool
§

Comment

COMMENT ON ...

Note: this is a PostgreSQL-specific statement.

Fields

§object_type: CommentObject
§object_name: ObjectName
§comment: Option<String>
§if_exists: bool

An optional IF EXISTS clause. (Non-standard.) See https://docs.snowflake.com/en/sql-reference/sql/comment

§

Commit

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

Fields

§chain: bool
§

Rollback

ROLLBACK [ TRANSACTION | WORK ] [ AND [ NO ] CHAIN ] [ TO [ SAVEPOINT ] savepoint_name ]

Fields

§chain: bool
§savepoint: Option<Ident>
§

CreateSchema

CREATE SCHEMA

Fields

§schema_name: SchemaName

<schema name> | AUTHORIZATION <schema authorization identifier> | <schema name> AUTHORIZATION <schema authorization identifier>

§if_not_exists: bool
§

CreateDatabase

CREATE DATABASE

Fields

§db_name: ObjectName
§if_not_exists: bool
§location: Option<String>
§managed_location: Option<String>
§

CreateFunction

CREATE FUNCTION

Supported variants:

  1. Hive
  2. Postgres

Fields

§or_replace: bool
§temporary: bool
§return_type: Option<DataType>
§params: CreateFunctionBody

Optional parameters.

§

CreateProcedure

CREATE PROCEDURE

Fields

§or_alter: bool
§

CreateMacro

CREATE MACRO

Supported variants:

  1. DuckDB

Fields

§or_replace: bool
§temporary: bool
§definition: MacroDefinition
§

CreateStage

Fields

§or_replace: bool
§temporary: bool
§if_not_exists: bool
§stage_params: StageParamsObject
§directory_table_params: DataLoadingOptions
§copy_options: DataLoadingOptions
§comment: Option<String>
§

Assert

ASSERT <condition> [AS <message>]

Fields

§condition: Expr
§message: Option<Expr>
§

Grant

GRANT privileges ON objects TO grantees

Fields

§privileges: Privileges
§grantees: Vec<Ident>
§with_grant_option: bool
§granted_by: Option<Ident>
§

Revoke

REVOKE privileges ON objects FROM grantees

Fields

§privileges: Privileges
§grantees: Vec<Ident>
§granted_by: Option<Ident>
§cascade: bool
§

Deallocate

DEALLOCATE [ PREPARE ] { name | ALL }

Note: this is a PostgreSQL-specific statement.

Fields

§name: Ident
§prepare: bool
§

Execute

EXECUTE name [ ( parameter [, ...] ) ] [USING <expr>]

Note: this is a PostgreSQL-specific statement.

Fields

§name: Ident
§parameters: Vec<Expr>
§using: Vec<Expr>
§

Prepare

PREPARE name [ ( data_type [, ...] ) ] AS statement

Note: this is a PostgreSQL-specific statement.

Fields

§name: Ident
§data_types: Vec<DataType>
§statement: Box<Statement>
§

Kill

Fields

§modifier: Option<KillType>
§id: u64
§

ExplainTable

[EXPLAIN | DESC | DESCRIBE] TABLE

Note: this is a MySQL-specific statement. See https://dev.mysql.com/doc/refman/8.0/en/explain.html

Fields

§describe_alias: DescribeAlias

EXPLAIN | DESC | DESCRIBE

§hive_format: Option<HiveDescribeFormat>

Hive style FORMATTED | EXTENDED

§table_name: ObjectName

Table name

§

Explain

[EXPLAIN | DESC | DESCRIBE]  <statement>

Fields

§describe_alias: DescribeAlias

EXPLAIN | DESC | DESCRIBE

§analyze: bool

Carry out the command and show actual run times and other statistics.

§verbose: bool
§statement: Box<Statement>

A SQL query that specifies what to explain

§format: Option<AnalyzeFormat>

Optional output format of explain

§

Savepoint

SAVEPOINT

Define a new savepoint within the current transaction

Fields

§name: Ident
§

ReleaseSavepoint

RELEASE [ SAVEPOINT ] savepoint_name

Fields

§name: Ident
§

Merge

A MERGE statement.

MERGE INTO <target_table> USING <source> ON <join_expr> { matchedClause | notMatchedClause } [ ... ]

Snowflake BigQuery

Fields

§into: bool

optional INTO keyword

§table: TableFactor

Specifies the table to merge

§source: TableFactor

Specifies the table or subquery to join with the target table

§on: Box<Expr>

Specifies the expression on which to join the target table and source

§clauses: Vec<MergeClause>

Specifies the actions to perform when values match or do not match.

§

Cache

CACHE [ FLAG ] TABLE <table_name> [ OPTIONS('K1' = 'V1', 'K2' = V2) ] [ AS ] [ <query> ]

See Spark SQL docs for more details.

Fields

§table_flag: Option<ObjectName>

Table flag

§table_name: ObjectName

Table name

§has_as: bool
§options: Vec<SqlOption>

Table confs

§query: Option<Query>

Cache table as a Query

§

UNCache

UNCACHE TABLE [ IF EXISTS ]  <table_name>

Fields

§table_name: ObjectName

Table name

§if_exists: bool
§

CreateSequence

CREATE [ { TEMPORARY | TEMP } ] SEQUENCE [ IF NOT EXISTS ] <sequence_name>

Define a new sequence:

Fields

§temporary: bool
§if_not_exists: bool
§data_type: Option<DataType>
§sequence_options: Vec<SequenceOptions>
§owned_by: Option<ObjectName>
§

CreateType

CREATE TYPE <name>
§

Pragma

PRAGMA <schema-name>.<pragma-name> = <pragma-value>

Fields

§value: Option<Value>
§is_eq: bool
§

LockTables

LOCK TABLES <table_name> [READ [LOCAL] | [LOW_PRIORITY] WRITE]

Note: this is a MySQL-specific statement. See https://dev.mysql.com/doc/refman/8.0/en/lock-tables.html

Fields

§tables: Vec<LockTable>
§

UnlockTables

UNLOCK TABLES

Note: this is a MySQL-specific statement. See https://dev.mysql.com/doc/refman/8.0/en/lock-tables.html

§

Unload

UNLOAD(statement) TO <destination> [ WITH options ]

See Redshift https://docs.aws.amazon.com/redshift/latest/dg/r_UNLOAD.html and

Fields

§query: Box<Query>

Trait Implementations§

source§

impl Clone for Statement

source§

fn clone(&self) -> Statement

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Statement

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'de> Deserialize<'de> for Statement

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl Display for Statement

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Hash for Statement

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl Ord for Statement

source§

fn cmp(&self, other: &Statement) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized + PartialOrd,

Restrict a value to a certain interval. Read more
source§

impl PartialEq for Statement

source§

fn eq(&self, other: &Statement) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd for Statement

source§

fn partial_cmp(&self, other: &Statement) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl Serialize for Statement

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl TryFrom<Statement> for CreateTableBuilder

§

type Error = ParserError

The type returned in the event of a conversion error.
source§

fn try_from(stmt: Statement) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl Visit for Statement

source§

fn visit<V: Visitor>(&self, visitor: &mut V) -> ControlFlow<V::Break>

source§

impl VisitMut for Statement

source§

fn visit<V: VisitorMut>(&mut self, visitor: &mut V) -> ControlFlow<V::Break>

source§

impl Eq for Statement

source§

impl StructuralPartialEq for Statement

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,