You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using a MSSQL database (mcr.microsoft.com/mssql/server:2019-latest) and with Symfony (6.4). Symfony through doctrine has features that interact with the DB. Which have stopped working and my suspicion is a DBAL bug.
Current behavior
The first create and drop works as expected (the table does get created and dropped), however on the third drop (where I suspect the bug lies) a PDOException is being thrown with the message:
An exception occurred while executing a query: SQLSTATE[42S02]: [Microsoft]
[ODBC Driver 18 for SQL Server][SQL Server]Cannot drop the table 'schema_su
bscriber_check_4e0c48ec448e18', because it does not exist or you do not hav
e permission.
The this drop is surrounded by a try catch explicitly listening to a Doctrine\DBAL\Exception\TableNotFoundException. I am using a SA( System Admin) account and should not have any permission issues.
Expected behavior
I believe a Doctrine\DBAL\Exception\TableNotFoundException should be thrown in this case instead as the table is not found.
How to reproduce
A project with symfony and a MSSQL DB. Then run bin/console doctrine:schema:validate
I'm encountering the exact same problem with Doctrine DBAL and SQL Server.
Here is my setup:
Symfony 6.4.20
PHP 8.2.28
Microsoft ODBC Driver 18 for SQL Server
PDO_SQLSRV extension 5.12.1
Doctrine DBAL 3.9
SQL Server 2019
Problem:
When I run doctrine:schema:update --force (or doctrine:migrations:diff), Doctrine creates a temporary table like schema_subscriber_check_* and tries to drop it later.
SQL Server raises an error:
SQLSTATE[42S02]: [Microsoft][ODBC Driver 18 for SQL Server][SQL Server]Cannot drop the table 'schema_subscriber_check_xxxxx' because it does not exist or you do not have permission.
This issue appeared after upgrading from PHP 8.1 to PHP 8.2.
With PHP 8.1, the pdo_sqlsrv driver often automatically emulated prepared statements, so the problem did not occur.
With PHP 8.2 and PDO_SQLSRV 5.12+, strict server-side prepares are enforced, causing SQL Server to strictly check object existence during the prepare phase.
So it is impossible to use doctrine:schema:update and doctrine:migrations:diff with SQL Server + Doctrine DBAL now.
Manual migrations are the only reliable workaround at the moment.
Uh oh!
There was an error while loading. Please reload this page.
Bug Report
Summary
I am using a MSSQL database (mcr.microsoft.com/mssql/server:2019-latest) and with Symfony (6.4). Symfony through doctrine has features that interact with the DB. Which have stopped working and my suspicion is a DBAL bug.
Current behavior
The first create and drop works as expected (the table does get created and dropped), however on the third drop (where I suspect the bug lies) a PDOException is being thrown with the message:
The this drop is surrounded by a try catch explicitly listening to a
Doctrine\DBAL\Exception\TableNotFoundException
. I am using a SA( System Admin) account and should not have any permission issues.Expected behavior
I believe a Doctrine\DBAL\Exception\TableNotFoundException should be thrown in this case instead as the table is not found.
How to reproduce
A project with symfony and a MSSQL DB. Then run
bin/console doctrine:schema:validate
composer.json
WIP - I am working on a way to share some code or a repo.
The text was updated successfully, but these errors were encountered: