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

Goal

Понять модель совместимости AngaraBase с PostgreSQL и быстро интерпретировать ошибки при тестировании.

Approach

AngaraBase реализует ограниченное подмножество PostgreSQL SQL через pgwire-протокол. Неподдерживаемые конструкции возвращают явный SQLSTATE (чаще всего 0A000 feature_not_supported), а не молчаливый некорректный результат.

Принцип: fail-closed — если feature не реализован, клиент получает детерминированную ошибку.

Source of truth

ИсточникПуть
Known issues (canonical)angarabook/src/operations/known-issues.md
Compat probes (tests)tools/compat_suite/run.sh
User-facing known issuesKnown issues

Practical advice

  • ORM/tooling (DBeaver, psql, Hibernate и др.) часто выполняют pg_catalog запросы при подключении. Ориентируйтесь на результаты compat suite режимов --dbeaver-smoke / --nightly.
  • Если вы наблюдаете hang/stall — это P0/P1 bug. Соберите артефакты по инструкции в Support.

SQLSTATE quick reference

SQLSTATENameTypical scenario
0A000feature_not_supportedWITH RECURSIVE, complex RLS predicates, multi-column ON CONFLICT target, ON CONFLICT ON CONSTRAINT
23514check_violationPartition routing: no matching partition and no DEFAULT
42809wrong_object_typeUPDATE/DELETE on append-only table; PK/FK update under no_delete
22023invalid_parameter_valueInvalid stats_level_max, invalid break-glass TTL, setval value out of [MINVALUE..MAXVALUE]
42501insufficient_privilegeMissing roles for security operations, no SecurityContext
25001active_sql_transactionSET SESSION CONTEXT inside an active transaction
2200Hsequence_generator_limit_exceedednextval past MAXVALUE/MINVALUE without CYCLE (RM-0.6.3.7)
55000object_not_in_prerequisite_statecurrval(seq) before any nextval in the current session (RM-0.6.3.7, session-bound contract)
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

Полный список с контекстом: Known issues.

SQL reference pages

Текущий статус подсистем SQL на ветке 0.6.x. Бэйджи отражают, насколько подсистема покрыта pinned-тестами compat-suite и можно ли на неё опираться в production-сценариях.

ТемаСтраницаСтатус
Типы данныхdata-types.mdStable
DDL (CREATE, ALTER, DROP)ddl.mdStable
DML (INSERT, UPDATE, DELETE)dml.mdStable
Запросы (CTE, JOIN, ORDER BY)queries.mdStable
Секционирование таблицpartitioning.mdBaseline

SQL Functions (RM-0.6.5.5)

AngaraBase implements a subset of PostgreSQL built-in functions.

FunctionSignatureDescription
NOW()() → timestampCurrent UTC time
CURRENT_TIMESTAMP() → timestampAlias for NOW()
date_trunc(field, ts)(text, timestamp) → timestampTruncate timestamp to field. Supported fields: microseconds, milliseconds, second, minute, hour, day, week, month, quarter, year, decade, century, millennium. Unknown field returns NULL.
set_config(name, val, local)(text, text, bool) → textStub: returns val. Used for Django compatibility.
obj_description(oid, cat)(oid, text) → textStub: returns NULL. Used for Django introspection.

Vector execution visibility

When vector execution mode allows vector path (ANGARABASE_SQL_EXECUTION_MODE=auto for supported plans, or force_vector), EXPLAIN surfaces vector operator names:

  • VectorSeqScan
  • VectorFilter
  • VectorProject
  • VectorHashJoin
  • VectorAgg

If the plan shape is not supported by AngaraVector, planner/executor keeps row operators in EXPLAIN.

Execution mode behavior:

  • auto (default) — Stable use vector only for fully supported plan shapes, otherwise deterministic row fallback.
  • force_rowStable always use row executor.
  • force_vectorExperimental fail-closed with feature_not_supported if vector execution is not possible. Подходит для целевого тестирования векторного пути; не рекомендуется для production-нагрузки в 0.6.x.

AngaraMemory table options

CREATE TABLE ... WITH (...) now supports bounded memory-table surfaces:

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

If max_rows is omitted for memory tables, bounded default is applied from instance policy.

Behavior clarification for durability='snapshotted':

  • DML hot path does not perform immediate page persistence.
  • Checkpoint worker applies per-table scheduling using each table’s checkpoint_interval_ms (with bounded fallback).