PostgreSQLSchemaManager wrongly resolves an empty existing table set
Bug Report
PostgreSQLSchemaManager wrongly resolves an empty existing table set.
| Q | A |
|---|---|
| Version | 3.4.0 |
Summary
When running doctrine:schema:update command it wrongly considers all my existing tables as missing and thus generates the corresponding DDL statments which will fail if executed (i.e. duplicate table...).
My context: I have many schemas, all tables are located in a schema different from public.
Current behaviour
doctrine:schema:update generates DDL statments for missing tables whereas they already exists and are up to date.
How to reproduce
1 . You need a mapping with several tables in different schemas.
2. Run doctrine:schema:update
Expected behaviour
doctrine:schema:update generates no DDL statment when the DB is up to date.
@NoiseByNorthwest could you provide a reproducer, please? I will not be able to fix the issue without reproducing it first.
Why are you using
current_schemas(false)?
I'm not entirely sure. It was originally introduced in https://github.com/doctrine/dbal/pull/3821 as a replacement to some other filter.
Rolling back to 3.3.8 fix this problem until we get a solution
@morozov It seems to be in fact not (directly) related to the addition of current_schemas(false).
Here are the execution flow differences between 3.3.x & 3.4.x
3.3.x
AbstractSchemaManager::createSchema()
AbstractSchemaManager::listTables()
AbstractSchemaManager::listTableNames()
PostgreSQLPlatform::getListTablesSQL()
-> OK expected table list, simple query with few adhoc filters and no current_schemas()
3.4.x
AbstractSchemaManager::createSchema()
PostgreSQLSchemaManager::listTables()
AbstractSchemaManager::doListTables()
AbstractSchemaManager::fetchTableColumnsByTable()
PostgreSQLSchemaManager::selectTableColumns()
-> KO empty table list, complex query with common filters,
provided by buildQueryConditions(), including current_schemas()
I can reproduce the issue. It depends on the changes in https://github.com/doctrine/dbal/pull/5576 (at least the testing part), so let's get it merged first.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.