On Fri, May 24, 2013 at 2:47 PM, Clemens Ladisch <clem...@ladisch.de> wrote:
> Foreign key checks are not intended to prevent user errors but to > prevent programming errors. In other words, your program is responsible > for preventing the user from trying to delete some X that is still > referenced by some Y (by doing a check before deleting, or, preferrably, > by structuring the UI so that deleting such a X is not possible). > I am sorry but I disagree. If my program was to prevent the FK violation it would have to do a query; infact it would be the exact same query the SQLite engine does in order to enforce the FK. This is clearly redundant. Apart from performance, there is also the issue of concurrency, where the program does the query , decides it is OK to make the change but in the meantime somebody else has made another change that invalidates the program's change, for instance inserted a detail record to the master the user is trying to delete. _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users