Doctrine 1
  1. Doctrine 1
  2. DC-689

Columns of type 'array' adds default clause to the create table statement which isn't supported by MySQL.

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 1.2.2
    • Fix Version/s: None
    • Component/s: Import/Export
    • Labels:
      None
    • Environment:
      MySQL version 5.0.83, Doctrine 1.2.2, Revision: 7490

      Description

      The column type 'array' creates a column of the type 'LONGTEXT' but also adds the default value to the column declaration which makes the creation of the table fail.

      MySQL does not support default values for TEXT, BLOB or LONGTEXT. I don't know when this behavior was added to MySQL or if it always has been like that. MySQL 5.0.51 will accept it without any SQL mode set, 5.0.83 won't.

        Activity

        Hide
        Jonathan H. Wage added a comment -

        Could you provide a test and patch?

        Show
        Jonathan H. Wage added a comment - Could you provide a test and patch?
        Hide
        Daniel Holmstrom added a comment -

        (Un)fortunately I'll be computer-free for a month now, so I have no time to write test or do a proper patch. I'll attach the patch I use for reference.

        Since the default clause depends on the native type which isn't known when the default clause is constructed (in getDefaultFieldDeclaration) I've simply added a check that sets the default clause to an empty string if the native type is one of those which isn't allowed to have a default value. I'm not sure, however, what the line in Doctrine/Export/Mysql.php::276:

        {return $this->conn->dataDict->$method($name, $field);}

        does and if that is affected by this also.

        I guess you want the list of native types not allowed to have default values somewhere else, but I don't have the required knowledge about the internals of Doctrine to do this.

        Show
        Daniel Holmstrom added a comment - (Un)fortunately I'll be computer-free for a month now, so I have no time to write test or do a proper patch. I'll attach the patch I use for reference. Since the default clause depends on the native type which isn't known when the default clause is constructed (in getDefaultFieldDeclaration) I've simply added a check that sets the default clause to an empty string if the native type is one of those which isn't allowed to have a default value. I'm not sure, however, what the line in Doctrine/Export/Mysql.php::276: {return $this->conn->dataDict->$method($name, $field);} does and if that is affected by this also. I guess you want the list of native types not allowed to have default values somewhere else, but I don't have the required knowledge about the internals of Doctrine to do this.
        Hide
        Daniel Holmstrom added a comment -

        Attached patch giving example of how to fix DC-689.

        Show
        Daniel Holmstrom added a comment - Attached patch giving example of how to fix DC-689 .

          People

          • Assignee:
            Jonathan H. Wage
            Reporter:
            Daniel Holmstrom
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated: