Issue Details (XML | Word | Printable)

Key: MDL-6218
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: Eloy Lafuente (stronk7)
Reporter: Imported
Votes: 1
Watchers: 0
Operations

Add/Edit UI Mockup to this issue
If you were logged in you would be able to see more operations.
Moodle

MySQL - TEXT and BLOB columns can't have a default value

Created: 04/Aug/06 07:56 PM   Updated: 03/Jul/09 09:19 AM
Return to search
Component/s: General
Affects Version/s: 1.6.1
Fix Version/s: 1.8.3, 1.9

Environment: All
Issue Links:
Dependency
 
Duplicate
 

Database: MySQL
Participants: Eloy Lafuente (stronk7), Imported, Martin Dougiamas and Samuli Karevaara
Security Level: None
Affected Branches: MOODLE_16_STABLE
Fixed Branches: MOODLE_18_STABLE, MOODLE_19_STABLE


 Description  « Hide
This is a follow up to MDL-6206 (adding a quiz fails on some MySQL 5 setups because it relies on using a default value for a TEXT column)



According to the MySQL documentation TEXT and BLOB aren't allowed to use default values - http://dev.mysql.com/doc/refman/5.0/en/blob.html - but a quick search of the .sql files in moodle using a regexp like



/ text[^rn,]+default/i



finds several places where text columns are setup with a default value - obviously it would require much more in depth checking to find out if any of these default values are required anytime a row is created.



As noted in the previous bug MySQL only seems to enforce it's no default values for TEXT or BLOB rule with certain values of the sql_mode server variable (I think the default value of sql_mode in MySQL 5.0.22 includes the STRICT_TRANS_TABLES option which causes any query trying to use a default value to fail)

 All   Comments   Change History   Version Control      Sort Order: Ascending order - Click to sort in descending order
Eloy Lafuente (stronk7) committed 1 file to 'Moodle CVS' on branch 'MOODLE_18_STABLE' - 24/Jul/07 07:26 AM
Anihilate the last TEXT column having a default clause. With thin, Moodle > 1.8
builds under strict (mysql) and those defaults won't be there anymore. As part
of the upgrade to 1.9 one check is going to be performed to see if it's needed
to drop such default. MDL-6218
MODIFY lib/db/install.xml   Rev. 1.45.2.1    (+2 -2 lines)
Eloy Lafuente (stronk7) committed 2 files to 'Moodle CVS' - 24/Jul/07 07:28 AM
Drop the latest TEXT default existing since XMLDB debut. MDL-6218
MODIFY version.php   Rev. 1.495    (+1 -1 lines)
MODIFY lib/db/upgrade.php   Rev. 1.91    (+14 -1 lines)
Eloy Lafuente (stronk7) committed 1 file to 'Moodle CVS' - 03/Jul/09 09:12 AM
MDL-6218 TEXT/BINARY columns and default clauses - forbidden since ages, warn and autofix them if found
MODIFY lib/xmldb/xmldb_field.php   Rev. 1.6    (+8 -2 lines)