Knowing specifically which FOREIGN KEY constraint failed in SQLite

前端 未结 1 1707
时光取名叫无心
时光取名叫无心 2021-01-18 04:24

I get the SQLite error message \"FOREIGN KEY constraint failed\". That\'s the complete error information (besides a part of the SQL query) and it\'s not helpful. (In fact it

相关标签:
1条回答
  • 2021-01-18 04:39

    Due to the way in which deferred FK constraints are implemented in SQLite, this information is not available when the error is raised.

    You could reimplement the FK checks as triggers. Alternatively, log the values in the failed command, and look up the data by hand.

    0 讨论(0)
提交回复
热议问题