Skip to content

DropDatabaseDoctrineCommand doesn't seem to work with pgbouncer (postgresql) #2195

@Cocray

Description

@Cocray

Bug Report

Q A
Version >= 2.11.4
Previous Version if the bug is a regression 2.11.3

Summary

I'm now working with postgresql / pgbouncer. To reset my local database, I usually drop / create db with DropDatabaseDoctrineCommand and CreateDatabaseDoctrineCommand. But with pgbouncer, it seems that I can't do it anymore for the following reason:

  • Since version 2.11.4, we have a test to check the instance of the platform => if ($connection->getDatabasePlatform() instanceof PostgreSQLPlatform) {
  • This line creates a connection between doctrine and pgbouncer, and so between pgbouncer and postgresql
  • Then, a few lines below, we have $connection->close(); => This closes the connection between doctrine and pgbouncer, but the connection between pgbouncer and postgresql is still open, so when we try to remove the db with $schemaManager->dropDatabase($name);, we have the following error:
Could not drop database "test" for connection named default
An exception occurred while executing a query: SQLSTATE[55006]: Object in use: 7 ERROR:  database "test" is being accessed by other users
DETAIL:  There is 1 other session using the database.

Isn't there another way to know the instance of the platform without connecting to db?

If no, would you suggest that I drop tables (and anything else) instead of db?

Thanks all :)

Current behavior

DropDatabaseDoctrineCommand doesn't work with pgbouncer

Expected behavior

DropDatabaseDoctrineCommand works with pgbouncer

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions