Bug #58016 Forward engineering should place DEFAULT before column constraints
Submitted: 5 Nov 2010 14:12 Modified: 24 Aug 2011 20:05
Reporter: Karsten Wutzke Email Updates:
Status: Verified Impact on me:
Category:MySQL Workbench: Modeling Severity:S3 (Non-critical)
Version:5.2.29 OS:Any
Assigned to: Assigned Account CPU Architecture:Any
Tags: DEFAULT, forward engineer

[5 Nov 2010 14:12] Karsten Wutzke
The SQL standard dictates that the DEFAULT clause of a column declaration must be placed *before* the column's constraints. Forward engineering will place them after the constraints.

You sometimes have to port MySQL code to test the functionality of dev tools and this just adds another noisy step to fix in that process.

How to repeat:
Forward engineer any model with NOT NULL and a DEFAULT on it.
[8 Nov 2010 10:34] MySQL Verification Team
Thank you for the bug report.
[16 Nov 2010 19:09] Johannes Taxacher
Hello Karsten,
according to http://dev.mysql.com/doc/refman/5.1/en/create-table.html the NULL/NN property of a col must be place prior to the DEFAULT part. Can you give another example of what should be changed?
thanks in advance
[16 Nov 2010 21:19] Karsten Wutzke
I'm not really a fan of the SQL standard putting the default before the constraints. After all, the default depends on the constraint and if I wouldn't go for SQL compliance, I would put it near the end, too.

Maybe you can add a checkbox option to select the placement of the DEFAULT clause, like an "ISO/ANSI compliance" flag or just "Put default before constraints (ISO/ANSI)"...?