Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.5.0b4

Bug #13412 Reverse:getTableConstraintDefinition() fails for foreign keys sometimes
Submitted: 2008-03-17 12:07 UTC
From: timj Assigned: quipo
Status: Closed Package: MDB2_Driver_mysqli (version 1.5.0b1)
PHP Version: Irrelevant OS:
Roadmaps: (Not assigned)    
Subscription  
Comments Add Comment Add patch


Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem : 46 + 39 = ?

 
 [2008-03-17 12:07 UTC] timj (Tim Jackson)
Description: ------------ When working with foreign keys, Reverse:getTableConstraintDefinition() fails for valid foreign keys returned from Manager:listTableConstraints(), where the constraint name is not the same as the column name being constrained. Basically, the current code is making an incorrect assumption that the constraint names always match the columns with which they are associated. Test script: --------------- Consider a table: CREATE TABLE mytable (mycol int, CONSTRAINT foo FOREIGN KEY (mycol) REFERENCES othertable (othertablecolumn)); In this case, the constraint name is "foo". This is (correctly) returned by Manager:listTableConstraints(). Expected result: ---------------- Reverse:getTableConstraintDefinition('foo') returns the fully-formed constraint for the column "mycol". Actual result: -------------- Reverse:getTableConstraintDefinition('foo') fails with a "not found" error, because getTableConstraintDefinition() first does a "SHOW INDEX", and the results of SHOW INDEX show column names, not constraint names.

Comments

 [2008-03-26 20:16 UTC] quipo (Lorenzo Alberton)
This bug has been fixed in CVS. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better.