INSERT OR REPLACE + foreign key ON DELETE CASCADE working too good

前端 未结 3 606
谎友^
谎友^ 2020-12-16 13:08

I am currently trying to create an sqlite database where I can import a table from another sqlite database (can\'t attach) and add some extra data to each column.

Si

3条回答
  •  醉酒成梦
    2020-12-16 13:49

    What about the reasons of such behavior, there's an explanation from PostgreSQL team:

    Yeah, this is per SQL spec as far as we can tell. Constraint checks can be deferred till end of transaction, but "referential actions" are not deferrable. They always happen during the triggering statement. For instance SQL99 describes the result of a cascade deletion as being that the referencing row is "marked for deletion" immediately, and then

    1. All rows that are marked for deletion are effectively deleted at the end of the SQL-statement, prior to the checking of any integrity constraints.

提交回复
热议问题