Description
What happened?
We have a Laravel project that has the following migration steps:
- Create column
Y_temp
- Migrate data from column
X
toY_temp
- Drop column
X
- Rename column
Y_temp
toX
These migrations worked without any problem on CockroachDB version 22.2.8
. After updating to version 23.1.16
the renaming step from a new column to one that has been deleted previously throws the following exception:
In AbstractPlatform.php line 452:
Unknown database type anyelement requested, Doctrine\DBAL\Platforms\PostgreSQL100Platform may not support it.
How to reproduce the bug
Set up a new Laravel project with CockroachDB version 23.X.X
. Create migrations with the following steps:
- Create a new table
- Create column
X
- Create column
Y
- Drop column
X
- Rename column
Y
to columnX
The last step should fail with the exception from above.
Package Version
1.3.0
PHP Version
8.2.0
Laravel Version
10.47.0
CockroachDB Version
23.1.6
Which operating systems does with happen with?
No response
Notes
I have already done some digging around. At first, I stumbled across this issue: doctrine/dbal#6248 with an associated PR that never got merged.
The changes in the PR worked on my machine, so it seemed to be a general bug in the Postgres implementation of doctrine. But after it tried to run the tests in the PR / write my own tests for it, I found out that it is actually not a problem with a plain PostgreSQL Database. It throws this exception only on a CRDB version above 23 and not on a plain PostgreSQL.
The SQL-Statement in the PostgreSQLSchemaManager
from the selecteTableColumns-Function actually returns a different Result between CRDB Version 22, 23 and PostgreSQL 16.
In CRDB v23, it also returns the dropped fields named like this: ........pg.dropped.15......
with the type anyelement
.
Doctrine now tries to cast the type anyelement
which does not exist in the PostgreSQL implementation, causing the exception.
The changes in the PostgreSQLSchemaManager
from the PR above does fix this issue. But i think it should not be implemented in the Doctrine DBAL 'cause it is not a PostgreSQL bug. I think we should find a way to somehow implement the fix in this package.