Moodle

Upgrade Errors: MySQL Error 1101: BLOB/TEXT columns cannot have a DEFAULT value

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Duplicate
  • Affects Version/s: 1.7
  • Fix Version/s: None
  • Component/s: Installation
  • Labels:
    None
  • Environment:
    Windows Server 2003, Apache 2.2.3, MySQL 5.0.27, PHP 5.2.0
  • Database:
    MySQL
  • Affected Branches:
    MOODLE_17_STABLE

Description

Example error: MySQL error 1101: BLOB/TEXT column 'manualcomment' can't have a default value

During upgrades from 1.6.1+ to 1.7+ (latest stable release as of 2006/12/20) there were several instances of updating/adding tables in the database which the mysql.php files are using a create_column function for BLOB/TEXT columns that has a setting to include a DEFAULT value. According to MySQL error reference (http://dev.mysql.com/doc/refman/5.0/en/error-messages-server.html) BLOB/TEXT columns cannot have a default value. This causes many errors in the install including causing the installer to loop during the quiz and question upgrades (though the installer continues through earlier updates with this error). The updates that add TEXT/BLOB columns to the database could use the execute_sql function or something similar so that there is not an error when they are run.

The two mysql.php file locations that caused looping during my test installations
mod/quiz/db/
question/type/multichoice/db

Attached is the mysql.php file from the multichoice database upgrade, which first has the original code and then my modification to eliminate the error during installation.

Issue Links

Activity

Hide
Ken Wilson added a comment -

See also http://moodle.org/mod/forum/discuss.php?d=60755 for user feedback.

http://dev.mysql.com/doc/refman/5.0/en/blob.html also says that text/blob columns cannot have default values. But the error will only be raised when mysql is set to run in scrict mode. See http://bugs.mysql.com/bug.php?id=19498 for the bug report which caused the inconsistency to get fixed.

I wonder how many more of these strict mode adherence problems there are?

Show
Ken Wilson added a comment - See also http://moodle.org/mod/forum/discuss.php?d=60755 for user feedback. http://dev.mysql.com/doc/refman/5.0/en/blob.html also says that text/blob columns cannot have default values. But the error will only be raised when mysql is set to run in scrict mode. See http://bugs.mysql.com/bug.php?id=19498 for the bug report which caused the inconsistency to get fixed. I wonder how many more of these strict mode adherence problems there are?
Hide
Eloy Lafuente (stronk7) added a comment -

Hi,

after some tests if seems that "only" 1.6 => 1.7 is affected by this problem. Both 1.7 installation and 1.7 => 1.8 upgrade (using the new XMLDB schema) guaranties that LOB columns won't have default values at all.

So I would vote to close this as "Won't fix", recommending to disable strict mode for 1.6 => 1.7 upgrade, without modifying the upgrade scripts now.

Also, just wondering if we could disable it programatically: http://dev.mysql.com/doc/refman/5.0/en/server-sql-mode.html

+1 for closing.

Show
Eloy Lafuente (stronk7) added a comment - Hi, after some tests if seems that "only" 1.6 => 1.7 is affected by this problem. Both 1.7 installation and 1.7 => 1.8 upgrade (using the new XMLDB schema) guaranties that LOB columns won't have default values at all. So I would vote to close this as "Won't fix", recommending to disable strict mode for 1.6 => 1.7 upgrade, without modifying the upgrade scripts now. Also, just wondering if we could disable it programatically: http://dev.mysql.com/doc/refman/5.0/en/server-sql-mode.html +1 for closing.
Hide
Eloy Lafuente (stronk7) added a comment -

Adding Martin here to have final decision.

Show
Eloy Lafuente (stronk7) added a comment - Adding Martin here to have final decision.
Hide
Samuli Karevaara added a comment -

Resolving as a dupe.

Show
Samuli Karevaara added a comment - Resolving as a dupe.

People

Vote (1)
Watch (2)

Dates

  • Created:
    Updated:
    Resolved: