On 06/04/2012, at 11:02 AM, Richard Hipp wrote: > On Thu, Apr 5, 2012 at 8:50 PM, BareFeetWare <list....@barefeetware.com>wrote: > >> On 06/04/2012, at 12:12 AM, Richard Hipp wrote: >> >>> The way SQLite keeps track of foreign key constraints is by use of a >>> counter...
>>> we don't have any way of knowing which of the many constraints caused the >>> problem. >> >> Please change this. Use a hash table or array or something instead of a >> counter so SQLite knows what constraint failed. > > There are tradeoffs here. "Better constraint error tracking" is just another > way of say "runs slower and uses more memory". Thanks for continuing the discussion. I think this is a very important issue, as I think do others who have asked over the years. OK, so it's not an issue of programming difficulty - good to know - but is a performance issue. I can think of a few remedies for this: 1. Us the counter first. If there is a constraint violation, step through again with a hash table or array to track the specific violation. That way it will only be "slower" if there was an error, which will have stopped the operation anyway. or: 2. Have a pragma that allows us to enable descriptive errors. We can choose to enable it when needed, or else we can do our own "if constraint error then enable pragma for descriptive errors and try again, show output". I would also be interested in seeing what % speed difference it actually makes. Benefits include: 1. SQLite's core logic becomes much more usable, eliminating a lot of superfluous, redundant and inaccurate external checking. I'm a big believer in the "keep the logic near the model" philosophy. 2. It will save hours of frustration trying to find the source of otherwise non-descriptive errors. 3. You will save yourself from another two years of people asking for this feature ;-) Thanks for your consideration, Tom Tom Brodhurst-Hill BareFeetWare -- iPhone/iPad/iPod and Mac software development, specialising in databases develo...@barefeetware.com -- Twitter: http://twitter.com/barefeetware/ Facebook: http://www.facebook.com/BareFeetWare _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users