Last modified: 2014-11-19 11:54:20 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T37025, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 35025 - syntax errors in SQL statement to delete unused properties according to PostgreSQL
syntax errors in SQL statement to delete unused properties according to Postg...
Status: RESOLVED FIXED
Product: MediaWiki extensions
Classification: Unclassified
Semantic MediaWiki (Other open bugs)
unspecified
All All
: Unprioritized normal (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-03-07 06:49 UTC by Bob de Vries
Modified: 2014-11-19 11:54 UTC (History)
3 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Bob de Vries 2012-03-07 06:49:46 UTC
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.
Comment 1 MWJames 2014-11-19 11:54:20 UTC
Expected to be solved by [0].

[0] https://github.com/SemanticMediaWiki/SemanticMediaWiki/pull/638

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links