Re: Algorithm for resolving foreign key dependencies?

2009-02-03 Thread Peter Brawley
Donna, >Try looking at the information_schema.KEY_COLUMN_USAGE table (where >referenced_table_schema is not null). It will show you the FK >relationships. You could then create a tree that you could use to find the >hierarchy. For that, I suggest looking at >http://www.artfulsoftware.com/infotree

Re: Algorithm for resolving foreign key dependencies?

2009-02-03 Thread ddevaudreuil
Try looking at the information_schema.KEY_COLUMN_USAGE table (where referenced_table_schema is not null). It will show you the FK relationships. You could then create a tree that you could use to find the hierarchy. For that, I suggest looking at http://www.artfulsoftware.com/infotree/mysqlquer

Re: Algorithm for resolving foreign key dependencies?

2009-02-03 Thread Andrew Garner
Sounds like you want to walk tables in order of their fk dependencies - a topological ordering. You might want to take a look at SQLAlchemy which has some methods to do just this in sqlalchemy.sql.util: def sort_tables(tables, reverse=False): """sort a collection of Table objects in order of

Re: Algorithm for resolving foreign key dependencies?

2009-02-03 Thread Philip Pemberton
Andy Shellam wrote: Am I missing something here? (It is late after a long day, I admit!) Only something I forgot to mention. All the foreign keys are set up as ON DELETE RESTRICT, meaning MySQL's response to a foreign key violation is to spit out an error message to the effect of "I'm sorry

Re: Algorithm for resolving foreign key dependencies?

2009-02-03 Thread Andy Shellam
Hi Philip, Am I missing something here? (It is late after a long day, I admit!) In the example case you've given, if the foreign key in Parts is set to ON DELETE CASCADE, and you delete a row from Manufacturer, MySQL will first delete the associated records in Parts before deleting the row f

Algorithm for resolving foreign key dependencies?

2009-02-03 Thread Philip Pemberton
Hi, First of all, I apologise in advance for any mind-altering, or headache-inducing effects this question may have. I've spent the past two days trying to figure it out, and all I've got to show for it is a mostly-working recursive depth-first-search routine and an empty packet of painkiller

Re: WHERE vs. ON

2009-02-03 Thread Rob Wultsch
On Tue, Feb 3, 2009 at 1:54 PM, Jerry Schwartz wrote: > From: Martin Gainty [mailto:mgai...@hotmail.com] > Sent: Tuesday, February 03, 2009 1:03 PM > To: Jerry Schwartz; mysql@lists.mysql.com > Subject: RE: WHERE vs. ON > ON condition uses the same columnname from both source and target tables > >

RE: WHERE vs. ON

2009-02-03 Thread Jerry Schwartz
From: Martin Gainty [mailto:mgai...@hotmail.com] Sent: Tuesday, February 03, 2009 1:03 PM To: Jerry Schwartz; mysql@lists.mysql.com Subject: RE: WHERE vs. ON ON condition uses the same columnname from both source and target tables whereas any column expressions can go in the WHERE claus

Re: WHERE vs. ON

2009-02-03 Thread Perrin Harkins
On Tue, Feb 3, 2009 at 12:24 PM, Jerry Schwartz wrote: > Somebody, I think it was somebody from MySQL, said that you should never put > anything into a WHERE clause that could be put into the ON clause of a JOIN. > My guess is that this helps with the optimization, but it seems > counter-intuitive

RE: WHERE vs. ON

2009-02-03 Thread Martin Gainty
ON condition uses the same columnname from both source and target tables whereas any column expressions can go in the WHERE clause... Martin __ Disclaimer and confidentiality note Everything in this e-mail and any attachments relates to the official

WHERE vs. ON

2009-02-03 Thread Jerry Schwartz
Somebody, I think it was somebody from MySQL, said that you should never put anything into a WHERE clause that could be put into the ON clause of a JOIN. My guess is that this helps with the optimization, but it seems counter-intuitive to me. I've never followed that advice, but I'm starting to exp

Re: WL#946 and Changing time literal format

2009-02-03 Thread Michael Widenius
Hi! > "Konstantin" == Konstantin Osipov writes: Konstantin> * Michael Widenius [09/01/30 14:53]: >> Its more important that we don't break things for current users than >> try to be concerned about possible wrong usage that no one seams to do >> or find important enough to complain about.

Reading table information......

2009-02-03 Thread Krishna Chandra Prajapati
Hi all, Below are the two examples. In the example 2 its giving 'Reading table information.' where as in the example 1 its not giving. I am not able to find out why it is. Example 2 server is configured by me where as example 1 server is configured by some body else. Example 1