Skip to main content

Statement

Enum Statement 

Source
pub enum Statement {
Show 75 variants Analyze { table_name: ObjectName, }, Truncate { table_name: ObjectName, }, Refresh { table_name: ObjectName, }, Query(Box<Query>), Insert { table_name: ObjectName, columns: Vec<Ident>, source: Box<Query>, returning: Vec<SelectItem>, }, Copy { entity: CopyEntity, target: CopyTarget, }, Update { table_name: ObjectName, assignments: Vec<Assignment>, selection: Option<Expr>, returning: Vec<SelectItem>, }, Delete { table_name: ObjectName, selection: Option<Expr>, returning: Vec<SelectItem>, }, DeleteMetaSnapshots { snapshot_ids: Vec<u64>, }, Discard(DiscardType), CreateView { or_replace: bool, materialized: bool, if_not_exists: bool, name: ObjectName, columns: Vec<Ident>, query: Box<Query>, emit_mode: Option<EmitMode>, with_options: Vec<SqlOption>, }, CreateTable {
Show 18 fields or_replace: bool, temporary: bool, if_not_exists: bool, name: ObjectName, columns: Vec<ColumnDef>, wildcard_idx: Option<usize>, constraints: Vec<TableConstraint>, with_options: Vec<SqlOption>, format_encode: Option<CompatibleFormatEncode>, source_watermarks: Vec<SourceWatermark>, append_only: bool, on_conflict: Option<OnConflict>, with_version_columns: Vec<Ident>, query: Option<Box<Query>>, cdc_table_info: Option<CdcTableInfo>, include_column_options: IncludeOption, webhook_info: Option<WebhookSourceInfo>, engine: Engine,
}, CreateIndex { name: ObjectName, table_name: ObjectName, columns: Vec<OrderByExpr>, method: Option<Ident>, include: Vec<Ident>, distributed_by: Vec<Expr>, unique: bool, if_not_exists: bool, with_properties: WithProperties, }, CreateSource { stmt: CreateSourceStatement, }, CreateSink { stmt: CreateSinkStatement, }, CreateSubscription { stmt: CreateSubscriptionStatement, }, CreateConnection { stmt: CreateConnectionStatement, }, CreateSecret { stmt: CreateSecretStatement, }, CreateFunction { or_replace: bool, temporary: bool, if_not_exists: bool, name: ObjectName, args: Option<Vec<OperateFunctionArg>>, returns: Option<CreateFunctionReturns>, params: CreateFunctionBody, with_options: CreateFunctionWithOptions, }, CreateAggregate { or_replace: bool, if_not_exists: bool, name: ObjectName, args: Vec<OperateFunctionArg>, returns: DataType, append_only: bool, params: CreateFunctionBody, }, DeclareCursor { stmt: DeclareCursorStatement, }, FetchCursor { stmt: FetchCursorStatement, }, CloseCursor { stmt: CloseCursorStatement, }, AlterDatabase { name: ObjectName, operation: AlterDatabaseOperation, }, AlterSchema { name: ObjectName, operation: AlterSchemaOperation, }, AlterTable { name: ObjectName, operation: AlterTableOperation, }, AlterIndex { name: ObjectName, operation: AlterIndexOperation, }, AlterView { name: ObjectName, materialized: bool, operation: AlterViewOperation, }, AlterSink { name: ObjectName, operation: AlterSinkOperation, }, AlterSubscription { name: ObjectName, operation: AlterSubscriptionOperation, }, AlterSource { name: ObjectName, operation: AlterSourceOperation, }, AlterFunction { name: ObjectName, args: Option<Vec<OperateFunctionArg>>, operation: AlterFunctionOperation, }, AlterConnection { name: ObjectName, operation: AlterConnectionOperation, }, AlterSecret { name: ObjectName, operation: AlterSecretOperation, }, AlterFragment { fragment_ids: Vec<u32>, operation: AlterFragmentOperation, }, AlterCompactionGroup { group_ids: Vec<u64>, operation: AlterCompactionGroupOperation, }, AlterDefaultPrivileges { target_users: Option<Vec<Ident>>, schema_names: Option<Vec<ObjectName>>, operation: DefaultPrivilegeOperation, }, Describe { name: ObjectName, kind: DescribeKind, }, DescribeFragment { fragment_id: u32, }, ShowObjects { object: ShowObject, filter: Option<ShowStatementFilter>, }, ShowCreateObject { create_type: ShowCreateType, name: ObjectName, }, ShowTransactionIsolationLevel, CancelJobs(JobIdents), Kill(String), Drop(DropStatement), DropFunction { if_exists: bool, func_desc: Vec<FunctionDesc>, option: Option<ReferentialAction>, }, DropAggregate { if_exists: bool, func_desc: Vec<FunctionDesc>, option: Option<ReferentialAction>, }, SetVariable { local: bool, variable: Ident, value: SetVariableValue, }, ShowVariable { variable: Vec<Ident>, }, StartTransaction { modes: Vec<TransactionMode>, }, Begin { modes: Vec<TransactionMode>, }, Abort, SetTransaction { modes: Vec<TransactionMode>, snapshot: Option<Value>, session: bool, }, SetTimeZone { local: bool, value: SetTimeZoneValue, }, Comment { object_type: CommentObject, object_name: ObjectName, comment: Option<String>, }, Commit { chain: bool, }, Rollback { chain: bool, }, CreateSchema { schema_name: ObjectName, if_not_exists: bool, owner: Option<ObjectName>, }, CreateDatabase { db_name: ObjectName, if_not_exists: bool, owner: Option<ObjectName>, resource_group: Option<SetVariableValue>, barrier_interval_ms: Option<u32>, checkpoint_frequency: Option<u64>, }, 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>, revoke_grant_option: bool, cascade: bool, }, Deallocate { name: Option<Ident>, prepare: bool, }, Execute { name: Ident, parameters: Vec<Expr>, }, Prepare { name: Ident, data_types: Vec<DataType>, statement: Box<Statement>, }, Explain { analyze: bool, statement: Box<Statement>, options: ExplainOptions, }, ExplainAnalyzeStreamJob { target: AnalyzeTarget, duration_secs: Option<u64>, }, CreateUser(CreateUserStatement), AlterUser(AlterUserStatement), AlterSystem { param: Ident, value: SetVariableValue, }, Flush, Wait(WaitTarget), Backup, Recover, Use { db_name: ObjectName, }, Vacuum { object_name: ObjectName, full: bool, },
}
Expand description

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

