[MDEV-32652] Commit/rollback must emit an error when not inside active transaction Created: 2023-11-01 Updated: 2024-01-22 |
|
| Status: | Open |
| Project: | MariaDB Server |
| Component/s: | None |
| Fix Version/s: | None |
| Type: | Task | Priority: | Major |
| Reporter: | Michael | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Description |
|
All commands aplicable in an active transaction only, ie. commit/rollback/savepoint/release savepoint, must emit an error if they are executed in a connection without active transaction. Also start transaction should emit an error if there is an active transaction already. repro: https://dbfiddle.uk/ipMQHAT7 |
| Comments |
| Comment by Kristian Nielsen [ 2023-11-01 ] |
|
That's not really possible to implement by default without severely breaking backwards compatibility. It might be possible to implement a non-default SQL_MODE or similar that would enable this behaviour, if deemed sufficiently important. |
| Comment by Sergei Golubchik [ 2023-11-01 ] |
|
According to the SQL Standard (2016), COMMIT and ROLLBACK must fail
otherwise they don't. That is, they must not emit an error in MariaDB either. But as for the START TRANSACTION statement, the standard says, indeed
We might want to have the same behavior for compatibility reasons. |
| Comment by Tingyao Nian [ 2023-12-06 ] |
|
I can work on this. I think it's a fair point that we should make "start transaction" to emit errors. The current behavior is:
However this will break backward compatibility. The best way I believe is to add "NO_IMPLICIT_COMMIT" to SQL_MODE as @sergei suggested. |
| Comment by Tingyao Nian [ 2024-01-22 ] |