https://bugzilla.wikimedia.org/show_bug.cgi?id=35025

       Web browser: ---
             Bug #: 35025
           Summary: syntax errors in SQL statement to delete unused
                    properties according to PostgreSQL
           Product: MediaWiki extensions
           Version: any
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: Unprioritized
         Component: Semantic MediaWiki
        AssignedTo: [email protected]
        ReportedBy: [email protected]
                CC: [email protected], [email protected]
    Classification: Unclassified
   Mobile Platform: ---


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.

-- 
Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
You are on the CC list for the bug.

_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to