DDC-1172: Schema tool does not drop sequences on table drop for PostgreSql platform #1775

doctrinebot opened this Issue May 26, 2011 · 5 comments

2 participants


Jira issue originally created by user gedrox:

When recreating database using


the second line fails with error that the sequence "tbl*id*seq" already exists. It's because the sequence is created without an owner column and schema tool doesn't include "drop sequence" statements in the drop SQL.

I've created a patch which fixes the problem for my environment. Revision numbers in patch is from the local SVN. Doctrine base is 2.0.5.

Comment created by @beberlei:

That will always drop all sequences also when you only pass some classes in there. We need to find a better solution for this problem.


Comment created by @beberlei:



Issue was closed with resolution "Fixed"


Comment created by pylebecq:

I don't know if this is the right place to add a comment because this bug is quite old, and if anyone will see it but the code that fixed the reported bug seems to create a bug on my setup. The SchemaTool tries to drop two times the sequences, which produces an error.

The following SQL is generated :

ALTER TABLE utilisateurs DROP CONSTRAINT fk_497b315e7634f637;
ALTER TABLE utilisateurs DROP CONSTRAINT fk_497b315e19863134;
DROP SEQUENCE civilites*civ_id*seq;
DROP SEQUENCE utilisateursClientType*ucty_id*seq;
DROP SEQUENCE utilisateurs*user_id*seq;
DROP SEQUENCE civilites*civ_id*seq;
DROP SEQUENCE utilisateursclienttype*ucty_id*seq;
DROP SEQUENCE utilisateurs*user_id*seq;
DROP TABLE civilites;
DROP TABLE utilisateursClientType;
DROP TABLE utilisateurs

I'm using postgres 9.1.8, Doctrine 2.3.2

@beberlei beberlei was assigned by doctrinebot Dec 6, 2015
@doctrinebot doctrinebot added this to the 2.1 milestone Dec 6, 2015
@doctrinebot doctrinebot closed this Dec 6, 2015
@doctrinebot doctrinebot added the Bug label Dec 7, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment