pgref.dev/sqlite/errors/SQLITE_CONSTRAINT_VTAB
SQLITE_CONSTRAINT_VTABERRORTier 2 — Caution⚠️ MEDIUM confidence

Virtual table constraint violation

Category: ConstraintVersions: 3.0+

🔴 Production Risk Error

Medium — DML rejected by virtual table constraint.

What this means

SQLITE_CONSTRAINT_VTAB (2323) is returned by a virtual table's xUpdate method to signal a constraint violation within the virtual table's own logic — not a SQLite core constraint.

Why it happens

  1. 1Custom virtual table rejected an INSERT, UPDATE, or DELETE via xUpdate returning SQLITE_CONSTRAINT.
  2. 2FTS virtual table rejecting an operation that violates its constraints.

How to reproduce

DML on a virtual table where xUpdate returns SQLITE_CONSTRAINT.

trigger — this will ERROR
-- FTS5 example: duplicate row ID in direct content mode
INSERT INTO fts_table(rowid, content) VALUES(1, 'hello');
INSERT INTO fts_table(rowid, content) VALUES(1, 'world'); -- constraint
sqlite3.IntegrityError: constraint failed

Fix 1

Why this works

Check the virtual table documentation for its specific constraint rules.

Fix 2

Why this works

Ensure row IDs are unique when using direct-content FTS.

Sources

📚 Official docs: https://www.sqlite.org/rescode.html#constraint_vtab

🔧 Source ref: sqlite3.h — SQLITE_CONSTRAINT_VTAB = 2323

📖 Further reading: SQLite virtual table API

Confidence assessment

⚠️ MEDIUM confidence

Stable.

See also

⚙️ This error reference was generated with AI assistance and reviewed for accuracy. Examples are provided to illustrate common scenarios and may not cover every case. Always test fixes in a development environment before applying to production. Spotted an error? Suggest a correction →