PostgreSQL indexes not detected correctly on existing table, if table name is protected keyword.
Bug Report
| Q | A |
|---|---|
| Version | 3.4.0 |
Summary
When table name is protected keyword, e.g. "user", Doctrine diff won't detect indexes and subsequently will try to add them with migration.
Because of https://github.com/doctrine/dbal/pull/5268/files#diff-bd15f9cca82bf2dcf0b0bb88cb4354ae7b277b7cf8443354534d509ac9f2b945R46
method listTables() were added to PostgreSQLSchemaManager.php , and in AbstractSchemaManager.php doListTables() is executed instead of listTables().
doListTables() returns incorrect index data (array key for user table indexes ($indexColumnsByTable) is "user", so it does not get merged with user table key (without quotes) in array $tableColumnsByTable.
The ::REGCLASS type casting adds quotes around reserved names. We need to replace it with a JOIN of the actual relation (pg_class) that contains the table name like it's done to retrieve the index name.
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.