Skip to content

MediaWiki SMW ask query results in fatal error page

Summary

Semantic MediaWiki (SMW) #ask query results in an (fatal) error page.

Current Behaviour

Clicking an Special:Ask query link brings up an error message

Expected Behaviour

Execute the SMW #ask query and display the results according to the query form.

Steps to Reproduce

  1. run https://wiki.opensourceecology.de/Spezial:Abfrage_ausf%C3%BChren/Stichwort_nachschlagen?Stichwort_nachschlagen%5BStichwort%5D=Energy&_run=true

  2. result may be something like

    [c92e76807d30301a515456f3] 2021-03-07 10:30:44: Fataler Ausnahmefehler des Typs „RuntimeException“

Context/Logs

Activating debug and logging shows:

[01dc59e81ceaa1ef5bae0223] /Spezial:Abfrage_ausf%C3%BChren/Stichwort_nachschlagen?Stichwort_nachschlagen%5BStichwort%5D=Energy&_run=true RuntimeException from line 291 of /container/www/extensions/SemanticMediaWiki/src/MediaWiki/Connection/Database.php: A database query error has occurred. Did you forget to run your application's database schema updater after upgrading?
Query: SELECT COUNT(DISTINCT t0.smw_id) AS count FROM `mw_smw_object_ids` AS t0 INNER JOIN `mw_smw_ft_search` AS t1 ON t0.smw_id=t1.s_id WHERE (((MATCH(t1.o_text) AGAINST ('*energy*' IN BOOLEAN MODE) AND t1.p_id=1891) OR (t1.o_hash='energy') OR (MATCH(t1.o_text) AGAINST ('energy*' IN BOOLEAN MODE) AND t1.p_id=1891) OR (MATCH(t1.o_text) AGAINST ('*energy' IN BOOLEAN MODE) AND t1.p_id=1891))) AND t0.smw_iw!=':smw' AND t0.smw_iw!=':smw-delete' AND t0.smw_iw!=':smw-redi' LIMIT 10001
Function: SMW\SQLStore\QueryEngine\QueryEngine::getCountQueryResult
Error: 1054 Unknown column 't1.o_hash' in 'where clause' (mariadb)

