From: Christian Mack Date: March 12 1999 11:44am Subject: Re: sort of defragmentation? List-Archive: http://lists.mysql.com/mysql/102 Message-Id: <36E8FE38.AD4F02B2@compal.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Ed Carp wrote: > > >> You mean "cascading updates and deletes", don't you? Triggers and > foreign > >> keys have little to do with whether or not deletes and updates cascade. > > > >Thanks for the correction. What I meant to say is "Since > >mysql is does not support any kind of data integrity > >validation and an update will never modify the table > >that is not explicitly mentioned in the query...." > > You know, it would really be cool to support such a thing ... but as far as > I can tell, MySQL doesn't have the infrastructure to support such a thing - > it would need to know the relationships between tables. > > You know, thinking about it, it wouldn't be a big deal to add a > relationships table to each database - it would contain the source table, > target table, source field, and target field: > > create table relationships ( > source_table varchar(255), > source_field varchar(255), > target_table varchar(255), > target_field varchar(255)); > > When MySQL gets a "DELETE/UPDATE" SQL command, it looks through the > relationships table and spawns threads to do the cascade delete/update. Am > I making any sense? Yes, but all DELETE/UPDATE without dependencies would also have to look into the dependencies table, and that's an extra overhead. Also I have a running application, which uses dependencies between two databases. They wouldn't be handeled this way. This would lead to do it myself on some queries and let it do mysql on others. Not very transparent. I think when stored procedures are out in mysql, you could do such things if you need it. Till then be patient :) Tschau Christian