pub enum ParsedStatement {
Show 62 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),
Merge(MergeStatement),
Begin,
Commit,
Rollback,
Savepoint(String),
RollbackToSavepoint(String),
ReleaseSavepoint(String),
ShowTables,
ShowDatabases,
ShowCreateTable(String),
ShowIndexes(String),
ShowStatus,
ShowVariables,
ShowProcesslist,
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,
},
CreateSequence(CreateSequenceStatement),
AlterSequence(AlterSequenceStatement),
DropSequence {
names: Vec<String>,
if_exists: bool,
},
CreateView(CreateViewStatement),
DropView {
names: Vec<String>,
if_exists: bool,
},
CreateMaterializedView(CreateMaterializedViewStatement),
RefreshMaterializedView {
name: String,
with_data: bool,
},
DropMaterializedView {
names: Vec<String>,
if_exists: bool,
},
CreateType(CreateTypeStatement),
DropType {
names: Vec<String>,
if_exists: bool,
},
CreateDomain(CreateDomainStatement),
DropDomain {
names: Vec<String>,
if_exists: bool,
},
CreateSchema {
name: String,
if_not_exists: bool,
},
DropSchema {
names: Vec<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(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].
Merge(MergeStatement)
v7.17.0 Phase 3.P0-42 — SQL:2003 / PG 15+ MERGE statement.
MERGE INTO target [alias] USING source [alias] ON cond WHEN MATCHED [AND cond] THEN { UPDATE SET … | DELETE | DO NOTHING } WHEN NOT MATCHED [AND cond] THEN { INSERT (cols) VALUES (vals) | DO NOTHING } [WHEN …]. SPG v7.17 supports table-based source (subquery
source is a follow-up); BY SOURCE / BY TARGET and RETURNING
are also follow-ups.
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.
ShowDatabases
v7.17.0 Phase 3.P0-58 — MySQL SHOW DATABASES /
SHOW SCHEMAS. SPG is single-database; the executor
returns the canonical MySQL set so the mysql / MariaDB
client populates its database selector.
ShowCreateTable(String)
v7.17.0 Phase 3.P0-59 — MySQL SHOW CREATE TABLE <t>
returns a 2-column row (Table, "Create Table") carrying
the synthesized DDL. mysqldump emits this for every
table at scrape time.
ShowIndexes(String)
v7.17.0 Phase 3.P0-60 — MySQL SHOW INDEXES FROM <t>
(also SHOW INDEX, SHOW KEYS).
ShowStatus
v7.17.0 Phase 3.P0-61 — MySQL SHOW STATUS.
ShowVariables
v7.17.0 Phase 3.P0-61 — MySQL SHOW VARIABLES.
ShowProcesslist
v7.17.0 Phase 3.P0-62 — MySQL SHOW PROCESSLIST.
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).
CreateSequence(CreateSequenceStatement)
v7.17.0 — CREATE [TEMPORARY] SEQUENCE [IF NOT EXISTS] name [AS data_type] [INCREMENT [BY] n] [MINVALUE n | NO MINVALUE] [MAXVALUE n | NO MAXVALUE] [START [WITH] n] [CACHE n] [[NO] CYCLE] [OWNED BY {table.col | NONE}].
Closes the round-7+ silent-no-op SEQUENCE story so pg_dump
emits + nextval/currval/setval downstream all work.
AlterSequence(AlterSequenceStatement)
v7.17.0 — ALTER SEQUENCE [IF EXISTS] name <options> with
the same option grammar as CREATE SEQUENCE, plus
RESTART [WITH n] and OWNED BY ... re-attach.
DropSequence
v7.17.0 — DROP SEQUENCE [IF EXISTS] name [, name…] [CASCADE | RESTRICT]. CASCADE / RESTRICT trailers parsed
silently (no FK on sequences).
CreateView(CreateViewStatement)
v7.17.0 Phase 1.2 — CREATE [OR REPLACE] [TEMPORARY] VIEW [IF NOT EXISTS] name [(col, …)] AS <SELECT …>. Closes the
silent-no-op VIEW story from the v7.17 customer-readiness
audit: pre-v7.17 SPG parsed CREATE VIEW as Statement::Empty
so any downstream SELECT FROM v errored with table-not-
found. The view body is stored verbatim; SELECT FROM
DropView
v7.17.0 Phase 1.2 — DROP VIEW [IF EXISTS] name [, name…] [CASCADE | RESTRICT]. Removes the matching view from the
catalog; CASCADE/RESTRICT parsed silently.
CreateMaterializedView(CreateMaterializedViewStatement)
v7.17.0 Phase 1.3 — CREATE MATERIALIZED VIEW [IF NOT EXISTS] name [(col, …)] AS <SELECT …> [WITH [NO] DATA].
Closes the silent-no-op MATERIALIZED VIEW story. Storage
model: the materialised result lives as a regular table
with the matching name + a parallel
materialized_views registry mapping name → body source
(used by REFRESH).
RefreshMaterializedView
v7.17.0 Phase 1.3 — REFRESH MATERIALIZED VIEW name [WITH [NO] DATA]. Re-runs the stored body and replaces the
cached rows. WITH NO DATA truncates without re-running.
DropMaterializedView
v7.17.0 Phase 1.3 — DROP MATERIALIZED VIEW [IF EXISTS] name [, name…] [CASCADE | RESTRICT]. Drops both the
backing table and the source registry entry.
CreateType(CreateTypeStatement)
v7.17.0 Phase 1.4 — CREATE TYPE name AS ENUM ('a', 'b', …). Closes the silent-no-op CREATE TYPE story so PG
dumps that declare enum types load with real constraints
instead of becoming free-form TEXT. Future kinds
(composite / range / domain) extend the inner kind
enum.
DropType
v7.17.0 Phase 1.4 — DROP TYPE [IF EXISTS] name [, name…] [CASCADE | RESTRICT]. Removes the matching enum/domain
from the catalog.
CreateDomain(CreateDomainStatement)
v7.17.0 Phase 1.5 — CREATE DOMAIN name AS base_type [DEFAULT expr] [NOT NULL | NULL] [CHECK (expr)]*.
A DOMAIN is a named CHECK-constrained alias over a built-
in type. The CHECK + NOT NULL + DEFAULT clauses apply to
every column declared with the domain. Closes the
silent-no-op CREATE DOMAIN story so PG dumps that ship
validated identifier types (email, positive_int, …) keep
their guarantees.
DropDomain
v7.17.0 Phase 1.5 — DROP DOMAIN [IF EXISTS] name [, name…] [CASCADE | RESTRICT]. Removes the matching
domain from the catalog.
CreateSchema
v7.17.0 Phase 1.6 — CREATE SCHEMA [IF NOT EXISTS] name [AUTHORIZATION user]. SPG is single-database;
schemas are tracked as a namespace registry so pg_dump
multi-schema declarations land cleanly and SELECT * FROM information_schema.schemata returns real entries.
Schema-qualified schema.table references still strip
the prefix at lookup time per PG (schemas are not
isolation boundaries in v7.17 — see project-next-docket
for the v7.18+ isolation tracking).
DropSchema
v7.17.0 Phase 1.6 — DROP SCHEMA [IF EXISTS] name [, name…] [CASCADE | RESTRICT]. Removes the schema
from the registry; built-in public / pg_catalog /
information_schema cannot be dropped.