Doctrine 2 - ORM
  1. Doctrine 2 - ORM
  2. DDC-2608

Wrong SQL generated for @SequenceGenerator, throws Exception

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.3.4
    • Fix Version/s: 2.3.5, 2.4.1
    • Component/s: None
    • Security Level: All
    • Labels:
      None
    • Environment:
      Not necessary

      Description

      I'm using Doctrine2 v2.3.4 and PostgreSQL.

      I created an entity with this:

      /**

      • @Id
      • @Column(type="integer")
      • @GeneratedValue
      • @SequenceGenerator(allocationSize=100)
      • @var integer
        */
        protected $id;

      And then run `orm:schema-tool:update --force`. But the sequence name is missing in the SQL and I get this error:

      [Doctrine\DBAL\DBALException]
      An exception occurred while executing 'CREATE SEQUENCE INCREMENT BY 100 MINVALUE 1 START 1':

      SQLSTATE[42601]: Syntax error: 7 ERROR: syntax error at or near "BY"
      LINE 1: CREATE SEQUENCE INCREMENT BY 100 MINVALUE 1 START 1
      ^
      Adding sequenceName="tablename_seq" fixes it.

        Activity

        Dowl Lci created issue -
        Dowl Lci made changes -
        Field Original Value New Value
        Description I'm using Doctrine2 v2.3.4 and PostgreSQL.

        I created an entity with this:

            /**
             * @Id
             * @Column(type="integer")
             * @GeneratedValue
             * @SequenceGenerator(allocationSize=100)
             * @var integer
             */
            protected $id;

        And then run `orm:schema-tool:update --force`. But the sequence name is missing in the SQL and I get this error:

            [Doctrine\DBAL\DBALException]
              An exception occurred while executing 'CREATE SEQUENCE INCREMENT BY 100 MINVALUE 1 START 1':
                                                                                                             
              SQLSTATE[42601]: Syntax error: 7 ERROR: syntax error at or near "BY"
              LINE 1: CREATE SEQUENCE INCREMENT BY 100 MINVALUE 1 START 1
                                                 ^

        I tried adding sequenceName="tablename_seq" but it doesn't work either.

        What can I do?
        I'm using Doctrine2 v2.3.4 and PostgreSQL.

        I created an entity with this:

            /**
             * @Id
             * @Column(type="integer")
             * @GeneratedValue
             * @SequenceGenerator(allocationSize=100)
             * @var integer
             */
            protected $id;

        And then run `orm:schema-tool:update --force`. But the sequence name is missing in the SQL and I get this error:

            [Doctrine\DBAL\DBALException]
              An exception occurred while executing 'CREATE SEQUENCE INCREMENT BY 100 MINVALUE 1 START 1':
                                                                                                             
              SQLSTATE[42601]: Syntax error: 7 ERROR: syntax error at or near "BY"
              LINE 1: CREATE SEQUENCE INCREMENT BY 100 MINVALUE 1 START 1
                                                 ^
        Adding sequenceName="tablename_seq" fixes it.
        Priority Blocker [ 1 ] Major [ 3 ]
        Benjamin Eberlei made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s 2.3.5 [ 10521 ]
        Fix Version/s 2.4.1 [ 10528 ]
        Resolution Fixed [ 1 ]

          People

          • Assignee:
            Benjamin Eberlei
            Reporter:
            Dowl Lci
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: