1

Getting the following error on production environment when trying to add a new Field.

CDbCommand failed to execute the SQL statement: SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'redacted' already exists

Anyone have any idea what could be causing this?

  • Is it a Matrix field you're trying to add and is the handle redacted? If so, does a table named redacted already exist in the database? – Brad Bell Oct 10 '17 at 19:59
  • Hey @BradBell, Just a regular Plain Text field (not Matrix). I just put "redacted" in there because the table contained info that made the hosting environment evident. It actually says: Table '[name-of-hosting-provider]/#sql-ib450' already exists. Not sure what the 'sql-ib450' is all about. – Michael Witwicki Oct 10 '17 at 20:04
  • Weird... can you enabled devMode then share the full stack trace leading up to the error? Wondering if a plugin is getting involved. Craft won't create a new table for a Plain Text field. – Brad Bell Oct 10 '17 at 20:07
  • Sure thing @BradBell - where will I find the log you are looking for? This is on production so I want to limit the time the [devMode] is in the title tags. It's worth noting that I CANNOT replicate this issue on my local or development environments. – Michael Witwicki Oct 10 '17 at 20:20
  • You could conditionally enable devMode from your IP address in craft/config/general.php... something like if ($_SERVER['REMOTE_ADDR'] == '1.2.3.4') { 'devMode' => true } – Brad Bell Oct 10 '17 at 21:33
2

This turned out to be an issue with the mysql server itself, not a Craft CMS issue at all.

It appears that during a previous field addition, the database server crashed and left hanging temporary files that didn't match with the database itself.

Spun up a new database, copied the DB over and everything worked as expected.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.