#0 /container/www/includes/libs/rdbms/database/Database.php(1427): Wikimedia\Rdbms\Database->makeQueryException('Unknown column ...', 1054, 'SELECT COUNT(D...', 'SMW\\SQLStore\\Qu...')
#1 /container/www/includes/libs/rdbms/database/Database.php(1200): Wikimedia\Rdbms\Database->reportQueryError('Unknown column ...', 1054, 'SELECT COUNT(D...', 'SMW\\SQLStore\\Qu...', false)
#2 /container/www/includes/libs/rdbms/database/Database.php(1653): Wikimedia\Rdbms\Database->query('SELECT COUNT(D...', 'SMW\\SQLStore\\Qu...')
#3 [internal function]: Wikimedia\Rdbms\Database->select('`mw_smw_object_...', 'COUNT(DISTINCT ...', '(((MATCH(t1.o_t...', 'SMW\\SQLStore\\Qu...', Array, Array)
#4 /container/www/includes/libs/rdbms/database/DBConnRef.php(49): call_user_func_array(Array, Array)
#5 /container/www/includes/libs/rdbms/database/DBConnRef.php(254): Wikimedia\Rdbms\DBConnRef->__call('select', Array)
#6 /container/www/extensions/SemanticMediaWiki/src/MediaWiki/Connection/Database.php(283): Wikimedia\Rdbms\DBConnRef->select('`mw_smw_object_...', 'COUNT(DISTINCT ...', '(((MATCH(t1.o_t...', 'SMW\\SQLStore\\Qu...', Array, Array)
#7 /container/www/extensions/SemanticMediaWiki/src/SQLStore/QueryEngine/QueryEngine.php(345): SMW\MediaWiki\Connection\Database->select('`mw_smw_object_...', 'COUNT(DISTINCT ...', '(((MATCH(t1.o_t...', 'SMW\\SQLStore\\Qu...', Array)
#8 /container/www/extensions/SemanticMediaWiki/src/SQLStore/QueryEngine/QueryEngine.php(221): SMW\SQLStore\QueryEngine\QueryEngine->getCountQueryResult(Object(SMWQuery), 0)
#9 /container/www/extensions/SemanticMediaWiki/src/SQLStore/SQLStore.php(374): SMW\SQLStore\QueryEngine\QueryEngine->getQueryResult(Object(SMWQuery))
#10 /container/www/extensions/SemanticMediaWiki/src/SQLStore/SQLStore.php(362): SMW\SQLStore\SQLStore->fetchQueryResult(Object(SMWQuery))
#11 /container/www/extensions/SemanticMediaWiki/includes/query/SMW_QueryProcessor.php(338): SMW\SQLStore\SQLStore->getQueryResult(Object(SMWQuery))
#12 /container/www/extensions/SemanticMediaWiki/src/ParserFunctions/AskParserFunction.php(361): SMWQueryProcessor::getResultFromQuery(Object(SMWQuery), Array, 2, 1001)
#13 /container/www/extensions/SemanticMediaWiki/src/ParserFunctions/AskParserFunction.php(196): SMW\ParserFunctions\AskParserFunction->doFetchResultsFromFunctionParameters(Array, Array)
#14 /container/www/extensions/SemanticMediaWiki/src/ParserFunctionFactory.php(402): SMW\ParserFunctions\AskParserFunction->parse(Array)
#15 /container/www/includes/parser/Parser.php(3426): SMW\ParserFunctionFactory->SMW\{closure}(Object(Parser), '[[Stichwort in ...', 'mainlabel=Seite', '?Suchstichwort=...', 'limit=1000', 'format=count', 'outro= Erge...')
#16 /container/www/includes/parser/Parser.php(3127): Parser->callParserFunction(Object(PPTemplateFrame_DOM), 'ask', Array)
#17 /container/www/includes/parser/Preprocessor_DOM.php(1277): Parser->braceSubstitution(Array, Object(PPTemplateFrame_DOM))
#18 /container/www/includes/parser/Parser.php(3305): PPFrame_DOM->expand(Object(DOMElement))
#19 /container/www/includes/parser/Preprocessor_DOM.php(1277): Parser->braceSubstitution(Array, Object(PPFrame_DOM))
#20 /container/www/includes/parser/Parser.php(2942): PPFrame_DOM->expand(Object(DOMElement), 0)
#21 /container/www/includes/parser/Parser.php(1293): Parser->replaceVariables('{{Stichwort nac...')
#22 /container/www/includes/parser/Parser.php(443): Parser->internalParse('{{Stichwort nac...')
#23 /container/www/extensions/PageForms/specials/PF_RunQuery.php(98): Parser->parse('{{Stichwort nac...', Object(Title), Object(ParserOptions), true, false)
#24 /container/www/extensions/PageForms/specials/PF_RunQuery.php(26): PFRunQuery->printPage('Stichwort nachs...', false)
#25 /container/www/includes/specialpage/SpecialPage.php(522): PFRunQuery->execute('Stichwort_nachs...')
#26 /container/www/includes/specialpage/SpecialPageFactory.php(568): SpecialPage->run('Stichwort_nachs...')
#27 /container/www/includes/MediaWiki.php(288): SpecialPageFactory::executePath(Object(Title), Object(RequestContext))
#28 /container/www/includes/MediaWiki.php(861): MediaWiki->performRequest()
#29 /container/www/includes/MediaWiki.php(524): MediaWiki->main()
#30 /container/www/index.php(42): MediaWiki->run()
#31 {main}

Backtrace:

