Bug #7602 "temporary" truncate table don´t work
Submitted: 31 Dec 2004 14:53 Modified: 31 Dec 2004 17:27
Reporter: Harald Krause Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:since 4.1.7 OS:Windows (WIndows XP)
Assigned to: CPU Architecture:Any

[31 Dec 2004 14:53] Harald Krause
Description:
If you want to truncate a temporary table it does not work

Regards Harald

How to repeat:
create temporary table temp select 'Test';
truncate table temp;
select * from temp;

The result is not empty. 
If the table is not a temporary truncate works fine.

Suggested fix:
delete from temp;
[31 Dec 2004 17:27] MySQL Verification Team
I wasn't able to repeat with the current 4.1.8 Windows server:

C:\mysql\bin>mysql -uroot test
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4 to server version: 4.1.8-nt

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> create temporary table temp select "test";
Query OK, 1 row affected (0.04 sec)
Records: 1  Duplicates: 0  Warnings: 0

mysql> select * from temp;
+------+
| test |
+------+
| test |
+------+
1 row in set (0.00 sec)

mysql> truncate table temp;
Query OK, 0 rows affected (0.01 sec)

mysql> select * from temp;
Empty set (0.00 sec)

mysql>

Please upgrade.
[1 Jan 2005 15:29] Harald Krause
I´ve upgraded to the newest Version 4.1.8 and tested with
different servers 4.1.8-nt, 4.1.8-nt-log, 4.1.8-max-nt etc.
All versions and tests produces the same result (see below).

************************************************************
C:\>mysql41\bin\mysql -u root test
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2 to server version: 4.1.8-nt

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> create temporary table temp select 'Test';
Query OK, 1 row affected (0.11 sec)
Records: 1  Duplicates: 0  Warnings: 0

mysql> truncate table temp;
Query OK, 0 rows affected (0.00 sec)

mysql> select * from temp;
+------+
| Test |
+------+
| Test |
+------+
1 row in set (0.00 sec)
************************************************************

I´ve uninstall mysql 4.1.8 Server and install with default
options. ==> same result.

I´ve Install mysql-Server on a other XP machine. ==> same result.

May be an Operating-System related problem:
My OS is: Windows XP-Pro SP2.