Howdy! I've been experimenting with SQLite3's foreign key support, and I want to check my understanding. I've got an application that regularly takes a number of tables and exports their contents as plain text, and then later imports it again. If I declare foreign key constraints and enable checking of foreign key constraints, I think the following statements are true:
1. If table A references table B, I'm going to have to import B before A or I'll get constraint violations. 2. If table A references itself (e.g., because of a tree structure), I'm going to have to import the rows of A in a particular order or I'll get constraint violations. 3. If two tables reference each other (ugh!) I might have to import the two tables simultaneous, properly interleaved, or I'll get constraint violations. 4. If table A references itself, and I have two rows that reference each other (double-ugh!), the table might not be importable at all. (Note: I don't actually have cases 3 or 4 in my app. :-) These problems can be avoided by disabling foreign key checking before importing the data; but that seems like just when you'd want to have it. Am I missing something? How do folks actually deal with this in practice? 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