Bug #63539 Can't get rid of unused general_log table
Submitted: 2 Dec 2011 13:17 Modified: 6 Jan 2012 11:40
Reporter: Peter Laursen (Basic Quality Contributor) Email Updates:
Status: No Feedback Impact on me:
None 
Category:MySQL Server: Logging Severity:S3 (Non-critical)
Version:5.1, 5.5 (5.6 not tested) OS:Any
Assigned to: CPU Architecture:Any

[2 Dec 2011 13:17] Peter Laursen
Description:
If an old log table exists and logging is still enabled *but now to a file*, the general_log file cannot be dropped.

How to repeat:
SHOW GLOBAL VARIABLES LIKE 'general_log'; -- ON
SHOW GLOBAL VARIABLES LIKE 'log_output'; -- FILE

USE mysql;

SHOW TABLES LIKE 'gen%'; 
-- tables_in_mysql (gen%): general_log 

DROP TABLE general_log; 
-- Error Code: 1580 - You cannot 'DROP' a log table if logging is enabled

Suggested fix:
Why this blocade?  To me it makes perfect sense to drop the table when logging happens to a file. 

Not a big deal to "SET GLOBAL general_log = OFF", drop the table and re-enable the log.  But you will miss some records in the log.

Make the condition depend on both 'general_log' and 'log_output' settings (ie this error condition should require both 'general_log = ON' and 'log_output = TABLE'. In the 3 other cartesian cases for the variables the table can safely be dropped.
[2 Dec 2011 13:24] Peter Laursen
Description should read like

Description:
If an old log table exists and logging is still enabled *but now to a file*, the
general_log table cannot be dropped.

(file >> table)
[2 Dec 2011 13:32] Peter Laursen
.. and I assume the same is the case for the slow log!
[2 Dec 2011 14:58] Peter Laursen
Changed category to 'logging'.  I never noticed this category before!
[6 Dec 2011 11:40] Valeriy Kravchuk
Please, check http://dev.mysql.com/doc/refman/5.1/en/log-destinations.html. Proper procedure to disable log tables if you want to drop them is described there.
[7 Jan 2012 7:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".