Generically Identify The Rowid Causing A Constraint Conflict In Sqlite
I need to identify the row that caused a constraint check to fail after an INSERT OR IGNORE statement. I need this for a tool that generates SQL statements, so I can't tie this to
Solution 1:
This is not possible even in theory.
Not all constraint failures involve data outside the row being inserted. For instance, CHECK constraints often will not. There would be no row id to report in this case.
An INSERT could fail multiple constraints applied to different rows in other tables. Which one would you be interested in?
If there's a way to find out what table a row is in based on the row id, I don't know what it is, so having the raw row id would probably not be much use.
Finally, row ids are optional in SQLite; you can create a table with the row id column using WITHOUT ROWID.
Post a Comment for "Generically Identify The Rowid Causing A Constraint Conflict In Sqlite"