pub enum Statement {
Show 64 variants
CreateTable(CreateTable),
CreateTableIfNotExists(DeferredCreateTable),
CreateIndex(CreateIndex),
Insert(InsertStmt),
Select(Box<SelectStmt>),
Update(UpdateStmt),
Delete(DeleteStmt),
Drop(DropStmt),
AlterTable(AlterTableStmt),
AlterForeignTable(AlterForeignTableStmt),
AlterView(AlterViewStmt),
CreateView {
name: String,
column_names: Vec<String>,
body: Box<SelectStmt>,
or_replace: bool,
persistence: RelationPersistence,
options: Vec<(String, String)>,
},
CreateMaterializedView {
name: String,
column_names: Vec<String>,
if_not_exists: bool,
with_no_data: bool,
options: Vec<(String, String)>,
body: Box<SelectStmt>,
},
RefreshMaterializedView {
name: String,
concurrently: bool,
with_no_data: bool,
},
CreateSchema {
name: String,
if_not_exists: bool,
},
Notify {
channel: String,
payload: String,
},
Listen {
channel: String,
},
Unlisten {
channel: Option<String>,
},
SetVariable {
name: String,
value: String,
},
ResetVariable {
name: String,
},
ResetAllVariables,
SetConstraints {
constraints: Vec<SetConstraintName>,
deferred: bool,
},
ShowVariable {
name: String,
},
Discard {
target: DiscardTarget,
},
Load {
library: String,
},
Explain {
analyze: bool,
verbose: bool,
format: Option<String>,
body: Box<Statement>,
},
Analyze {
table: Option<String>,
},
Vacuum(VacuumStmt),
Truncate {
tables: Vec<TruncateTarget>,
cascade: bool,
restart_identity: bool,
},
Transaction(TransactionStmt),
DeclareCursor(DeclareCursorStmt),
FetchCursor(FetchCursorStmt),
CloseCursor {
name: Option<String>,
},
CreateSequence(CreateSequence),
AlterSequence(AlterSequence),
CreateTableAs {
name: String,
if_not_exists: bool,
column_names: Vec<String>,
with_no_data: bool,
persistence: RelationPersistence,
on_commit: OnCommitAction,
body: Box<SelectStmt>,
},
Prepare {
name: String,
body: Box<Statement>,
},
Execute {
name: String,
params: Vec<Expr>,
},
Deallocate {
name: Option<String>,
},
Values {
rows: Vec<Vec<Expr>>,
},
CreateForeignServer(CreateForeignServer),
CreateForeignTable(CreateForeignTable),
CreateForeignTableIfNotExists(DeferredCreateForeignTable),
Merge(MergeStmt),
CreateFunction(Box<CreateFunction>),
DropFunction(DropFunctionStmt),
AlterRoutine(AlterRoutineStmt),
AlterRoutineOwner(AlterRoutineOwnerStmt),
RenameRoutine(RenameRoutineStmt),
GrantRoutine(GrantRoutineStmt),
GrantTable(GrantTableStmt),
GrantSequence(GrantSequenceStmt),
GrantDatabase(GrantDatabaseStmt),
GrantSchema(GrantSchemaStmt),
GrantRole(GrantRoleStmt),
CreateRole(CreateRoleStmt),
AlterRole(AlterRoleStmt),
DropRole(DropRoleStmt),
CreateTrigger(CreateTrigger),
DropTrigger(DropTrigger),
CreateRule(CreateRule),
DropRule(DropRule),
DoBlock {
language: String,
body: String,
},
Call {
name: String,
args: Vec<Expr>,
},
}Variants§
CreateTable(CreateTable)
CreateTableIfNotExists(DeferredCreateTable)
CreateIndex(CreateIndex)
Insert(InsertStmt)
Select(Box<SelectStmt>)
SelectStmt is the largest variant by far (CTEs + set-ops + n-ary
expression trees), so we box it to keep the enum’s stack footprint
proportional to the smaller variants.
Update(UpdateStmt)
Delete(DeleteStmt)
Drop(DropStmt)
AlterTable(AlterTableStmt)
AlterForeignTable(AlterForeignTableStmt)
AlterView(AlterViewStmt)
CreateView
CREATE [OR REPLACE] VIEW name [(column_name, ...)] AS SELECT .... The body is the underlying SelectStmt; views are materialised lazily on every reference (no row caching).
CreateMaterializedView
CREATE MATERIALIZED VIEW ... AS SELECT ... [WITH [NO] DATA].
Fields
body: Box<SelectStmt>RefreshMaterializedView
REFRESH MATERIALIZED VIEW [CONCURRENTLY] name [WITH [NO] DATA].
CreateSchema
CREATE SCHEMA [IF NOT EXISTS] name. This AST entry records the
command for the engine’s durable schema catalog and namespace
resolver.
Notify
NOTIFY channel [, 'payload'] queues one asynchronous notification for delivery when the outer transaction commits.
Listen
LISTEN channel transactionally subscribes the current SQL session.
Unlisten
UNLISTEN channel | * transactionally removes one or every subscription. None represents *.
SetVariable
SET <name> [TO|=] <value> - runtime parameter assignment.
The engine gives search_path resolution semantics and stores other
parameters in the logical session for subsequent SHOW statements.
ResetVariable
RESET <name> restores one runtime parameter to its session default.
ResetAllVariables
RESET ALL restores every resettable runtime parameter.
SetConstraints
SET CONSTRAINTS { ALL | name [, ...] } { DEFERRED | IMMEDIATE }. An empty constraint list represents ALL; qualified names retain their SQL spelling so execution can apply schema-search semantics.
ShowVariable
SHOW <variable> - return the runtime parameter as one
(name -> value) row.
Discard
DISCARD [ALL|PLANS|SEQUENCES|TEMP|TEMPORARY] - clear session state.
The engine resets session variables, prepared statements, sequence state, and the current session’s temporary relations as requested.
Fields
target: DiscardTargetLoad
LOAD 'library' - load a shared library into the session. The
engine embeds its extension surface, so libraries it provides
natively (Apache AGE) load as no-ops and unknown libraries fail
like a missing $libdir file.
Explain
EXPLAIN .... Carries the inner statement so the engine can
emit the planner output.
Analyze
ANALYZE [table]. The engine refreshes per-column statistics
for cardinality estimation; the AST simply records the target.
Vacuum(VacuumStmt)
VACUUM [options] [relations]. Execution enforces PostgreSQL’s transaction-block restriction before validating options and dispatching storage maintenance.
Truncate
TRUNCATE TABLE t1, t2 .... Wipes the listed table hierarchies unless
a target uses ONLY.
Transaction(TransactionStmt)
BEGIN / COMMIT / ROLLBACK / SAVEPOINT name.
DeclareCursor(DeclareCursorStmt)
DECLARE name [BINARY] [SCROLL] CURSOR [WITH HOLD] FOR query.
FetchCursor(FetchCursorStmt)
FETCH or MOVE over a named SQL cursor.
CloseCursor
CLOSE name or CLOSE ALL. None represents ALL.
CreateSequence(CreateSequence)
CREATE SEQUENCE name [START n] [INCREMENT n].
AlterSequence(AlterSequence)
ALTER SEQUENCE name [RESTART [WITH n]] [INCREMENT [BY] n] [START [WITH] n].
CreateTableAs
CREATE TABLE name AS SELECT ....
Prepare
PREPARE name AS <inner>.
Execute
EXECUTE name (param1, param2, ...).
Deallocate
DEALLOCATE name | DEALLOCATE ALL. None means ALL.
Values
SELECT * FROM (VALUES ...) [AS alias] – a standalone VALUES
statement (also reachable from a SET-OP body).
CreateForeignServer(CreateForeignServer)
CREATE SERVER name FOREIGN DATA WRAPPER type OPTIONS (...).
CreateForeignTable(CreateForeignTable)
CREATE FOREIGN TABLE name (...) SERVER server OPTIONS (...).
CreateForeignTableIfNotExists(DeferredCreateForeignTable)
CREATE FOREIGN TABLE IF NOT EXISTS retains its raw-parser declaration until execution can check the shared relation namespace.
Merge(MergeStmt)
MERGE INTO target USING source ON cond WHEN MATCHED THEN ... WHEN NOT MATCHED THEN .... SQL:2003 conditional UPSERT.
CreateFunction(Box<CreateFunction>)
CREATE [OR REPLACE] FUNCTION | PROCEDURE .... Boxed: the
definition (parameters + body source) dwarfs other variants.
DropFunction(DropFunctionStmt)
DROP FUNCTION | PROCEDURE [IF EXISTS] name[(args)] [, ...].
AlterRoutine(AlterRoutineStmt)
ALTER FUNCTION | PROCEDURE | ROUTINE name[(input_types)] volatility and null-input attributes.
AlterRoutineOwner(AlterRoutineOwnerStmt)
RenameRoutine(RenameRoutineStmt)
GrantRoutine(GrantRoutineStmt)
GrantTable(GrantTableStmt)
GrantSequence(GrantSequenceStmt)
GrantDatabase(GrantDatabaseStmt)
GrantSchema(GrantSchemaStmt)
GrantRole(GrantRoleStmt)
CreateRole(CreateRoleStmt)
AlterRole(AlterRoleStmt)
DropRole(DropRoleStmt)
CreateTrigger(CreateTrigger)
CREATE [OR REPLACE] TRIGGER ... ON relation.
DropTrigger(DropTrigger)
DROP TRIGGER [IF EXISTS] name ON relation.
CreateRule(CreateRule)
CREATE [OR REPLACE] RULE ... ON relation.
DropRule(DropRule)
DROP RULE [IF EXISTS] name ON relation.
DoBlock
DO [LANGUAGE lang] $$ ... $$ - anonymous code block.
Call
CALL proc(args) - procedure invocation. OUT / INOUT
parameters shape the result row.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Statement
impl<'de> Deserialize<'de> for Statement
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for Statement
impl RefUnwindSafe for Statement
impl Send for Statement
impl Sync for Statement
impl Unpin for Statement
impl UnsafeUnpin for Statement
impl UnwindSafe for Statement
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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