On Wed, Nov 18, 2015 at 3:22 PM, Yuri <yuri at rawbw.com> wrote:

> On 11/18/2015 09:55, R Smith wrote:
>
>> There is no "first" constraint that can fail. There is a procession of
>> constraints either within a statement or within a transaction (both can
>> have many constraints) and as they are required, they are counted up, and
>> as they become resolved they are counted down. At the end the result is
>> simply either that "some constraint failed" or "All resolved eventually".
>>
>
> Why not have two variants of the error message: one for immediate failure
> with the foreign key name, and one like now, for the complicated case of
> delayed constraints?


What do you plan to use the error message for?  There is generally no
interface contract with error messages, so you can't generally depend on
them being readable by code.  They are helpful to the developer, but
usually they just save you a few minutes figuring it out yourself.  I'm not
hating on your few minutes, but saving a few milliseconds or bytes at
runtime on a few million devices is worth a periodic few minutes of my
time.  You can use SQL to generate pretty complicated schema and queries,
so in the limit this kind of problem can be pretty deep to resolve!

Maybe it would make sense to have some sort of
SQLITE_WITH_EXTENDED_FK_ERRORS type define so that you can get a better
edit/compile/run loop going in development, without being expensive in
production.

-scott

Reply via email to