Doctrine DBAL
  1. Doctrine DBAL
  2. DBAL-120

MySql platform getAlterTableSQL does not quote existing column names

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Duplicate
    • Affects Version/s: 2.0.4
    • Fix Version/s: 2.0.4
    • Component/s: Platforms
    • Labels:
      None

      Description

      When creating alter table SQL, the MySqlPlatform class does not quote names for columns of an existing table when building a CHANGE query. This can cause SQL errors.

      It creates queries like this:

      ALTER TABLE my_table CHANGE key `key` INTVARCHAR(255) DEFAULT '' NOT NULL';

      Attached is a patch to fix this.

      As an aside, is this the best way to contribute a patch? Or is a GitHub pull request better?

      1. quote-mysql-change-keyname.patch
        0.6 kB
        Devon Weller
      2. quote-mysql-change-colname.patch
        0.9 kB
        Devon Weller

        Issue Links

          Activity

          Hide
          Devon Weller added a comment -

          I also discovered a similar issue with key names. A second patch is attached.

          Show
          Devon Weller added a comment - I also discovered a similar issue with key names. A second patch is attached.
          Hide
          Benjamin Eberlei added a comment -

          This problem is a little more complicated, it will be fixed in DBAL-96 probably for 2.2

          Show
          Benjamin Eberlei added a comment - This problem is a little more complicated, it will be fixed in DBAL-96 probably for 2.2

            People

            • Assignee:
              Benjamin Eberlei
              Reporter:
              Devon Weller
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: