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

Bug #14213 Schema silently altered when autoincrement field is not primary key
Submitted: 2008-06-23 15:45 UTC
From: hschletz Assigned: ifeghali
Status: Closed Package: MDB2_Schema (version 0.8.2)
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 : 11 + 26 = ?

 
 [2008-06-23 15:45 UTC] hschletz (Holger Schletz)
Description: ------------ While porting an existing database schema to XML, I ran in to a problem with an - admittedly weird - table where an autoincrement field was defined, but another column was used as primary key. Forcing the autoincrement field to be primary key is documented behavior and makes sense. Unfortunately, this is enforced silently upon table creation with possible sideeffects instead of failing validation entirely. Test script: --------------- <field> <name>auto</name><type>integer</type> <notnull>true</notnull> <autoincrement>true</autoincrement> </field> <field> <name>other</name><type>integer</type> <notnull>true</notnull> </field> <index> <name>foo_other_primary</name> <primary>true</primary> <field><name>other</name></field> </index> <index> <name>foo_auto</name> <unique>true</unique> <field><name>auto</name></field> </index> Expected result: ---------------- XML Schema validation should abort with an error because the auto column is not defined as primary key. Actual result: -------------- The auto column is silently forced to be primary key, leaving us with an additional (now useless) unique index over the auto column and NO CONSTRAINT AT ALL for the other column. Ouch.

Comments

 [2008-11-15 19:52 UTC] ifeghali (Igor Feghali)
Hello Holger, I am checking this. Regards, Igor.
 [2008-11-15 23:53 UTC] ifeghali (Igor Feghali)
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.