今天我删除了一个临时表时遇到了这个奇怪的问题。我删除了临时表并描述了该表只是为了验证。但是,桌子没有掉下来。经过一番搜索,我发现:
MySQL 允许创建一个与永久表同名的临时表。所以临时表被删除了,而不是永久表。我对我正在工作的表感到非常困惑。
MySQL 版本:5.1.36-enterprise-gpl-pro-log
这是我测试过的:
mysql> create table test(id int);
Query OK, 0 rows affected (0.00 sec)
mysql> desc test;
| Field | Type | Null | Key | Default | Extra |
--------------------------------------------------
id int(11) YES NULL
mysql> create temporary table test(id int);
Query OK, 0 rows affected (0.00 sec)
mysql> desc test;
| Field | Type | Null | Key | Default | Extra |
--------------------------------------------------
id int(11) YES NULL
mysql> drop table test;
Query OK, 0 rows affected (0.00 sec)
mysql> desc test;
| Field | Type | Null | Key | Default | Extra |
--------------------------------------------------
id int(11) YES NULL
Run Code Online (Sandbox Code Playgroud)
这是一个错误还是有其他方法可以克服这个问题?
| 归档时间: |
|
| 查看次数: |
9672 次 |
| 最近记录: |