Variants§

§

Analyze

Analyze (Hive)

Fields

§table_name: ObjectName
§

Truncate

Truncate (Hive)

Fields

§table_name: ObjectName
§

Refresh

Refresh table

Fields

§table_name: ObjectName
§

Query(Box<Query>)

SELECT

§

Insert

INSERT

Fields

§table_name: ObjectName

TABLE

§columns: Vec<Ident>

COLUMNS

§source: Box<Query>

A SQL query that specifies what to insert

§returning: Vec<SelectItem>

Define output of this insert statement

§

Copy

Fields

§entity: CopyEntity
§target: CopyTarget
§

Update

UPDATE

Fields

§table_name: ObjectName

TABLE

§assignments: Vec<Assignment>

Column assignments

§selection: Option<Expr>

WHERE

§returning: Vec<SelectItem>

RETURNING

§

Delete

DELETE

Fields

§table_name: ObjectName

FROM

§selection: Option<Expr>

WHERE

§returning: Vec<SelectItem>

RETURNING

§

DeleteMetaSnapshots

DELETE META SNAPSHOT(S)

Fields

§snapshot_ids: Vec<u64>
§

Discard(DiscardType)

DISCARD

§

CreateView

CREATE VIEW

Fields

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

View name

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

CreateTable

CREATE TABLE

Fields

§or_replace: bool
§temporary: bool
§if_not_exists: bool
§name: ObjectName

Table name

§columns: Vec<ColumnDef>

Optional schema

§wildcard_idx: Option<usize>
§constraints: Vec<TableConstraint>
§with_options: Vec<SqlOption>
§format_encode: Option<CompatibleFormatEncode>

FORMAT ... ENCODE ... for table with connector

§source_watermarks: Vec<SourceWatermark>

The watermark defined on source.

