SemanticMediaWiki / SemanticScribunto

Provides service functions to support the Scribunto extension
Other
23 stars 14 forks source link

Error: 1137 Can't reopen table: 'p' () #73

Closed mwjames closed 5 years ago

mwjames commented 5 years ago

Setup and configuration

Issue

Query: SELECT p.smw_title AS prop, o_id AS id0, o0.smw_title AS v0, o0.smw_namespace AS v1, o0.smw_iw AS v2, o0.smw_sortkey AS v3, o0.smw_subobject AS v4, o0.smw_sort AS v5 FROM `unittest_smw_di_wikipage` INNER JOIN `unittest_smw_object_ids` AS p ON p_id=p.smw_id INNER JOIN `unittest_smw_object_ids` AS o0 ON o_id=o0.smw_id WHERE (s_id='29') AND (p.smw_iw!=':smw') AND (p.smw_iw!=':smw-delete')
Function: SMW\SQLStore\EntityStore\SemanticDataLookup::fetchSemanticDataFromTable
Error: 1137 Can't reopen table: 'p' ()

When running tests, MW's default behaviour (we have to rely on Scribunto_LuaEngineTestBase for that matter) is to clone tables as TEMPORARY TABLE which isn't an issue with MariaDB but when used with MySQL as in case of Travis-CI, tests run into Error: 1137 which translates into "You cannot refer to a TEMPORARY table more than once in the same query" [0].

The reason is that a table like unittest_smw_object_ids is created as TEMPORARY TABLE with p being another TEMP reference to a TEMPORARY TABLE which isn't allowed in MySQL.

[0] https://dev.mysql.com/doc/refman/8.0/en/temporary-table-problems.html