Open aimeos opened 4 weeks ago
Can sp_rename
move the table to a different schema? See the details in https://github.com/doctrine/dbal/pull/6602.
As currently designed, the behavior of renameTable()
isn't portable across supported platforms. Unlike other platforms where the second parameter is a SQL expression representing the new name, the SQL Server platform (due to the implementation details) accepts a literal.
No, sp_rename
can't move tables to a different schema and only accepts a literal as new name.
Bug Report
Summary
SQL Server uses
sp_rename
function for renaming tables but using quotes for target table name results in wrong table name.How to reproduce
The new table is now named "[dbo.test2]" instead of "test2". This does only occur in SQLServer platform, all other platforms use quoting as expected so this is inconsistent between SQLServer platform and all other platforms.
Expected behaviour
Quotes for the target table name should be automatically removed by the SQLServer platform here to get consistent results: https://github.com/doctrine/dbal/blob/dadd35300837a3a2184bd47d403333b15d0a9bd0/src/Platforms/SQLServerPlatform.php#L498