§append_only: bool

Append only table.

§on_conflict: Option<OnConflict>

On conflict behavior

§with_version_columns: Vec<Ident>

with_version_columns behind on conflict - supports multiple version columns

§query: Option<Box<Query>>

AS ( query )

§cdc_table_info: Option<CdcTableInfo>

FROM cdc_source TABLE database_name.table_name

§include_column_options: IncludeOption

INCLUDE a AS b INCLUDE c

§webhook_info: Option<WebhookSourceInfo>

VALIDATE SECRET secure_secret_name AS secure_compare ()

§engine: Engine

Engine = [hummock | iceberg]

§

CreateIndex

CREATE INDEX

Fields

§name: ObjectName

index name

§table_name: ObjectName
§columns: Vec<OrderByExpr>
§method: Option<Ident>
§include: Vec<Ident>
§distributed_by: Vec<Expr>
§unique: bool
§if_not_exists: bool
§with_properties: WithProperties
§

CreateSource

CREATE SOURCE

§

CreateSink

CREATE SINK

§

CreateSubscription

CREATE SUBSCRIPTION

§

CreateConnection

CREATE CONNECTION

§

CreateSecret

§

CreateFunction

Fields

§or_replace: bool
§temporary: bool
§if_not_exists: bool
§params: CreateFunctionBody

Optional parameters.

§

CreateAggregate

Fields

§or_replace: bool
§if_not_exists: bool
§returns: DataType
§append_only: bool

Optional parameters.

§

DeclareCursor

DECLARE CURSOR

§

FetchCursor

§

CloseCursor

§

AlterDatabase

ALTER DATABASE

§

AlterSchema

ALTER SCHEMA

Fields

§

AlterTable

ALTER TABLE

Fields

§name: ObjectName

Table name

§

AlterIndex

ALTER INDEX

Fields

§name: ObjectName

Index name

§

AlterView

ALTER VIEW

Fields

§name: ObjectName

View name

§materialized: bool
§

AlterSink

ALTER SINK

Fields

§name: ObjectName

Sink name

§

AlterSubscription

§

AlterSource

ALTER SOURCE

Fields

§name: ObjectName

Source name

§

AlterFunction

ALTER FUNCTION

Fields

§name: ObjectName

Function name

§

AlterConnection

ALTER CONNECTION

Fields

§name: ObjectName

Connection name

§

AlterSecret

ALTER SECRET

Fields

§name: ObjectName

Secret name

§

AlterFragment

ALTER FRAGMENT

Fields

§fragment_ids: Vec<u32>
§

AlterCompactionGroup

ALTER COMPACTION GROUP

Fields

§group_ids: Vec<u64>
§

AlterDefaultPrivileges

DESCRIBE relation ALTER DEFAULT PRIVILEGES

Fields

§target_users: Option<Vec<Ident>>
§schema_names: Option<Vec<ObjectName>>
§

Describe

DESCRIBE relation

Fields

§name: ObjectName

relation name

§

DescribeFragment

DESCRIBE FRAGMENT <fragment_id>

Fields

§fragment_id: u32
§

ShowObjects

SHOW OBJECT COMMAND

§

ShowCreateObject

SHOW CREATE COMMAND

Fields

§create_type: ShowCreateType

Show create object type

§name: ObjectName

Show create object name

§

ShowTransactionIsolationLevel

§

CancelJobs(JobIdents)

CANCEL JOBS COMMAND

§

Kill(String)

KILL COMMAND Kill process in the show processlist.

§

Drop(DropStatement)

DROP

§

DropFunction

DROP FUNCTION

Fields

§if_exists: bool
§func_desc: Vec<FunctionDesc>

One or more function to drop

§option: Option<ReferentialAction>

CASCADE or RESTRICT

§

DropAggregate

DROP AGGREGATE

Fields

§if_exists: bool
§func_desc: Vec<FunctionDesc>

One or more function to drop

§option: Option<ReferentialAction>

CASCADE or RESTRICT

§

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 syntactic forms are supported yet.

Fields

§local: bool
§variable: Ident
§

ShowVariable

SHOW <variable>

Note: this is a PostgreSQL-specific statement.

Fields

