DDC-2608: Wrong SQL generated for @SequenceGenerator, throws Exception #3275

Closed
opened 2026-01-22 14:17:06 +01:00 by admin · 1 comment
Owner

Originally created by @doctrinebot on GitHub (Aug 12, 2013).

Originally assigned to: @beberlei on GitHub.

Jira issue originally created by user dowlci:

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.

Originally created by @doctrinebot on GitHub (Aug 12, 2013). Originally assigned to: @beberlei on GitHub. Jira issue originally created by user dowlci: 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.
admin added the Bug label 2026-01-22 14:17:06 +01:00
admin closed this issue 2026-01-22 14:17:06 +01:00
Author
Owner

@doctrinebot commented on GitHub (Sep 8, 2013):

Issue was closed with resolution "Fixed"

@doctrinebot commented on GitHub (Sep 8, 2013): Issue was closed with resolution "Fixed"
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#3275