Update or delete on table “x” violates foreign key constraint “fk_rails_5a7b40847a” on table “x” 0 error: update or delete on table “users” violates foreign key constraint “fk_rails_03de2dc08c” on table “comments”. Basically foreign key constraints are not inherited. if you are working with table inheritance you have a few options. stop enforcing foreign keys. use constraint triggers to enforce foreign keys. in most cases you are better off with a single large table and smaller join tables possibly with deferred foreign keys.. I have several tables that have foreign key constraints associated with them, each referencing the other in a hierarchical fashion as outlined below..
>note aside, potential problems having wrong constraints as cascade: >- postgres port will be acting different from oracle port >- a delete on a top table (i.e. ad_client) can delete the whole db ! not all tables will be deleted. it was surprise for me but in the past i found that not all tables have foreign key contraint.. Event_seat_set referenced the id column of sale_item as a foreign key.. when you are inserting data to the table, you need to insert an existing sale_item id into the table. you are not inserting anything to that field, hence the insert fail.. Foreign key constraints are an integral part of sql server database design. these are used to maintain integrity among related data in different tables. while implementing update and delete operations on values in the parent table (referenced table with primary key) we have to consider the impact on.
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.