← Back to team overview

maria-discuss team mailing list archive

R: transactions and UNLOCK TABLES

 

Let's make the snippet simpler. Only one table, non-transactional, please look at the difference from what docs say and the real behaviour. If one could explain what UNLOCK TABLES exactly does, it would be great.

MariaDB [test]> SELECT @@in_transaction, @@autocommit;
+------------------+--------------+
| @@in_transaction | @@autocommit |
+------------------+--------------+
|                0 |            1 |
+------------------+--------------+
1 row in set (0.00 sec)

MariaDB [test]> CREATE OR REPLACE TABLE t (c INT) ENGINE = MEMORY;
Query OK, 0 rows affected (0.12 sec)

MariaDB [test]> LOCK TABLE t WRITE;
Query OK, 0 rows affected (0.00 sec)

MariaDB [test]> START TRANSACTION;
Query OK, 0 rows affected (0.00 sec)

MariaDB [test]> INSERT INTO t VALUES (1);
Query OK, 1 row affected (0.01 sec)

MariaDB [test]> UNLOCK TABLES;
Query OK, 0 rows affected (0.00 sec)

MariaDB [test]> SELECT @@in_transaction;
+------------------+
| @@in_transaction |
+------------------+
|                1 |
+------------------+
1 row in set (0.00 sec)


Regards
Federico



Follow ups

References