#0 /container/www/extensions/SemanticMediaWiki/src/SQLStore/QueryEngine/QueryEngine.php(345): SMW\MediaWiki\Connection\Database->select(string, string, string, string, array)
#1 /container/www/extensions/SemanticMediaWiki/src/SQLStore/QueryEngine/QueryEngine.php(221): SMW\SQLStore\QueryEngine\QueryEngine->getCountQueryResult(SMWQuery, integer)
#2 /container/www/extensions/SemanticMediaWiki/src/SQLStore/SQLStore.php(374): SMW\SQLStore\QueryEngine\QueryEngine->getQueryResult(SMWQuery)
#3 /container/www/extensions/SemanticMediaWiki/src/SQLStore/SQLStore.php(362): SMW\SQLStore\SQLStore->fetchQueryResult(SMWQuery)
#4 /container/www/extensions/SemanticMediaWiki/includes/query/SMW_QueryProcessor.php(338): SMW\SQLStore\SQLStore->getQueryResult(SMWQuery)
#5 /container/www/extensions/SemanticMediaWiki/src/ParserFunctions/AskParserFunction.php(361): SMWQueryProcessor::getResultFromQuery(SMWQuery, array, integer, integer)
#6 /container/www/extensions/SemanticMediaWiki/src/ParserFunctions/AskParserFunction.php(196): SMW\ParserFunctions\AskParserFunction->doFetchResultsFromFunctionParameters(array, array)
#7 /container/www/extensions/SemanticMediaWiki/src/ParserFunctionFactory.php(402): SMW\ParserFunctions\AskParserFunction->parse(array)
#8 /container/www/includes/parser/Parser.php(3426): SMW\ParserFunctionFactory->SMW\{closure}(Parser, string, string, string, string, string, string)
#9 /container/www/includes/parser/Parser.php(3127): Parser->callParserFunction(PPTemplateFrame_DOM, string, array)
#10 /container/www/includes/parser/Preprocessor_DOM.php(1277): Parser->braceSubstitution(array, PPTemplateFrame_DOM)
#11 /container/www/includes/parser/Parser.php(3305): PPFrame_DOM->expand(DOMElement)
#12 /container/www/includes/parser/Preprocessor_DOM.php(1277): Parser->braceSubstitution(array, PPFrame_DOM)
#13 /container/www/includes/parser/Parser.php(2942): PPFrame_DOM->expand(DOMElement, integer)
#14 /container/www/includes/parser/Parser.php(1293): Parser->replaceVariables(string)
#15 /container/www/includes/parser/Parser.php(443): Parser->internalParse(string)
#16 /container/www/extensions/PageForms/specials/PF_RunQuery.php(98): Parser->parse(string, Title, ParserOptions, boolean, boolean)
#17 /container/www/extensions/PageForms/specials/PF_RunQuery.php(26): PFRunQuery->printPage(string, boolean)
#18 /container/www/includes/specialpage/SpecialPage.php(522): PFRunQuery->execute(string)
#19 /container/www/includes/specialpage/SpecialPageFactory.php(568): SpecialPage->run(string)
#20 /container/www/includes/MediaWiki.php(288): SpecialPageFactory::executePath(Title, RequestContext)
#21 /container/www/includes/MediaWiki.php(861): MediaWiki->performRequest()
#22 /container/www/includes/MediaWiki.php(524): MediaWiki->main()
#23 /container/www/index.php(42): MediaWiki->run()
#24 {main}

Environment

Version used:

Software Version
MediaWiki 1.31.1
PHP 7.3.21 (fpm-fcgi)
MariaDB 10.5.4-MariaDB
Extension Version
Semantic Internal Objects 0.8.2 (7b94fec) 21:50, 26. Jul. 2017
Semantic Compound Queries 2.1.0 (75e8b38)
Semantic MediaWiki 3.1.5 (1a5a657)
Semantic Result Formats 3.1.0 (aa0649f)
  • Browser Name and version: Firefox 78.7.0esr (64-Bit)
  • Operating System and version (desktop or mobile): Linux

Possible Solution

Suggested maintenance update from the debug report («Did you forget to run your application's database schema updater after upgrading?») did not resolve the error yet:

php maintenance/update.php --quick --conf ./LocalSettings.php
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information