Dear,

I just stumbled on this: looks like I can create a table with a foreign key 
referencing an unknown table.

sqlite> pragma foreign_keys;
1
sqlite> create table T(C integer, foreign key(C) references X(Y));
sqlite> pragma integrity_check;
ok
sqlite> pragma foreign_key_check;

Is there some mean to catch this anytime before actually using the table T?

The current behavior is certainly useful (and maybe adhering to standard(s)) 
because it allows to declare table T before declaring table X and might solve 
some cross-reference between both.  Yet I'd feel happy to "schema_check" for 
such discrepancies.  I can code some automated checks around querying 
sqlite_master and pragma foreign_key_list, but isn't there any other way to 
proceed which I would have missed?

-- 
Best Regards, Meilleures salutations, Met vriendelijke groeten,
Olivier Mascia, http://integral.software


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

Reply via email to