I am trying to update an entry in a structure but getting the error:

CDbCommand failed to execute the SQL statement: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'nisp.craft_matrixcontent_colcontent' doesn't exist. The SQL statement executed was: SELECT `elements`.`id`, `elements`.`type`, `elements`.`enabled`, `elements`.`archived`, `elements`.`dateCreated`, `elements`.`dateUpdated`, `elements_i18n`.`slug`, `elements_i18n`.`uri`, `elements_i18n`.`enabled` AS `localeEnabled`, `content`.`id` AS `contentId`, `matrixblocks`.`fieldId`, `matrixblocks`.`ownerId`, `matrixblocks`.`ownerLocale`, `matrixblocks`.`typeId`, `matrixblocks`.`sortOrder`
 FROM `craft_elements` `elements`
 JOIN `craft_elements_i18n` `elements_i18n` ON elements_i18n.elementId = elements.id
 JOIN `craft_matrixcontent_colcontent` `content` ON content.elementId = elements.id
 JOIN `craft_matrixblocks` `matrixblocks` ON matrixblocks.id = elements.id
 WHERE ((((((elements_i18n.locale = :locale) AND (content.locale = :locale)) AND (elements.archived = 0)) AND (elements.enabled = 1)) AND (elements_i18n.enabled = 1)) AND (matrixblocks.fieldId=:matrixblocksfieldId1)) AND (matrixblocks.ownerId=:matrixblocksownerId1)
 GROUP BY `elements`.`id`
 ORDER BY `matrixblocks`.`sortOrder` LIMIT 100. Bound with :locale='en_gb', :matrixblocksfieldId1='285', :matrixblocksownerId1='1656' 

The table it mentions is a matrix related table which does not exist - it was deleted a while back. It was used in a Matrix - Super Table - Matrix test but I was getting errors with it and decided not to use this then so deleted it. I only started to get this error when I added a new Matrix Field to this entryType. But I have emvoed the Matrix field and now I am still getting the error and can't update. Any idea's as to the resolution?

  • Have you cleared all your caches? – Marion Newlevant Aug 31 '15 at 7:58
  • Yep tried that. – mmc501 Aug 31 '15 at 9:05

Does your database have InnoDB enabled and are all of Craft's tables using it (except for searchindex, which is MyISAM)? Sounds like maybe when you deleted the field some cascading deletes that are set on foreign keys didn't occur and that can happen if you're on MyISAM (which doesn't have foreign key support).

  • I just checked the admin/utils and it has MySQL InnoDB support with a green tick beside it so I assume it's enabled. On checking the status: SHOW TABLE STATUS FROM db; All tables areusing InnoDB apart from the craft_searchindex which is MyISAM - should it be InnoDB as well? – mmc501 Aug 31 '15 at 20:04
  • craft_searchindex is the odd one out (needs to do full text searches) – Marion Newlevant Aug 31 '15 at 20:41

I ran into this issue recently updating a Craft 3.0.37 site to 3.2.x

The issue turned out to be SuperTable plugin which also needed to be updated to more recent version.

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.