Hi Richard,

Richard Hipp <[email protected]> writes:

> Dan has convinced me that the SQLite code is correct as documented.  The
> documentation states:  "Foreign key DML errors are may be reported if: (1)
> The parent table does not exist..."  And for the DELETE statement above, the
> parent table does not exist.  So it is appropriate to rais an error.

My problem with this interpretation is that the key in question is
DEFERRED. The more complete version of the quote above reads like
this:

"
Foreign key DML errors are may be reported if:

 (1) The parent table does not exist, or
 (2) The parent key columns named in the foreign key constraint
     do not exist, or
 ...
"

For DEFERRED keys, rule (2) is not enforced until COMMIT. It is not clear
why rule (1) is not postponed until COMMIT as well.

I agree, this is probably a very murky area and I am not sure it is
worth changing this. However, I think the current SQLite behavior is
not very consistent.

Boris
-- 
Boris Kolpackov, Code Synthesis        http://codesynthesis.com/~boris/blog
Compiler-based ORM system for C++      http://codesynthesis.com/products/odb
Open-source XML data binding for C++   http://codesynthesis.com/products/xsd
XML data binding for embedded systems  http://codesynthesis.com/products/xsde

_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to