aiondb-pg-compat

PostgreSQL compatibility layer. Houses the rewrites, parsers, registries, dispatch contracts, and error/message shaping that AionDB applies on top of its native engine to keep PostgreSQL clients and tooling working. The wire-protocol runner lives in aiondb-pgwire and the SQL engine itself lives in aiondb-engine. This crate is the dependency-light home for everything in between, and re-exports the pure scanners from aiondb-pg-syntax.

cargo

[dependencies]
aiondb-pg-compat = { path = "../aiondb-pg-compat" }

modules

modulepurpose
advisoryclassify and parse pg_advisory_* calls.
check_constraintsparse inline CHECK constraints from CREATE TABLE.
commandCompatCommand baseline tied to Statement::compat_tag.
compat_tag_matrixsingle source of truth for accepted compat tags and their guaranteed behaviour.
cursorDECLARE CURSOR, FETCH, MOVE, CLOSE, and WHERE CURRENT OF rewrites.
dispatchPgCompatHooks trait the engine implements to host the compat layer.
dispositiontyped classification of statements handed to the compat layer.
dml_validationAST analysis for the WITH-DML rule validator.
error_catalogtyped CompatFailureKind and stable mapping to SqlState.
metricsper-CompatCommand counters and parse/bind/execute histograms.
noop_validationreject unknown compat command tags before runtime dispatch.
oidjoinsdetection and NOTICE extraction for the PG oidjoins regression probe.
preparedPREPARE/EXECUTE helpers and type-name normalisation.
privilegesmap between parser GRANT/REVOKE AST and catalog privilege descriptors.
registriesvalue types for engine-side compat registries (databases, role membership).
rewritepre-parse text rewrites and small post-parse fix-ups.
rolesparsers for DROP OWNED BY, REASSIGN OWNED BY, DROP ROLE.
startupstartup parameter whitelist and options=... tokenizer.
stateversioned compat state (CompatMiscObjects, DomainDefs, CastDefs, RuleDefs).
statement_policyper-statement policy gates.
type_trackingparsers for CREATE TYPE, CREATE/ALTER/DROP DOMAIN.

The pure scanners and parsers from aiondb-pg-syntax are re-exported: do_parsers, do_scan, parsed_commands, prepare, preparse, rule_parsers, scan, type_ref.

key types

itemdescription
PgCompatHooks traitengine contract used by compat dispatch (in dispatch).
CompatCommandactive typed compat-command baseline.
CompatFailureKindtyped compat error categories with stable SqlState mapping.
CompatObjectFamily, CompatObjectKeykeys used by the persisted compat state.
COMPAT_STATE_SCHEMA_VERSIONschema version of the compat state.
OIDJOINS_EXPECTED_OUTPUTsnapshot of the PG oidjoins expected output, shared with pg-regress.
WITH_DML_RULE_ERROR_PREFIXre-export tag prefix used by the WITH-DML rewrite.

example

use aiondb_pg_compat::OIDJOINS_EXPECTED_OUTPUT;
use aiondb_pg_compat::scan::trim_compat_statement;

assert!(!OIDJOINS_EXPECTED_OUTPUT.is_empty());
assert_eq!(trim_compat_statement("SELECT 1;"), "SELECT 1");