Error Reference

AionDB maps database errors to PostgreSQL-style SQLSTATE codes where possible. Clients can inspect SQLSTATE instead of parsing message text.

SQLSTATE codes

The full set of SQLSTATEs the engine emits today. Codes are grouped by class.

Class 0A — feature not supported

SQLSTATEMeaning
0A000Feature not supported.

Class 20 / 22 — data exceptions

SQLSTATEMeaning
20000Case not found.
22001String data right truncation.
22003Numeric value out of range.
22007Invalid datetime format.
22008Datetime field overflow.
22012Division by zero.
22023Invalid parameter value.
22P02Invalid text representation.

Class 23 — integrity constraint violation

SQLSTATEMeaning
23502Not-null violation.
23503Foreign-key violation.
23505Unique violation.
23514Check-constraint violation.

Class 24 / 34 — cursor

SQLSTATEMeaning
24000Invalid cursor state.
34000Invalid cursor name.

Class 25 / 2B — transaction state

SQLSTATEMeaning
25P01No active SQL transaction.
25P02In failed SQL transaction.
25P03Idle-in-transaction session timeout.
2BP01Dependent objects still exist.

Class 28 — authentication

SQLSTATEMeaning
28000Invalid authorization specification.
28P02Too many authentication failures.

Class 3B / 3D / 3F — catalog & savepoints

SQLSTATEMeaning
3B001Invalid savepoint specification.
3D000Invalid catalog name.
3F000Invalid schema name.

Class 40 — transaction rollback

SQLSTATEMeaning
40001Serialization failure.
40P01Deadlock detected.

Class 42 — syntax & access rule

SQLSTATEMeaning
42501Insufficient privilege.
42601Syntax error.
42701Duplicate column.
42703Undefined column.
42704Undefined object.
42710Duplicate object.
42725Ambiguous function.
42803Grouping error.
42804Datatype mismatch.
42809Wrong object type.
42883Undefined function.
42P01Undefined table.
42P02Undefined parameter.
42P06Duplicate schema.
42P10Invalid column reference.
42P16Invalid table definition.

Class 53 / 54 — resource & program limit

SQLSTATEMeaning
53300Too many connections.
54000Program limit exceeded.

Class 55 — object not in prerequisite state

SQLSTATEMeaning
55000Object not in prerequisite state.
55P03Lock not available.

Class 57 — operator intervention

SQLSTATEMeaning
57014Query canceled.
57P01Admin shutdown.
57P05Idle-session timeout.

Class P0 — PL/pgSQL

SQLSTATEMeaning
P0001RAISE EXCEPTION.
P0002No data found.
P0003Too many rows.
P0004Assert failure.

Class XX — internal

SQLSTATEMeaning
XX000Internal error.

Error handling guidance

Applications should branch on SQLSTATE class or exact SQLSTATE where possible:

Message text is for humans. SQLSTATE is for programs. Error wording may become clearer over time, but applications should not depend on exact message strings.

Examples

Undefined table:

SELECT * FROM missing_table;

Expected class: 42xxx, with 42P01 when mapped precisely.

Unsupported feature:

CREATE EXTENSION pg_trgm;

Expected class: 0A000 when the feature is intentionally unsupported.

Constraint violation:

CREATE TABLE unique_demo (id INT PRIMARY KEY);
INSERT INTO unique_demo VALUES (1);
INSERT INTO unique_demo VALUES (1);

Expected class: 23xxx, with 23505 for unique violation where implemented.

Transaction errors

Errors inside a transaction can affect subsequent statements. Drivers often expect PostgreSQL-style transaction state handling, so test the exact client behavior:

BEGIN;
SELECT * FROM missing_table;
ROLLBACK;

Record whether the client can continue after rollback and which SQLSTATE was returned for the original error.

Reporting errors

When reporting an error, include:

If another database is the reference, include its SQLSTATE and message too. That makes compatibility work precise.