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

          People

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

            Dates

            • Created:
              Updated:
              Resolved: