Skip to main content

Statement

Enum Statement 

Source
pub enum Statement {
Show 41 variants DropTable { names: Vec<String>, if_exists: bool, }, DropIndex { name: String, if_exists: bool, }, Empty, Select(SelectStatement), CreateTable(CreateTableStatement), CreateExtension(String), DoBlock(PlPgSqlBlock), CreateIndex(CreateIndexStatement), Insert(InsertStatement), Update(UpdateStatement), Delete(DeleteStatement), Begin, Commit, Rollback, Savepoint(String), RollbackToSavepoint(String), ReleaseSavepoint(String), ShowTables, ShowColumns(String), CreateUser(CreateUserStatement), DropUser(String), ShowUsers, Explain(ExplainStatement), AlterIndex(AlterIndexStatement), AlterTable(AlterTableStatement), CreatePublication(CreatePublicationStatement), DropPublication(String), ShowPublications, CreateSubscription(CreateSubscriptionStatement), DropSubscription(String), ShowSubscriptions, WaitForWalPosition { pos: u64, timeout_ms: Option<u64>, }, Analyze(Option<String>), CompactColdSegments, SetParameter { name: String, value: SetValue, }, SetParameterList(Vec<(String, SetValue)>), ResetParameter(Option<String>), CreateFunction(CreateFunctionStatement), CreateTrigger(CreateTriggerStatement), DropTrigger { name: String, table: String, if_exists: bool, }, DropFunction { name: String, if_exists: bool, },
}

Variants§

§

DropTable

v7.14.0 — DROP TABLE [IF EXISTS] name [, name…] [CASCADE | RESTRICT]. Engine removes the matching tables (each one) from the catalog; IF EXISTS makes the drop idempotent. CASCADE / RESTRICT trailers parsed silently (SPG always cascades index drops on table drop).

Fields

§names: Vec<String>
§if_exists: bool
§

DropIndex

v7.14.0 — DROP INDEX [IF EXISTS] name. Removes the matching index across whichever table holds it.

Fields

§name: String
§if_exists: bool
§

Empty

v7.14.0 — empty / comment-only statement. The lexer strips -- line comments and /* … */ block comments (including the MySQL conditional /*!NNNNN … */ form) before the parser ever sees them; a SQL chunk that contains nothing else lands here. Engine returns CommandOk no-op so pg_dump / mysqldump preambles (SET NAMES utf8mb4 wrapped in conditional comments, etc.) load cleanly.

§

Select(SelectStatement)

§

CreateTable(CreateTableStatement)

§

CreateExtension(String)

v7.9.15 — CREATE EXTENSION [IF NOT EXISTS] <name> [WITH SCHEMA <s>] [VERSION <v>] [CASCADE] accepted as a no-op so PG dumps that include extension declarations (notably pgvector) load against SPG without splitting init scripts. mailrs migration follow-up F3.

§

DoBlock(PlPgSqlBlock)

v7.9.27 → v7.16.2 — PG DO $$ … $$ [LANGUAGE plpgsql]; block. The body is now CAPTURED as a PlPgSqlBlock and the engine executes it at top level (mailrs round-10 A.2). Pre-v7.16.2 the parser discarded the body and the engine returned CommandOk — a SEV-1 silent no-op that turned mailrs’s DO BEGIN IF EXISTS … THEN ALTER … END $$ idempotent migrations into invisible no-ops.

§

CreateIndex(CreateIndexStatement)

§

Insert(InsertStatement)

§

Update(UpdateStatement)

v4.4 — UPDATE <table> SET col=expr [, ...] [WHERE cond].

§

Delete(DeleteStatement)

v4.4 — DELETE FROM <table> [WHERE cond].

§

Begin

§

Commit

§

Rollback

§

Savepoint(String)

SAVEPOINT <name> — push a named savepoint onto the active TX’s stack so a later ROLLBACK TO <name> can undo just the work since this point.

§

RollbackToSavepoint(String)

ROLLBACK TO [SAVEPOINT] <name> — restore catalog state to the named savepoint and discard later savepoints. Does not end the transaction.

§

ReleaseSavepoint(String)

RELEASE [SAVEPOINT] <name> — discard a savepoint without rolling back. Keeps the work done since then.

§

ShowTables

SHOW TABLES — return the list of tables in the catalog.

§

ShowColumns(String)

SHOW COLUMNS FROM <table> — return one row per column with its declared name / type / nullability.

§

CreateUser(CreateUserStatement)

CREATE USER 'name' WITH PASSWORD 'pw' ROLE 'admin' (v4.1). Role is optional; defaults to readonly when omitted.

§

DropUser(String)

DROP USER 'name' (v4.1).

§

ShowUsers

SHOW USERS (v4.1) — admin-only listing of (name, role).

§

Explain(ExplainStatement)

v4.26 — EXPLAIN [ANALYZE] <select>. The engine returns a single-column text table describing the rewritten plan tree for inner. analyze triggers an actual exec to attach observed row counts and elapsed micros to each node.

§

AlterIndex(AlterIndexStatement)

v6.0.4 — ALTER INDEX <name> REBUILD [WITH (encoding = ...)]. Synchronous rebuild of an NSW index. With the optional encoding clause, every stored cell at the indexed column is also re-encoded through coerce_value before the new graph builds.

§

