6 messages in com.mysql.lists.mysqlRENAME TABLE with CONCAT string fails
FromSent OnAttachments
Jason Dixon28 May 2005 05:12 
Paul DuBois28 May 2005 05:51 
Jason Dixon28 May 2005 08:00 
Paul DuBois28 May 2005 08:29 
mfat...@free.fr28 May 2005 08:49 
Paul DuBois28 May 2005 09:13 
Subject:RENAME TABLE with CONCAT string fails
From:Jason Dixon (jas@dixongroup.net)
Date:05/28/2005 05:12:31 AM
List:com.mysql.lists.mysql

I'm trying to rename some tables for archival, but the table renaming is failing when I use CONCAT() to form the table string name:

mysql> RENAME TABLE flows TO flows_tmp, flows_new TO flows, flows_tmp TO CONCAT("flows_", DATE_SUB(CURDATE(), interval 1 day)); ERROR 1064: You have an error in your SQL syntax near 'CONCAT("flows_", DATE_SUB(CURDATE(), interval 1 day))' at line 1

If I run the CONCAT() command by itself, everything works as expected:

+--------------------------------------------------------+ | CONCAT("flows_", DATE_SUB(CURDATE(), interval 1 day)) | +--------------------------------------------------------+ | flows_2005-05-27 | +--------------------------------------------------------+ 1 row in set (0.00 sec)

Is there some magic pixie dust I need to throw around the CONCAT() to have it interpolate into the RENAME TABLE command correctly? This is on mysql-server 3.23.58 on a RHEL 3 clone.

Thanks,