Magento – Column not found: 1054 Unknown column ‘at_status_default.value’

databaseindexingmagento2upgrade

I'm actually kind of desperate.

I tried many times to update my Community Edition from 2.2.1 to 2.2.5, always failing due to what I guess is a database inconsistency.
After the update procedure – done with Composer – I get this error:

{"0":"SQLSTATE[42S22]: Column not found: 1054 Unknown column 'at_status_default.value' in 'where clause', query was: SELECT DISTINCT  COUNT(DISTINCT e.entity_id) FROM `catalog_product_entity` AS `e`\n INNER JOIN `catalog_category_product_index_store1` AS `cat_index` ON cat_index.product_id=e.entity_id AND cat_index.store_id='1' AND cat_index.visibility IN(2, 4) AND cat_index.category_id='2'\n INNER JOIN `catalog_product_index_price` AS `price_index` ON price_index.entity_id = e.entity_id AND price_index.website_id = '1' AND price_index.customer_group_id = 0 WHERE (((IFNULL(`e`.`entity_id`, 0) IN (SELECT `catalog_category_product`.`product_id` FROM `catalog_category_product` WHERE (category_id IN ('3')))) AND(IFNULL(`e`.`entity_id`, `at_status_default`.`value`) IN ('228', '230', '254', '256', '258', '259', '261', '265', '266', '267', '268', '269', '272', '273', '274', '275', '277', '278', '280', '281', '282', '283', '284', '326', '327', '329', '330', '331', '332', '333', '334', '335', '336', '337', '338', '339', '340', '342', '343', '344', '345', '346', '347', '348', '349', '350', '351', '352', '353', '354', '355', '356', '357', '358', '359', '360', '362', '364', '366', '367', '368', '369', '370', '371', '372', '373', '374', '375', '376', '377', '378', '379', '380', '381', '382', '383', '384', '389', '390', '392', '393', '394', '395', '396', '397', '398', '399', '400', '401', '402', '420', '421', '422', '428', '430', '442', '444', '445', '446', '448', '449', '452', '453', '456', '457', '458', '459', '460', '461', '462', '463', '464', '466', '467', '468', '469', '470', '495', '496', '497', '498', '499', '500', '501', '502', '503', '504', '505', '506', '507', '508', '509', '510', '511', '512', '513', '514', '515', '516', '517', '518', '519', '520', '521', '522', '523', '524', '525', '529', '531', '532', '533', '534', '535', '536', '537', '538', '540', '541', '542', '543', '544', '551', '553', '555', '556', '557', '558', '559', '560', '561', '562', '563', '564', '565', '566', '567', '568', '569', '571', '573', '583', '584', '585', '586', '590', '591', '592', '593', '594', '595', '596', '599', '600', '601', '602', '603', '604', '605', '606', '607', '608', '609', '610', '611', '612', '613', '614', '615', '616', '618', '621', '622', '623', '624', '625', '626', '627', '628', '629', '630', '631', '632', '633', '636', '639', '641', '642', '648', '650', '651', '653', '656', '657', '658', '659', '660', '663', '664', '665', '666', '667', '668', '669', '670', '671', '672', '673', '674', '677', '678', '679', '680', '681', '682', '683', '684', '685', '686', '687', '688', '689', '690', '691', '692', '693', '694', '695', '696', '699', '700', '701', '703', '704', '705', '707', '708', '709', '710', '711', '712', '713', '714', '715', '716', '717', '718', '719', '721', '722', '723', '724', '725', '726', '727', '729', '730', '731', '732', '733', '734', '735', '736', '738', '739', '740', '741', '742', '744', '745', '746', '750', '753', '754', '755', '759', '760', '761', '762', '763', '765', '766', '768', '770', '771', '779', '780', '781', '782', '783', '786', '787', '788', '790', '793', '795', '796', '798', '799', '801', '803', '804', '806', '807', '809', '811', '812', '814', '815', '817', '821', '822', '824', '826', '827', '829', '830', '832', '857', '858', '859', '860', '865', '866', '867', '868', '869', '870', '871', '872', '873', '874', '875', '876', '886', '888', '889', '894', '895', '896', '897', '898', '899', '900', '901', '902', '903', '905', '906', '907', '908', '909', '911', '912', '914', '915', '916', '917', '921', '922', '924', '925', '926', '927', '928', '930', '931', '932', '933', '934', '935', '936', '937', '938', '940', '941', '942', '944', '946', '947', '948', '949', '950', '951', '952', '954', '955', '956', '957', '958', '959', '960', '961', '962', '963', '964', '965', '966', '967', '968', '969', '970', '971', '972', '973', '974', '975', '976', '977', '978', '979', '980', '981', '982', '983', '984', '985', '986', '987', '992', '994', '996', '997', '998', '999', '1000', '1001', '1002', '1003', '1004', '1011', '1013', '1014', '1016', '1017', '1018', '1019', '1020', '1022', '1023', '1024', '1025', '1027', '1028', '1029', '1030', '1031', '1032', '1033', '1034', '1035', '1036', '1037', '1038', '1039', '1040', '1041', '1042', '1043', '1044', '1045', '1046', '1047', '1048', '1049', '1050', '1051', '1052', '1053', '1054', '1055', '1056', '1057', '1058', '1059', '1060', '1061', '1065', '1066', '1067', '1068', '1069', '1070', '1071', '1072', '1074', '1075', '1076', '1077', '1078', '1079', '1080', '1081', '1082', '1083', '1084', '1085', '1098', '1099', '1100', '1101', '1102', '1103', '1104', '1105')) AND(IFNULL(`e`.`entity_id`, `at_featured_default`.`value`) IN ('280', '328', '333', '453', '469', '500', '540', '572', '573', '574', '575', '581', '585', '590', '591', '601', '602', '604', '620', '639', '640', '641', '647', '649', '650', '660', '661', '662', '672', '674', '745', '859', '873', '924')) ))","1":"#0 \/var\/www\/avtech-magento-test\/shop\/vendor\/magento\/framework\/DB\/Statement\/Pdo\/Mysql.php(93): Zend_Db_Statement_Pdo->_execute(Array)\n#1 \/var\/www\/avtech-magento-test\/shop\/vendor\/magento\/zendframework1\/library\/Zend\/Db\/Statement.php(303): Magento\\Framework\\DB\\Statement\\Pdo\\Mysql->_execute(Array)\n#2 \/var\/www\/avtech-magento-test\/shop\/vendor\/magento\/zendframework1\/library\/Zend\/Db\/Adapter\/Abstract.php(480): Zend_Db_Statement->execute(Array)\n#3 \/var\/www\/avtech-magento-test\/shop\/vendor\/magento\/zendframework1\/library\/Zend\/Db\/Adapter\/Pdo\/Abstract.php(238): Zend_Db_Adapter_Abstract->query('SELECT DISTINCT...', Array)\n#4 \/var\/www\/avtech-magento-test\/shop\/vendor\/magento\/framework\/DB\/Adapter\/Pdo\/Mysql.php(533): Zend_Db_Adapter_Pdo_Abstract->query('SELECT DISTINCT...', Array)\n#5 \/var\/www\/avtech-magento-test\/shop\/vendor\/magento\/framework\/DB\/Adapter\/Pdo\/Mysql.php(596): Magento\\Framework\\DB\\Adapter\\Pdo\\Mysql->_query('SELECT DISTINCT...', Array)\n#6 \/var\/www\/avtech-magento-test\/shop\/vendor\/magento\/zendframework1\/library\/Zend\/Db\/Adapter\/Abstract.php(828): Magento\\Framework\\DB\\Adapter\\Pdo\\Mysql->query(Object(Magento\\Framework\\DB\\Select), Array)\n#7 \/var\/www\/avtech-magento-test\/shop\/vendor\/magento\/framework\/Data\/Collection\/AbstractDb.php(220): Zend_Db_Adapter_Abstract->fetchOne(Object(Magento\\Framework\\DB\\Select), Array)\n#8 \/var\/www\/avtech-magento-test\/shop\/vendor\/magento\/framework\/Data\/Collection.php(257): Magento\\Framework\\Data\\Collection\\AbstractDb->getSize()\n#9 \/var\/www\/avtech-magento-test\/shop\/vendor\/magento\/framework\/Data\/Collection.php(243): Magento\\Framework\\Data\\Collection->getLastPageNumber()\n#10 \/var\/www\/avtech-magento-test\/shop\/vendor\/magento\/module-eav\/Model\/Entity\/Collection\/AbstractCollection.php(1104): Magento\\Framework\\Data\\Collection->getCurPage()\n#11 \/var\/www\/avtech-magento-test\/shop\/vendor\/magento\/module-eav\/Model\/Entity\/Collection\/AbstractCollection.php(913): Magento\\Eav\\Model\\Entity\\Collection\\AbstractCollection->_loadEntities(false, false)\n#12 \/var\/www\/avtech-magento-test\/shop\/vendor\/magento\/module-catalog\/Model\/ResourceModel\/Product\/Collection.php(758): Magento\\Eav\\Model\\Entity\\Collection\\AbstractCollection->load(false, false)\n#13 \/var\/www\/avtech-magento-test\/shop\/vendor\/magento\/framework\/Interception\/Interceptor.php(58): Magento\\Catalog\\Model\\ResourceModel\\Product\\Collection->load(false, false)\n#14 \/var\/www\/avtech-magento-test\/shop\/vendor\/magento\/framework\/Interception\/Interceptor.php(138): Magento\\Catalog\\Model\\ResourceModel\\Product\\Collection\\Interceptor->___callParent('load', Array)\n#15 \/var\/www\/avtech-magento-test\/shop\/vendor\/magento\/framework\/Interception\/Interceptor.php(153): Magento\\Catalog\\Model\\ResourceModel\\Product\\Collection\\Interceptor->Magento\\Framework\\Interception\\{closure}()\n#16 \/var\/www\/avtech-magento-test\/shop\/generated\/code\/Magento\/Catalog\/Model\/ResourceModel\/Product\/Collection\/Interceptor.php(26): Magento\\Catalog\\Model\\ResourceModel\\Product\\Collection\\Interceptor->___callPlugins('load', Array, Array)\n#17 \/var\/www\/avtech-magento-test\/shop\/vendor\/magento\/framework\/Data\/Collection.php(831): Magento\\Catalog\\Model\\ResourceModel\\Product\\Collection\\Interceptor->load()\n#18 \/var\/www\/avtech-magento-test\/shop\/vendor\/magento\/module-catalog-widget\/Block\/Product\/ProductsList.php(366): Magento\\Framework\\Data\\Collection->getIterator()\n#19 \/var\/www\/avtech-magento-test\/shop\/vendor\/magento\/module-page-cache\/Model\/Layout\/LayoutPlugin.php(71): Magento\\CatalogWidget\\Block\\Product\\ProductsList->getIdentities()\n#20 \/var\/www\/avtech-magento-test\/shop\/vendor\/magento\/framework\/Interception\/Interceptor.php(146): Magento\\PageCache\\Model\\Layout\\LayoutPlugin->afterGetOutput(Object(Magento\\Framework\\View\\Layout\\Interceptor), '\\n<script>\\n    t...')\n#21 \/var\/www\/avtech-magento-test\/shop\/vendor\/magento\/framework\/Interception\/Interceptor.php(153): Magento\\Framework\\View\\Layout\\Interceptor->Magento\\Framework\\Interception\\{closure}()\n#22 \/var\/www\/avtech-magento-test\/shop\/generated\/code\/Magento\/Framework\/View\/Layout\/Interceptor.php(39): Magento\\Framework\\View\\Layout\\Interceptor->___callPlugins('getOutput', Array, Array)\n#23 \/var\/www\/avtech-magento-test\/shop\/vendor\/magento\/framework\/View\/Result\/Page.php(257): Magento\\Framework\\View\\Layout\\Interceptor->getOutput()\n#24 \/var\/www\/avtech-magento-test\/shop\/vendor\/magento\/framework\/View\/Result\/Layout.php(170): Magento\\Framework\\View\\Result\\Page->render(Object(Magento\\Framework\\App\\Response\\Http\\Interceptor))\n#25 \/var\/www\/avtech-magento-test\/shop\/vendor\/magento\/framework\/Interception\/Interceptor.php(58): Magento\\Framework\\View\\Result\\Layout->renderResult(Object(Magento\\Framework\\App\\Response\\Http\\Interceptor))\n#26 \/var\/www\/avtech-magento-test\/shop\/vendor\/magento\/framework\/Interception\/Interceptor.php(138): Magento\\Framework\\View\\Result\\Page\\Interceptor->___callParent('renderResult', Array)\n#27 \/var\/www\/avtech-magento-test\/shop\/vendor\/magento\/framework\/Interception\/Interceptor.php(153): Magento\\Framework\\View\\Result\\Page\\Interceptor->Magento\\Framework\\Interception\\{closure}(Object(Magento\\Framework\\App\\Response\\Http\\Interceptor))\n#28 \/var\/www\/avtech-magento-test\/shop\/generated\/code\/Magento\/Framework\/View\/Result\/Page\/Interceptor.php(26): Magento\\Framework\\View\\Result\\Page\\Interceptor->___callPlugins('renderResult', Array, Array)\n#29 \/var\/www\/avtech-magento-test\/shop\/vendor\/magento\/framework\/App\/Http.php(139): Magento\\Framework\\View\\Result\\Page\\Interceptor->renderResult(Object(Magento\\Framework\\App\\Response\\Http\\Interceptor))\n#30 \/var\/www\/avtech-magento-test\/shop\/vendor\/magento\/framework\/App\/Bootstrap.php(256): Magento\\Framework\\App\\Http->launch()\n#31 \/var\/www\/avtech-magento-test\/shop\/pub\/index.php(37): Magento\\Framework\\App\\Bootstrap->run(Object(Magento\\Framework\\App\\Http))\n#32 {main}","url":"\/","script_name":"\/index.php"}

I reindexed, flushed and cleaned the cache, upgraded the database and everything I could find browsing online.

Best Answer

I found a solution or at least a workaround. It appears the problem was related to an attribute that was migrated from Magento 1.x. The fix for me was to change the attribute scope (in your case at_status_default) from Store View to Global. After that my page rendered as expected.

Stores > Attriubtes > Product (see scope column). Edit attribute > Properties > Advanced Attribute Properties.

Related Topic