Page MenuHomePhabricator

SMW::getUnusedPropertySubjects causes MySQL error 1044
Closed, ResolvedPublic


Author: admin

I'm configuring SMW on a new Mediawiki installation (haven't seen it fully functional yet, so it could be a configuration problem or a limitation in my hosting service). Going to pages Special:UnusedProperties or Special:CreateTemplate both return

Database error
A database query syntax error has occurred. This may indicate a bug in the software. The last attempted database query was:

(SQL query hidden) ## This is what it shows, it's not me changing it.

from within function "SMW::getUnusedPropertySubjects". MySQL returned error "1044: Access denied for user '*'@'%' to database '*' (***".

The installation is working well other than those two pages (which, of course, are the critical elements to my concept).

The output from Special:Version

Installed software

Product Version
MediaWiki 1.15.3
PHP 5.2.9 (cgi-fcgi)
MySQL 5.0.83-community-log

Installed extensions

Special pages
Admin Links (Version 0.1.2)
Semantic Drilldown (Version 0.7.2)
Semantic Forms (Version 1.9)

Parser hooks
Semantic MediaWiki (Version 1.5.0)

Extension functions
sfgParserFunctions, sfgSetupExtension and smwfSetupExtension

Parser extension tags
<ask> and <pre>

Parser function hooks
anchorencode, arraymap, arraymaptemplate, ask, basepagename, basepagenamee, concept, declare, defaultsort, displaytitle, filepath, formatdate, formatnum, forminput, formlink, fullpagename, fullpagenamee, fullurl, fullurle, gender, grammar, info, int, language, lc, lcfirst, localurl, localurle, namespace, namespacee, ns, numberingroup, numberofactiveusers, numberofadmins, numberofarticles, numberofedits, numberoffiles, numberofpages, numberofusers, numberofviews, padleft, padright, pagename, pagenamee, pagesincategory, pagesize, plural, protectionlevel, set, set_recurring_event, show, special, subjectpagename, subjectpagenamee, subjectspace, subjectspacee, subpagename, subpagenamee, tag, talkpagename, talkpagenamee, talkspace, talkspacee, uc, ucfirst and urlencode

I've also attached LocalSettings.php



Version: unspecified
Severity: major
OS: Linux



Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 11:03 PM
bzimport set Reference to bz23549.

admin wrote:

Local Settings


Regarding Special:Unusedproperties, this issue is probably due to the operation trying to create temporary tables for which your default user may not have sufficient rights. This can also happen in SMW queries if category or property hierarchies are taken into account.

To see the SQL query that causes the issue, you can set $wgShowSQLErrors = true;
$wgDebugDumpSql = true; in your LocalSettings (see for more help on gathering error information from MediaWiki).

If the query is CREATE TEMPORARY TABLE ... you need to provide this right to your DB user, or chose to disable the respective functions. This relates to two kinds of SMW features:

  • The special page unused properties. To disable it completely, you currently need to edit SMW by commenting out the following lines:

    $wgAutoloadClasses['SMWSpecialUnusedProperties'] = $smwgIP . 'specials/QueryPages/SMW_SpecialUnusedProperties.php'; $wgSpecialPages['UnusedProperties'] = array( 'SMWSpecialUnusedProperties' ); $wgSpecialPageGroups['UnusedProperties'] = 'maintenance';

In your current version, these lines should be found in ./includes/SMW_GlobalFunctions.php. From SMW 1.5.1 on, these lines will be in a new file called ./includes/SMW_Setup.php.

  • Category and property hierarchies in SMW queries. To disable the use of such hierarchies in SMW, add the following to your LocalSettings:

    $smwgQSubcategoryDepth = 0; $smwgQSubpropertyDepth = 0;

I am confident that this fixes your problems with SMW (feel free to re-open this bug if not). The other special page you mention does not belong to SMW. Please file a separate bug for the respective extension if the problem persists.

justjkk wrote:

I can confirm this bug with Semantic Mediawiki 1.5.4 and Postgresql 8.5.4

When opening Special:UnusedProperties page with $wgShowExceptionDetails = true; I get the following,

