Hello all,

I have PRAGMA foreign_keys = ON

With:
     pysqlite version is 2.4.1
     sqlite3 version is 3.6.23.1

And the tables:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CREATE TABLE tags_product (
     id INTEGER PRIMARY KEY,
     tag_id INTEGER NOT NULL,
     product_id INTEGER NOT NULL,
     FOREIGN KEY(tag_id) REFERENCES tags(id),
     FOREIGN KEY(tag_id) REFERENCES product_product(id) ON DELETE 
CASCADE ON UPDATE CASCADE,
     UNIQUE('tag_id', 'product_id')
);

CREATE TABLE tags (
     id INTEGER PRIMARY KEY,
     tag_name TEXT NOT NULL UNIQUE
);

CREATE TABLE product_product (
     id INTEGER PRIMARY KEY,
     [etc.]
);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

I have several rows in tags_product linked to a row in parent table 
product_product.
When I delete the product_product row, I expect all of the related rows 
in tags_product to automatically be deleted.
I find that only one of the rows in tags_product gets deleted.

My application (with PRAGMA foreign_keys = ON) creates all of the rows.

I used the command line sqlite3 (with PRAGMA foreign_keys = ON) to 
delete the product_product row.

What's going on?

Mark

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to