SQLite Forum

Bug report: inconsistent error message across different CONSTRAINT types
Login
> Why not?

It is likely to break in future versions. The exact syntax of error messages is _not_ part of the API.

The only practical way of giving the calling code semantic information about the error is through additional error fields, such as the standard SQLSTATE, or Postgres' PG_DIAG_STATEMENT_POSITION. SQLite does not have those fields, so there is no good solution.