-
-
Notifications
You must be signed in to change notification settings - Fork 454
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't drop PostgreSQL database #402
Comments
I opened a issue in PHP some time ago because I didn't know that this was the expected behavior. |
@davialexandre can we rely on |
@deeky666 The |
@deeky666, @davialexandre is right. I've commented on your pull request a while ago with observations and a possible solution to this issue. The same approach is used in PhpPGAdmin and I haven't had any issues in the past 3-4 years or so. Also, the documentation of PostgreSQL points out that you'll always have a |
Same problem here. I agree to say that template1 is a good default database, and thus used it in my PR. |
@steve-todorov I actually think that steve-todorov@113ebec is a better solution, as it deals with the unfortunate "feature" of PostgreSQL instead of hiding it through DBAL. Could you please rebase, create a specific branch and pull-request ? I will close my PR for dbal as soon as yours is opened for DoctrineBundle. |
Fixes #402 (doctrine/DoctrineBundle#402) by connecting by default to 'template1' instead of the database with the same name as the user (Postgre default in case of no dbname).
Fixes #402 (doctrine/DoctrineBundle#402) by connecting by default to 'template1' instead of the database with the same name as the user (Postgre default in case of no dbname).
@davialexandre @kiwidg @steve-todorov I merged the DBAL patch. Should be working with DBAL master now. Can someone confirm, please? |
@deeky666 It works, for creating and dropping a database (with dev-master). Do you have an ETA for a v2.5.2 tag with the fix ? |
Yep, a 2.5.2 tag would come handy :D @deeky666 |
Ping again, release would really help |
Sorry guys didn't see the comments. Will tag a new version next week. Sorry for the delay |
Waiting for a 2.5.2 tag too. 👍 |
New tag is available: https://github.com/doctrine/dbal/releases/tag/v2.5.2 |
Thanks @deeky666 ! |
Reading from comments this issue should be solved with the tagging of a new dbal release, therefor i am closing this. |
It started after commit 1ed0fec. When you try to connect to PostgreSQL without a dbname, the username is used instead. If you don't have a database with same name as the username the connection will fail (and if both, the username and the database that you're trying to drop, have the same name the drop will also fail).
After a few tests, I don't think this can be fixed in DropDatabaseDoctrineCommand. I think that maybe the solution would change Doctrine\DBAL\Driver\PDOPgSql\Driver::_constructPdoDsn to use some default database name (maybe postgres) if dbname isn't set, but I have no idea if this would impact somewhere else.
The text was updated successfully, but these errors were encountered: