-
-
Notifications
You must be signed in to change notification settings - Fork 388
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error "There is no active transaction" instead of Error about SQL syntax #1139
Comments
Can you please get a stack trace for this? See https://symfony.com/doc/current/contributing/code/stack_trace.html Also, what RDBMS are you using? With what driver? What version of PHP? My money is on Mysql + PDO + PHP 8, because this looks somewhat related to #1104 |
I am using MySQL 8.0.3 with PDO and PHP 8. |
Here is the stack trace :
And some log :
|
We can see in the stack trace that the error is occurring during a rollback, that's interesting! Maybe this could be fixed by doing a PR similar to #1131 , but for rollback? Cc @ostrolucky |
Yeah looks like same issue |
Similarly to what happens when attempting to commit an already closed connection when combining PHP 8 and pdo_mysql, an error is thrown when attempting to rollback. We use the same solution as for commit(), that is we check that we actually are inside a transaction when possible to do so. Fixes doctrine#1139
Bug Report
Syntax errors in SQL does not always display a syntax error message. It can display the error "There is no active transaction"
Summary
When executing one migration with two DDL statements, if the second one has a syntax error, then the error displayed by the command is not a syntax error, but the error "There is no active transaction".
Note : I also tried when executing several migrations and in this case the error message showed is a syntax error message. It seems to happen only when migrating one file.
Current behavior
A syntax error can display the error "There is no active transaction"
How to reproduce
Code example :
$this->addSql('ALTER TABLE article ADD publish_at DATETIME DEFAULT NULL');
$this->addSql('ALTER TABLE article CHANGE publish_at DATETIME NOT NULL');
Expected behavior
A syntax error message should be displayed
The text was updated successfully, but these errors were encountered: