Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

SQL compatibility overview

AngaraBase implements a subset of PostgreSQL SQL via the pgwire protocol. The principle is fail-closed: an unsupported construct returns an explicit SQLSTATE (most often 0A000 feature_not_supported), not a silent incorrect result. This page is a map of what is supported and how to interpret errors.

Standard SQL constructs

A matrix of what AngaraBase understands in queries. Supported — correct semantics with pinned tests; Partial — works with limits (see note); 0A000 — an unsupported form returns a deterministic error.

Queries (SELECT)

ConstructStatusNote
SELECT … FROM … WHERE …, LIMIT, OFFSET✅ Supportedpredicates: comparisons, IN, BETWEEN, IS [NOT] NULL, AND/OR/NOT, boolean column as predicate
ORDER BY <col> / <expr> / ordinal✅ SupportedNULLS FIRST/LAST and COLLATE0A000; bad ordinal → 42P10
DISTINCT✅ SupportedDISTINCT ON (...)0A000
GROUP BY (incl. multi-key) · HAVING✅ Supportedaggregates COUNT/SUM/MIN/MAX/AVG; HAVING without GROUP BY too
WITH (CTE, non-recursive)✅ SupportedCTE as a source in FROM; WITH RECURSIVE and data-modifying CTE0A000 (recursive — planned v0.7)
Subqueries: IN (…), EXISTS/NOT EXISTS, scalar in SELECT✅ Supportedcorrelated supported
Set ops: UNION, UNION ALL, INTERSECT, EXCEPT✅ Supportedhash-based dedup

JOIN

ConstructStatusNote
INNER, LEFT [OUTER], RIGHT [OUTER], FULL [OUTER], CROSS✅ Supportedall five kinds
Join conditionON <expr>USING (...) and NATURAL JOIN0A000
LATERAL (…)✅ Supportedcorrelated derived table
CROSS JOIN row budget⚠️ Partiallimit sql.join.max_cross_join_rows (default 1,000,000); overflow → 54000

Window functions (OVER (…))

FunctionStatusNote
ROW_NUMBER, RANK, DENSE_RANK✅ SupportedPARTITION BY / ORDER BY
LAG, LEAD, FIRST_VALUE, LAST_VALUE✅ Supported
SUM/COUNT/AVG/MIN/MAX OVER (…)✅ Supportedwindow aggregates
NTILE, named windows (WINDOW clause)0A000

DDL / DML / types

Detailed tables and Expected SQLSTATE live on the section pages:

TopicPageStatus
Data typesdata-types.mdStable
DDL (CREATE, ALTER, DROP)ddl.mdStable
DML (INSERT, UPDATE, DELETE)dml.mdStable
Queries (CTE, JOIN, ORDER BY)queries.mdStable
Table partitioningpartitioning.mdBaseline

Key DDL boundaries: CREATE MATERIALIZED VIEW is supported, plain CREATE VIEW is planned (0A000), CREATE TRIGGER is a non-goal (0A000), FOREIGN KEY is accepted as NOT ENFORCED.

SQLSTATE quick reference

SQLSTATENameTypical scenario
0A000feature_not_supportedWITH RECURSIVE, JOIN … USING/NATURAL, NTILE, named windows, DISTINCT ON, plain CREATE VIEW (planned), CREATE TRIGGER (non-goal), complex RLS predicates
54000program_limit_exceededCROSS JOIN over the budget sql.join.max_cross_join_rows (default 1,000,000)
23514check_violationPartition routing: no matching partition and no DEFAULT
42809wrong_object_typeUPDATE/DELETE on append-only; PK/FK update under no_delete
22023invalid_parameter_valueInvalid stats_level_max, break-glass TTL, setval out of [MINVALUE..MAXVALUE]
42501insufficient_privilegeMissing roles for security operations, no SecurityContext
25001active_sql_transactionSET SESSION CONTEXT inside an active transaction
42P10invalid_column_referenceORDER BY ordinal out of column range
2200Hsequence_generator_limit_exceedednextval past MAXVALUE/MINVALUE without CYCLE
55000object_not_in_prerequisite_statecurrval(seq) before any nextval in the current session
42P07duplicate_objectCREATE SEQUENCE of an existing name without IF NOT EXISTS
42P01undefined_tableDROP SEQUENCE / nextval / currval / setval on a missing sequence
428C9generated_alwaysINSERT with explicit non-NULL into a GENERATED ALWAYS AS IDENTITY column

Full list with context: Known issues.

Connecting ORMs and tools

ORMs and clients (DBeaver, psql, Hibernate, Django, etc.) run housekeeping pg_catalog queries on connect. AngaraBase supports the basic pg_catalog introspection these tools need to connect. If a client fails to connect, see Client compatibility.

If a query hangs (no response), that is a defect on our side — please collect artifacts per Support and report it.

Built-in SQL functions

FunctionSignatureDescription
NOW()() → timestampCurrent UTC time
CURRENT_TIMESTAMP() → timestampAlias for NOW()
date_trunc(field, ts)(text, timestamp) → timestampTruncate to field (secondmillennium); unknown field → NULL
set_config(name, val, local)(text, text, bool) → textStub: returns val (Django compatibility)
obj_description(oid, cat)(oid, text) → textStub: returns NULL (Django introspection)

Vector execution visibility

When the execution mode allows the vector path (ANGARABASE_SQL_EXECUTION_MODE=auto for supported plans, or force_vector), EXPLAIN shows vector operator names: VectorSeqScan, VectorFilter, VectorProject, VectorHashJoin, VectorAgg. If AngaraVector does not support the plan shape, row operators remain in EXPLAIN.

ANGARABASE_SQL_EXECUTION_MODE modes:

  • auto (default) — Stable vector only for fully supported plan shapes, else a deterministic row fallback;
  • force_rowStable always the row executor;
  • force_vectorExperimental fail-closed with feature_not_supported if vector execution is impossible; for targeted testing, not for production workloads in 0.6.x.

AngaraMemory table options

CREATE TABLE ... WITH (...) supports bounded in-memory tables:

  • storage='memory'Baseline AngaraMemory table engine;
  • durability='none'|'logged'|'snapshotted'Baseline volatile/durable;
  • max_rows=<n>Stable hard row cap; overflow fails closed (54023);
  • eviction_policy='error'|'fifo'Experimental default error;
  • checkpoint_interval_ms=<n>Baseline only with durability='snapshotted'.

If max_rows is omitted, a bounded default from instance policy applies. With durability='snapshotted' the DML hot path does not persist pages immediately — the checkpoint worker schedules writes per checkpoint_interval_ms.