On Sep 30, 2010, at 3:30 PM, Muthuveerappan Alagappan wrote: > Hi > > I am a newbie to sqlite, I am having difficulty in trying to > build > referential integrity based on a view. > > sqlite allows me to create referential integrity based on a > view > ( vu_cars ), however it doesn't allow me to insert any records into > the table car_properties. > > I am using the sqlite version 3.7.2 > > I have explained below with an example: > > Desired Result: > Green colored insert statements should be allowed > Red colored insert statement should throw an error "Foreign Key > > mismatch"
Any inserts on table "car_properties" should throw the "foreign key mismatch" error. "foreign key mismatch" indicates a problem with the schema - in this case that the parent table of an FK constraint is actually a view, not a table. SQLite sometimes allows you to create invalid FK constraints like this one. Then throws the error when you try to execute a statement that requires testing the FK constraint. More details here: http://www.sqlite.org/foreignkeys.html#fk_indexes Dan. _______________________________________________ sqlite-users mailing list [email protected] http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