§variable: Vec<Ident>
§

StartTransaction

START TRANSACTION ...

Fields

§

Begin

BEGIN [ TRANSACTION | WORK ]

Fields

§

Abort

ABORT

§

SetTransaction

SET TRANSACTION ...

Fields

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

SetTimeZone

SET [ SESSION | LOCAL ] TIME ZONE { value | 'value' | LOCAL | DEFAULT }

Fields

§local: bool
§

Comment

COMMENT ON ...

Note: this is a PostgreSQL-specific statement.

Fields

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

Commit

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

Fields

§chain: bool
§

Rollback

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

Fields

§chain: bool
§

CreateSchema

CREATE SCHEMA

Fields

§schema_name: ObjectName
§if_not_exists: bool
§

CreateDatabase

CREATE DATABASE

Fields

§db_name: ObjectName
§if_not_exists: bool
§resource_group: Option<SetVariableValue>
§barrier_interval_ms: Option<u32>
§checkpoint_frequency: Option<u64>
§

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>
§revoke_grant_option: bool
§cascade: bool
§

Deallocate

DEALLOCATE [ PREPARE ] { name | ALL }

Note: this is a PostgreSQL-specific statement.

Fields

§prepare: bool
§

Execute

EXECUTE name [ ( parameter [, ...] ) ]

Note: this is a PostgreSQL-specific statement.

Fields

§name: Ident
§parameters: 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>
§

Explain

EXPLAIN / DESCRIBE for select_statement

Fields

§analyze: bool

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

§statement: Box<Statement>

A SQL query that specifies what to explain

§options: ExplainOptions

options of the explain statement

§

ExplainAnalyzeStreamJob

EXPLAIN ANALYZE for stream job We introduce a new statement rather than reuse EXPLAIN because the body of the statement is not an SQL query. TODO(kwannoel): Make profiling duration configurable: EXPLAIN ANALYZE (DURATION 1s) …

Fields

§duration_secs: Option<u64>
§

CreateUser(CreateUserStatement)

CREATE USER

§

AlterUser(AlterUserStatement)

ALTER USER

§

AlterSystem

ALTER SYSTEM SET configuration_parameter { TO | = } { value | ‘value’ | DEFAULT }

Fields

§param: Ident
§

Flush

FLUSH the current barrier.

Note: RisingWave specific statement.

§

Wait(WaitTarget)

WAIT for background stream jobs to finish. It will block the current session until the condition is met.

§

Backup

Trigger meta backup.

§

Recover

Trigger stream job recover

§

Use

USE <db_name>

Note: this is a RisingWave specific statement and used to switch the current database.

Fields

§db_name: ObjectName
§

Vacuum

VACUUM [FULL] [database_name][schema_name][object_name]

Note: this is a RisingWave specific statement for iceberg table/sink compaction.

Fields

§object_name: ObjectName
§full: bool

Implementations§

Source§

impl Statement

Source

pub fn try_to_string(&self) -> Result<String, ParserError>

Converts(unparses) the statement to a SQL string.

If the resulting SQL is not valid, returns an error.

Source

pub fn to_string_unchecked(&self) -> String

Converts(unparses) the statement to a SQL string.

The result may not be valid SQL if there’s an implementation bug in the Display trait of any AST node. To avoid this, always prefer Statement::try_to_string to get a Result, or to_string which panics if the SQL is invalid.

Source

fn fmt_unchecked(&self, f: impl Write) -> Result

Source

pub fn is_create(&self) -> bool

Source§

impl Statement

Source

pub fn to_redacted_string(&self, keywords: RedactSqlOptionKeywordsRef) -> String

Source

pub fn default_create_table(name: ObjectName) -> Self

Create a new CREATE TABLE statement with the given name and empty fields.

Trait Implementations§

Source§

impl Clone for Statement

Source§

fn clone(&self) -> Statement

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 Display for Statement

Source§

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

Converts(unparses) the statement to a SQL string.

If the resulting SQL is not valid, this function will panic. Use Statement::try_to_string to get a Result instead.

Source§

impl Eq for Statement

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 PartialEq for Statement

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

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

Source§

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§

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>,

Source§

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>,

Source§

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

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more