A database error has occurred
Query: DELETE FROM smw_tmp_unusedprops USING smw_tmp_unusedprops INNER JOIN smw_rels2 INNER JOIN smw_ids ON p_id=smw_id AND title=smw_title AND smw_iw=''
Function: SMW::getUnusedPropertySubjects
Error: 1 ERROR: syntax error at end of input
LINE 1: ...OIN smw_ids ON p_id=smw_id AND title=smw_title AND smw_iw=''

#0 /home/jkk/mediawiki-1.16.0/w/includes/db/Database.php(538): DatabasePostgres->reportQueryError('ERROR: syntax ...', 1, 'DELETE FROM smw...', 'SMW::getUnusedP...', false)
#1 /home/jkk/mediawiki-1.16.0/w/extensions/SemanticMediaWiki/includes/storage/SMW_SQLStore2.php(1106): DatabaseBase->query('DELETE FROM smw...', 'SMW::getUnusedP...')
#2 /home/jkk/mediawiki-1.16.0/w/extensions/SemanticMediaWiki/specials/QueryPages/SMW_SpecialUnusedProperties.php(100): SMWSQLStore2->getUnusedPropertiesSpecial(Object(SMWRequestOptions))
#3 /home/jkk/mediawiki-1.16.0/w/extensions/SemanticMediaWiki/specials/QueryPages/SMW_QueryPage.php(49): SMWUnusedPropertiesPage->getResults(Object(SMWRequestOptions))
#4 /home/jkk/mediawiki-1.16.0/w/extensions/SemanticMediaWiki/specials/QueryPages/SMW_SpecialUnusedProperties.php(45): SMWQueryPage->doQuery(0, 50)
#5 /home/jkk/mediawiki-1.16.0/w/includes/SpecialPage.php(559): SMWSpecialUnusedProperties->execute(NULL)
#6 /home/jkk/mediawiki-1.16.0/w/includes/Wiki.php(254): SpecialPage::executePath(Object(Title))
#7 /home/jkk/mediawiki-1.16.0/w/includes/Wiki.php(64): MediaWiki->handleSpecialCases(Object(Title), Object(OutputPage), Object(WebRequest))
#8 /home/jkk/mediawiki-1.16.0/w/index.php(117): MediaWiki->performRequestForTitle(Object(Title), NULL, Object(OutputPage), Object(User), Object(WebRequest))
#9 /home/jkk/mediawiki-1.16.0/w/index.php5(1): require('/home/jkk/media...')
#10 {main}

justjkk wrote:

I am terribly sorry, I just reopened the wrong bug.

hummelthomas wrote:

Well I am courious if the solution posted above is fine for the actual version.
I commented out the three lines in SMW_Setup.php and set the smwgQSubcategory -property-Settings. Unfortunately I cannot use the "further results"-link of a standard-query (Special:Ask).

I get the error:
Es ist ein Datenbankfehler aufgetreten. Der Grund kann ein Programmierfehler sein. Die letzte Datenbankabfrage lautete
CREATE TEMPORARY TABLE kamaro_smw_tmp_unusedprops( title VARCHAR(255) ) TYPE=MEMORY
aus der Funktion „SMW::getUnusedPropertySubjects“. Die Datenbank meldete den Fehler „1044: Benutzer 'xx'@'%' hat keine Zugriffsberechtigung f�r Datenbank 'dbxxx' (“.

I use the latest SMW version (Version from Semantic Bundle.

Special Pages (Semantic):

  • Semantic Bundle
  • Semantic Drilldown
  • Semantic Forms
  • Semantic Internal Object
  • Semantic Maps
  • Semantic MediaWiki
  • Semantic Result Formats
  • Semantic Tasks
Unknown Object (User) added a comment.Nov 7 2012, 4:24 AM

Can anyone confirm that this problem still occurs with SMW 1.8, otherwise I'm inclined to change the status to resolved.

If this problem still persists in SMW 1.8 don't hesitate to reopen this bug and provided when and how (system environment).

This has even been fixed now. The above problem were due to complicated temporary table operations used in SQLStore2. The new implementation SQLStore3 uses a completely different implementation for Special:UnusedProperties that does not need any of this complicated code. It is also much faster, but it certainly should not cause the above problems.