[CONPY-136] Incorrect "DML" behaviour inside Trigger with InnoDB as destiny Created: 2020-12-23 Updated: 2020-12-24 Resolved: 2020-12-24 |
|
| Status: | Closed |
| Project: | MariaDB Connector/Python |
| Component/s: | Generic |
| Affects Version/s: | None |
| Fix Version/s: | N/A |
| Type: | Bug | Priority: | Critical |
| Reporter: | Marcelo Titonelli Pio da Cruz | Assignee: | Georg Richter |
| Resolution: | Not a Bug | Votes: | 0 |
| Labels: | None | ||
| Environment: |
MariaDB 10.5.8 |
||
| Description |
|
Expected output: Current output: Note the buffer on current output, it counts 9 on same connection which inserted, but there's 0 rows on table2. table2: Current rows on tables: table2: ------------------------ Inserting directly from console works:
Inserting in one command line, on Python, does not work:
to:
If the engine from table2 is changed from InnoDB to Aria or MyIsam, it works from python as well. |
| Comments |
| Comment by Georg Richter [ 2020-12-24 ] |
|
The result in your example is correct, since the first connection doesn't commit the transaction. |
| Comment by Marcelo Titonelli Pio da Cruz [ 2020-12-24 ] |
|
Thanks for showing me a way to solve it. According to this page autocommit is enabled by default: Also, as I said. If the engine is different, everything works. Is it stated it anywhere to be explicitly commited in this scenario? Should't it autocommit on cursor/connection destruction anyway? Why is it only needed to commit in this scenario? |
| Comment by Georg Richter [ 2020-12-24 ] |
|
The official documentation can be found on github pages: https://mariadb-corporation.github.io/mariadb-connector-python/connection.html#autocommit : Your example will only work, if the storage engine is non transactional, like MyISAM or Aria. For more details please check https://mariadb.com/kb/en/storage-engines/ |