When I run the following piece of SQL in an empty database, I get a
"no such table: main.table_e" error on the second "DROP TABLE"
statement:

CREATE TABLE table_e (
    eid TEXT PRIMARY KEY
);

CREATE TABLE table_t (
    tid   TEXT PRIMARY KEY,
    value TEXT
);

CREATE TABLE table_b (
    -- Foreign Keys
    eid TEXT REFERENCES table_e(eid)
        ON DELETE CASCADE ON UPDATE CASCADE
        DEFERRABLE INITIALLY DEFERRED,
    tid TEXT REFERENCES table_t(tid)
        ON DELETE CASCADE ON UPDATE CASCADE
        DEFERRABLE INITIALLY DEFERRED,

    value TEXT,

    PRIMARY KEY (eid, tid)
);

DROP TABLE table_e;
DROP TABLE table_t;

If I remove the lines that say

ON DELETE CASCADE ON UPDATE CASCADE

the problem goes away.

Note that there are no records in any of these tables.  Also,
It doesn't matter whether I wrap the whole thing in
a transaction or not.

Is this expected behavior?

Will
--
Will Duquette -- william.h.duque...@jpl.nasa.gov
Athena Development Lead -- Jet Propulsion Laboratory
"It's amazing what you can do with the right tools."

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

Reply via email to