SQL
On this page
Workflows
Triggers and schedules invoke a workflow. Only asynchronous or scheduled execution becomes a durable TASK.
There is no second procedure language.
WORKFLOW#
Parameters are immutable and referenced as $name. Bare identifiers remain column names. The body is parsed and bound at create time.
V1 bodies may contain bounded INSERT / UPSERT / UPDATE / DELETE and nested RUN WORKFLOW. Result-producing SELECT, DDL, BEGIN / COMMIT / ROLLBACK, and trigger/schedule DDL are rejected.
Manual RUN WORKFLOW is synchronous and atomic: autocommit wraps the whole invocation; inside an explicit transaction it participates in the caller's transaction. The result is one command with the sum of affected rows. V1 bodies cannot return row sets.
V1 always uses invoker rights. CREATE needs database CREATE; RUN needs EXECUTE on the workflow and every privilege the body statements require.
OR REPLACE, output parameters, defaults, overloading, dynamic SQL, exception blocks, and security-definer execution are not part of v1.
TRIGGER#
Row-level only. A trigger invokes an existing workflow:
INSERT exposes NEW.column, DELETE exposes OLD.column, UPDATE exposes both. V1 BEFORE triggers cannot mutate NEW. Every invocation is synchronous in the originating DML transaction; an error aborts the statement. Nesting is capped at 8.
SCHEDULE and TASK#
EVERY is a Go-style duration from 1s through 8760h. AT is a future RFC 3339 timestamp stored as UTC. CRON is a five-field expression evaluated in UTC. Scheduled invocation stores the schedule creator, then reapplies that principal and rechecks privileges on every task attempt.
Inspect live state with system.workflows, system.tasks, system.triggers, and system.schedules. See System catalog.
Engine note: `docs/workflows.md`.