-
unknown authored
numbers) Before this patch, the code in the class Log_to_csv_event_handler, which is used by the global LOGGER object to write to the tables mysql.slow_log and mysql_general_log, was supporting only records of the format defined for these tables in the database creation scripts. Also before this patch, the server would allow, with certain limitations, to perform ALTER TABLE on the LOG TABLES. As implemented, the behavior of the server, with regards to LOG TABLES, is inconsistent: - either ALTER TABLES on LOG TABLES should be prohibited, and the code writing to these tables can make assumptions on the record format, - or ALTER TABLE on LOG TABLES is permitted, in which case the code writing a record to these tables should be more flexible and honor new fields. In particular, adding an AUTO_INCREMENT column to the logs, does not work as expected (per the bug report). Given that the ALTER TABLE on log tables statement has been explicitly implemented to check that the log should be off to perform the operation, and that current test cases already cover this, the user expectation is already set that this is a "feature" and should be supported. With this patch, the server will: - populate AUTO INCREMENT columns if present, - populate any additional column with it's default value when writing a record to the LOG TABLES. Tests are provided, that detail the precise sequence of statements a SUPER user might want to perform to add more columns to the log tables. mysql-test/r/log_tables.result: Test case for bug#27857 mysql-test/t/log_tables.test: Test case for bug#27857 sql/log.cc: Set extra fields in log tables with default values.
8b8b2888