Doctrine 1
  1. Doctrine 1
  2. DC-80

Doctrine/Import/Pgsql.php generates wrong default values for varchar fields

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 1.2.0-ALPHA1
    • Fix Version/s: 1.2.0-ALPHA2
    • Component/s: Import/Export
    • Labels:
      None
    • Environment:
      Ubuntu Linux, PostgreSQL 8.3, PHP 5.2.6

      Description

      We run a postgres database and have generated out base models from the database. In the base models, we see the following issue:

              $this->hasColumn('contractor_type', 'string', 150, array(
                   'type' => 'string',
                   'length' => '150',
                   'fixed' => false,
                   'unsigned' => false,
                   'notnull' => true,
                   'default' => '\'enduser\'::character varying',
                   'primary' => false,
                   ));
      

      So, the default value is showing some PostgreSQL meta information. We fixed this by changing function listTableColumns():

                  if (preg_match("/^nextval\('(.*)'(::.*)?\)$/", $description['default'], $matches)) {
      
                      $description['sequence'] = $this->conn->formatter->fixSequenceName($matches[1]);
                      $description['default'] = null;
                  }
      +           elseif (preg_match("/^'(.*)'::character varying$/", $description['default'], $matches)) {
      +               $description['default'] = $matches[1];
      +           }
      
                  $columns[$val['field']] = $description;
      

        Activity

        There are no comments yet on this issue.

          People

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

            Dates

            • Created:
              Updated:
              Resolved: