MySQL – Alter Table Fails As Workbench Tries To Create Existing Table

alter-tableMySQLmysql-workbench

I have been trying to add another column to a table in my database using MySQL Workbench. This generates an 'ALTER TABLE' command which then fails as it fails attempting a 'CREATE TABLE, which it should not be doing as the table already exists! The output is below:-

ERROR 1114: The table 'Analysis' is full
SQL Statement:
ALTER TABLE `Patient`.`Analysis` ADD COLUMN `TestDateTime` DATETIME
NULL AFTER `idResults`

ERROR: Error when running failback script. Details follow.

ERROR 1050: Table 'Patient' already exists
SQL Statement:
CREATE TABLE `Patient` (
`idAnalysis` int(11) NOT NULL,
`idResults` int(11) DEFAULT NULL,
`ResultPDF` mediumblob,
`ResultCSV` mediumblob
) ENGINE=InnoDB DEFAULT CHARSET=latin1

How can I add this extra column as this database will evolve over time as user requirements expand?

Thank you.

Best Answer

While the CREATE TABLE is a strange error, and should be investigated further and/or reported to see if the failback operation should be done for Workbench, your real problem is the first one:

ERROR 1114: The table 'Analysis' is full

This suggests that the engine cannot alter the table because it has run out of space. This doesn't necessarily mean that the database has run out of disk space, but InnoDB does for that particular table. For example, if you have a fixed size for the main tablespace and not using innodb_file_per_table=1 and using the COPY algorithm for the alter, it will require as much space as the size of the whole table for the operation.

Check the output of the following command:

SHOW GLOBAL VARIABLES like 'innodb_data_file_path';

And then check the size and free space of the ibdata1 files on the data dir of the MySQL server. You may need to increase the available size for the tablespaces, make it autoincremental or use innodb_file_per_table=1.