[tarantool-patches] Re: [PATCH v2 3/5] sql: fix fkey exception for self-referenced table
n.pettik
korablev at tarantool.org
Sat Dec 29 16:26:17 MSK 2018
> UPDATE operation doesn't fail when fkey self-reference condition
> unsatisfied, when table has other records.
Nit: ... and table has other records.
> To do not raise error where it is not necessary Vdbe makes
It is russian-like collocation, we can’t ‘make’ lookup.
"… Vdbe inspects parent table emitting OP_Found" (or smth like this)
> lookup in parent table with OP_Found. This branch is not valid
> for self-referenced table since its looking for a tuple affected
> by UPDATE operation and since the foreign key has already
> detected a conflict it mast be raised.
Nit: must.
Sorry for being so picky.
>
> Example:
> CREATE TABLE t6(a INTEGER PRIMARY KEY, b TEXT, c INT, d TEXT, UNIQUE(a, b),
> FOREIGN KEY(c, d) REFERENCES t6(a, b));
> INSERT INTO t6 VALUES(1, 'a', 1, 'a');
> INSERT INTO t6 VALUES(100, 'one', 100, 'one');
> UPDATE t6 SET c = 1, d = 'a' WHERE a = 100;
> -- fk conflict must be raised here
>
> Needed for #3850
> Closes #3918
> —
Patch itself is OK.
Anyway, I am still interested why SQLite demonstrates
this behaviour. I believe they know about it and don't
fix it so far.
More information about the Tarantool-patches
mailing list