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,
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).
DropIndex
v7.14.0 — DROP INDEX [IF EXISTS] name. Removes the
matching index across whichever table holds it.
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
v7.9.27 — PG DO $$ … $$ [LANGUAGE plpgsql]; block. SPG
has no PL/pgSQL; engine returns CommandOk no-op so
pg_dump output with idempotent DO migrations loads
against SPG without splitting scripts. The lexer
consumes the dollar-quoted body into a discarded
Token::String. mailrs migration follow-up H1.
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
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.
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.
DropFunction
v7.12.4 — DROP FUNCTION [IF EXISTS] name. Same shape as
DROP TRIGGER but global (no table scope).