Author: BugZilla.MediaWiki
Description:
MediaWiki 1.18.1
PHP 5.3.10
PostgreSQL 8.4.10
Semantic MediaWiki 1.7.0.2
In
extensions/SemanticMediaWiki/includes/storage/SMW_SQLStore2.php
line 1090, at least PostgreSQL does not like the delete statement
$db->query( "DELETE FROM $smw_tmp_unusedprops USING $smw_tmp_unusedprops INNER JOIN " . $db->tableName( $proptable->name ) . " INNER JOIN $smw_ids ON p_id=smw_id AND title=smw_title AND smw_iw=" . $db->addQuotes( '' ), __METHOD__ );
as far as I can tell for the following reasons:
- the first join is missing its predicate (it's erroneously put at the end of the statement
- the target table is not aliased properly (the query throws a warning in the dbms for this about duplicate table- or fieldnames)
- the joining order is incorrect since the $smw_ids table holds the 'p_id' field which is referenced in the other property table join predicate
Something like
$sql = "DELETE FROM $smw_tmp_unusedprops t USING $smw_tmp_unusedprops r1 INNER JOIN $smw_ids r2 ON title = smw_title AND smw_iw = " . $db->addQuotes ( '' ) . " INNER JOIN " . $db->tableName ( $proptable->name ) . " r3 ON p_id = smw_id"; $db->query( $sql, __METHOD__ );
works for me.
Version: unspecified
Severity: normal