Doctrine DBAL
  1. Doctrine DBAL
  2. DBAL-91

orm:convert-mapping SchemaException on Postgres reserved words

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0
    • Fix Version/s: 2.0.2, 2.1
    • Component/s: Schema Managers
    • Labels:
      None
    • Environment:
      CentOs 5.5, Postgres 8.1.22

      Description

      While execuiting

      doctrine orm:convert-mapping --from-database yml /tmp/test.yml

      I get presented an error

      [Doctrine\DBAL\Schema\SchemaException]
      Invalid index-name tablename_"input"_idx given, has to be [a-zA-Z0-9_]

      The index "type" is quoted because this is a reserved word in Postgres. for example see the following definition:

      FOREIGN KEY (something) REFERENCES somethings(id) ON UPDATE CASCADE
      FOREIGN KEY (another) REFERENCES anothers(id) ON UPDATE CASCADE
      FOREIGN KEY ("type") REFERENCES logtypes(id) ON UPDATE CASCADE

      Only type will be quoted because it is a reserved word.

        Issue Links

          Activity

          Hide
          Emil added a comment -

          I hope this is enough information. The attached SQL reproduces the following error:

          1. doctrine orm:convert-mapping --from-database yml /tmp/test.yml

          [Doctrine\DBAL\Schema\SchemaException]
          Invalid index-name something_"input"_idx given, has to be [a-zA-Z0-9_]

          orm:convert-mapping [--filter="..."] [--from-database] [-extend[="..."]] [-num-spaces[="..."]] [-h|--help] [-q|--quiet] [-v|--verbose] [-V|--version] [-a|--ansi] [-n|--no-interaction] command to-type dest-path

          Show
          Emil added a comment - I hope this is enough information. The attached SQL reproduces the following error: doctrine orm:convert-mapping --from-database yml /tmp/test.yml [Doctrine\DBAL\Schema\SchemaException] Invalid index-name something_"input"_idx given, has to be [a-zA-Z0-9_] orm:convert-mapping [--filter="..."] [--from-database] [- extend [="..."] ] [ -num-spaces [="..."] ] [-h|--help] [-q|--quiet] [-v|--verbose] [-V|--version] [-a|--ansi] [-n|--no-interaction] command to-type dest-path
          Hide
          Benjamin Eberlei added a comment -

          I can't reproduce it

          Can you run the command with --verbose ? Additionally in lib/Doctrine/ORM/Tools/Console/Command/ConvertMappingCommand.php can you var_dump() $metadata after line 119?

          Show
          Benjamin Eberlei added a comment - I can't reproduce it Can you run the command with --verbose ? Additionally in lib/Doctrine/ORM/Tools/Console/Command/ConvertMappingCommand.php can you var_dump() $metadata after line 119?
          Hide
          Benjamin Eberlei added a comment -

          Ok i could reproduce it now. Input is not a keyword for me though, type also not. Coudl reproduce it with "table"

          Show
          Benjamin Eberlei added a comment - Ok i could reproduce it now. Input is not a keyword for me though, type also not. Coudl reproduce it with "table"
          Hide
          Benjamin Eberlei added a comment -

          Ok, this is a DBAL issue.

          Show
          Benjamin Eberlei added a comment - Ok, this is a DBAL issue.
          Hide
          Benjamin Eberlei added a comment -

          This is fixed and will be included in 2.0.2

          Show
          Benjamin Eberlei added a comment - This is fixed and will be included in 2.0.2

            People

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

              Dates

              • Created:
                Updated:
                Resolved: