DBAL-669: Postgresql platform schema creation fails if it already exists #1889

Closed
doctrinebot opened this Issue Nov 18, 2013 · 5 comments

2 participants

@doctrinebot

Jira issue originally created by user chrisramakers:

This patch (fabe3c3) introduced a bug where the schemaNeedsCreation method always returns true if the schema name isn't 'default' or 'public'.

We heavily use schema's in our application and whenever an insert query is queued, it fails because the schema in question already exists but the platform adapter fails to detect that and continues with a "CREATE SCHEMA" query which fails.

The easy fix is to add the 'IF NOT EXISTS' clause to the 'CREATE SCHEMA' query but that will only function on Postgresql 9.3 and upward since 'IF NOT EXISTS' wasn't possible in earlier versions for schema creation.

Beter would be to load the existing schema's and compare them to those. I would create a pull request but i'm not sure how to obtain a database connection in the Platform (if at all possible) to pull a list of already known schema's?

@doctrinebot

Comment created by @ocramius:

[~chrisramakers] I'm trying to look into it. The method schemaNeedsCreation seems indeed to be wrong.

@doctrinebot

Comment created by @ocramius:

Provided a fix for this at #444

We won't fix the schema creation command, since it is supposed to fail on already existing conflicting elements (tables/etc)

@doctrinebot

Comment created by chrisramakers:

Any news on this? The bug keeps causing problems every time we deploy a new version. We are practically required to edit the vendor files for doctrine in our project so this bug doesn't cause issues.

@doctrinebot

Issue was closed with resolution "Fixed"

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