DDL cannot be rollback
http://dev.mysql.com/doc/mysql/en/cannot-roll-back.html

It also apply to many DB like Sybase for example...

Ville Karjalainen wrote:

Greetings,

I created a table during transaction and was surprised to find out it
still existed after I did a ROLLBACK. The same seems to apply to changes
made using ALTER TABLE statements.


Is there a simple logical explanation to this behaviour?

Any help would be appreciated.

Demonstration follows:

mysql> SELECT VERSION();
+--------------------+
| VERSION()          |
+--------------------+
| 4.1.7-Debian_4-log |
+--------------------+
1 row in set (0.01 sec)

mysql> SHOW VARIABLES LIKE "have_innodb";
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| have_innodb   | YES   |
+---------------+-------+
1 row in set (0.00 sec)

mysql> SET AUTOCOMMIT=0;
Query OK, 0 rows affected (0.00 sec)

mysql> DROP TABLE IF EXISTS foo;
Query OK, 0 rows affected (0.19 sec)

mysql> START TRANSACTION;
Query OK, 0 rows affected (0.00 sec)

mysql> CREATE TABLE foo (bar int) TYPE=InnoDB;
Query OK, 0 rows affected, 1 warning (0.05 sec)

mysql> ROLLBACK;
Query OK, 0 rows affected (0.00 sec)

mysql> SHOW CREATE TABLE foo;
+--------+---------------------------------------------------------------------------------------------+
| Table | Create Table
|
+--------+---------------------------------------------------------------------------------------------+
| foo | CREATE TABLE `foo` ( `bar` int(11) default NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 |
+--------+---------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)




--
Philippe Poelvoorde
COS Trading Ltd.
+44.(0)20.7376.2401

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to