On 01/03/2012, at 8:28 AM, Richard Hipp wrote: > SQLite implements CHECK constraints by concatenating all expressions from all > CHECK constraints on the table using AND and then evaluating the resulting > boolean to see if it is false. If it is false, an SQLITE_CONSTRAINT error is > raised. > > We *could* keep track of each separate CHECK expression and remember the > constraint name and evaluate each expression separately and output a > customized error message for each failure. But that would require a lot of > extra code space, which is not "lite".
Though I'm sure that your programming skill far exceeds mine, I understand what you're saying about some extra overhead, since it's a common programming choice we make each day "Will I lump the error checks together for a boolean result, or will I write a separate if/then for each check and notify of the actual error?" However, I would urge and plead with you to consider providing doing the latter. All the constraints and error checking is of limited value when we can't tell what actual constraint or check failed, especially when it means I basically have to reinvent the wheel to perform the same checks externally, and hope that my logic replicates SQLite's. I come across this frustration with nearly every SQLIte database I create. I fastidiously design my database schema to prevent inconsistent data, with many constraints (eg not null, foreign keys etc). When I import some data or have someone enter some data, I need SQLite to tell me which of those many constraints failed and where. Otherwise it makes the preparation largely useless and requires manual or application level duplication of the logic which is redundant, imprecise and difficult to maintain. Thanks for your consideration and an otherwise outstanding product. 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