AlterTable(AlterTableStatement)

v6.7.2 — ALTER TABLE <name> SET <setting> = <value>. The only setting in v6.7.2 is hot_tier_bytes, which overrides the global SPG_HOT_TIER_BYTES freezer trigger for the named table.

§

CreatePublication(CreatePublicationStatement)

v6.1.2 — CREATE PUBLICATION <name> [FOR ALL TABLES]. The catalog row lives in spg_publications. Publisher-side WAL filtering arrives in v6.1.5.

§

DropPublication(String)

v6.1.2 — DROP PUBLICATION <name>. PG-compatible silent no-op when the publication does not exist.

§

ShowPublications

v6.1.3 — SHOW PUBLICATIONS. Returns one row per publication ordered by name with (name, scope_summary, table_count) columns. The scope summary is the human- readable form ALL TABLES / FOR TABLE … / FOR ALL TABLES EXCEPT …; table_count is NULL for the AllTables scope and the table-list length otherwise.

§

CreateSubscription(CreateSubscriptionStatement)

v6.1.4 — CREATE SUBSCRIPTION <name> CONNECTION '<conn>' PUBLICATION <pub_name> [, <pub_name> …]. Catalog lands in spg_subscriptions; when the subscription is enabled = true (default) the server spawns a background worker that connects to conn and drains the requested publication(s) into the local engine.

§

DropSubscription(String)

v6.1.4 — DROP SUBSCRIPTION <name>. Like DROP PUBLICATION, silent no-op when absent. Stops the associated worker thread before removing the row.

§

ShowSubscriptions

v6.1.4 — SHOW SUBSCRIPTIONS. Returns one row per subscription ordered by name with (name, conn_str, publications, enabled, last_received_pos).

§

WaitForWalPosition

v6.1.7 — WAIT FOR WAL POSITION <pos> [WITH TIMEOUT <ms>]. Blocks until the local server’s apply position reaches <pos> or <ms> elapses. Server-layer command: the engine refuses it (EngineError::Unsupported) since lag_state lives in spg-server’s ServerState.

Fields

§pos: u64
§timeout_ms: Option<u64>

None → wait forever; Some(ms) → return after ms milliseconds even if the target isn’t reached.

§

Analyze(Option<String>)

v6.2.0 — ANALYZE [<table>]. Bare form walks every user table; ANALYZE <name> re-stats just one. Populates spg_statistic with per-column null_frac + n_distinct + 100-bucket equi-depth histogram.

§

CompactColdSegments

v6.7.3 — COMPACT COLD SEGMENTS. Walks every user table’s BTree-cold indices and merges small cold-tier segments (size below SPG_COMPACTION_TARGET_SEGMENT_BYTES, default 4 MiB) into a single larger segment per (table, index). WHERE predicate filtering on which tables to compact is carved out of v6.7.3 (per V6_7_DESIGN.md STABILITY entry); v6.7.3 only supports the bare form.

§

SetParameter

v7.12.1 — SET <name> [TO|=] <value>. Records a session parameter on the engine; v7.12.1 honours default_text_search_config (consumed by to_tsvector / plainto_tsquery family when called without an explicit config arg). All other names are accepted as a no-op so PG dumps with SET client_encoding, SET search_path etc. load cleanly.

Fields

§name: String
§value: SetValue
§

SetParameterList(Vec<(String, SetValue)>)

v7.14.0 — SET a = 1, b = 2, … MySQL-flavoured multi-assignment (mysqldump preamble uses SET @OLD_FOREIGN_KEY_CHECKS = @@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0). Engine applies each pair in source order. Pairs whose LHS is a MySQL session/user variable (@VAR / @@VAR) are recorded with the raw name so the engine can ignore them; pairs whose LHS is a recognised engine parameter (e.g. FOREIGN_KEY_CHECKS) go through the regular set_session_param path.

§

ResetParameter(Option<String>)

v7.12.1 — RESET <name> / RESET ALL. Restores parameter to its default. No-op for parameters SPG does not track.

§

CreateFunction(CreateFunctionStatement)

v7.12.4 — CREATE [OR REPLACE] FUNCTION name(args) RETURNS <type> [LANGUAGE <lang>] AS $$ body $$ [LANGUAGE <lang>]. v7.12.4 ships plpgsql for RETURNS TRIGGER bodies (the CREATE TRIGGER + AFTER/BEFORE row-level pipeline). Other languages parse but error at exec time with a clear unsupported message.

§

CreateTrigger(CreateTriggerStatement)

v7.12.4 — CREATE [OR REPLACE] TRIGGER name {BEFORE|AFTER} {INSERT|UPDATE|DELETE} [OR ...] ON tbl FOR EACH ROW EXECUTE {FUNCTION|PROCEDURE} fn_name(). STATEMENT-level triggers and column-list / WHEN clauses are out of scope for v7.12.4.

§

DropTrigger

v7.12.4 — DROP TRIGGER [IF EXISTS] name ON tbl. Silent no-op when missing if IF EXISTS is set.

Fields

§name: String
§table: String
§if_exists: bool
§

DropFunction

v7.12.4 — DROP FUNCTION [IF EXISTS] name. Same shape as DROP TRIGGER but global (no table scope).

Fields

§name: String
§if_exists: bool

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

Formats the value using the given formatter. 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.

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,

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.