Last modified: 2012-11-07 06:34:02 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 T25701, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 23701 - MySQL error on SMW_setup.php
MySQL error on SMW_setup.php
Status: RESOLVED WORKSFORME
Product: MediaWiki extensions
Classification: Unclassified
Semantic MediaWiki (Other open bugs)
unspecified
All Linux
: Normal normal (vote)
: ---
Assigned To: Markus Krötzsch
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2010-05-28 17:47 UTC by alxndr+wikimedia
Modified: 2012-11-07 06:34 UTC (History)
4 users (show)

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


Attachments

Description alxndr+wikimedia 2010-05-28 17:47:32 UTC
Getting an error when trying to set up SMW on MW 1.15.3 with MySQL 5.0.67:

<code>
php5 SMW_setup.php
X-Powered-By: PHP/5.2.13
Content-type: text/html

Setting up standard database configuration for SMW ...

Selected storage engine is "SMWSQLStore2" (or an extension thereof)

Setting up table `[wikiname]_smw_ids` ...
A database query syntax error has occurred.
The last attempted database query was:
"CREATE TABLE `[dbname]`.`[wikiname]_smw_ids` (smw_id  INT(8) UNSIGNED NOT NULL KEY AUTO_INCREMENT,smw_namespace  INT(11) NOT NULL,smw_title  VARBINARY(255) NOT NULL,smw_iw  VARCHAR(32) binary,smw_sortkey  VARBINARY(255) NOT NULL) ENGINE=InnoDB"
from within function "SMWSQLHelpers::setupTable".
MySQL returned error "1064: You have an error in your SQL syntax.  Check the manual that corresponds to your MySQL server version for the right syntax to use near 'KEY AUTO_INCREMENT,smw_namespace  INT(11) NOT NULL,smw_title  V ([dbserver])"
</code>

I had SMW 1.0 or 1.1 on this wiki ages ago, but disabled it in 2008.
Comment 1 Markus Krötzsch 2010-05-28 21:31:52 UTC
The former installation should not be contributing to this problem (the DB tables changed completely). Which version of SMW are you using now?
Comment 2 Markus Krötzsch 2010-08-29 20:52:05 UTC
Closing this bug as WORKSFORME since the described failure could not be reproduced, and since no further information is provided on the problem.
Comment 3 Paul Murphy 2010-11-05 10:48:06 UTC
This error also happens for me when using MW 1.14.0, PHP 5.1.6, and MySQL 4.0.18-MAX

The issue is that the code in SMW_SQLHelpers.php, SMW_SQLStore2_Queries.php and SMW_SQLStore2.php generates SQL which defines tables as "KEY AUTO_INCREMENT", but this needs to be "PRIMARY KEY AUTO_INCREMENT" for the version of MySQL in use.

I have patched my install with these changes, and both the Admin page interface and running the SMW_setup.php directly now works.
Comment 4 Alexander 2011-07-08 05:51:22 UTC
MW 1.17.0, SMW 1.16 alpha (r91713), PHP 5.2.17, MySQL 4.0.27-max-log

When running SMW_setup.php:

-------------
Setting up standard database configuration for SMW ...

Selected storage engine is "SMWSQLStore2" (or an extension thereof)

Checking table `xxxxx_smw_ids` ...
   Table not found, now creating...
A database query syntax error has occurred.
The last attempted database query was:
"CREATE TABLE `xxxxx`.`xxxxx_smw_ids` (smw_id  INT(8) UNSIGNED NOT NULL KEY AUTO_INCREMENT,smw_namespace  INT(11) NOT NULL,smw_title  VARBINARY(255) NOT NULL,smw_iw  VARCHAR(32) binary NOT NULL,smw_subobject  VARCHAR(32) binary NOT NULL,smw_sortkey  VARBINARY(255) NOT NULL) ENGINE=InnoDB"
from within function "SMWSQLHelpers::createTable".
Database returned error "1064: You have an error in your SQL syntax.  Check the manual that corresponds to your MySQL server version for the right syntax to use near 'KEY AUTO_INCREMENT,smw_namespace  INT(11) NOT NULL,smw_title  V (xxxxx.xxxxx.xxx)"
-------------

Paul's fix above worked for me as well, but only includes/storage/SMW_SQLHelpers.php and includes/storage/SMW_SQLStorage2.php needed the tweak (s/(?<!PRIMARY) KEY AUTO/).
Comment 5 Alexander 2011-07-08 05:52:30 UTC
Ah, for shame. s/(?<!PRIMARY) KEY AUTO/PRIMARY KEY AUTO/
Comment 6 isj 2011-07-20 15:12:04 UTC
Probably similar error with "AUTO_INCREMENT" (wikimedia 1.17) in Drafts extension (http://www.mediawiki.org/wiki/Extension_talk:Drafts). Update script raport an error: 
Database returned error "1: near &quot;AUTOINCREMENT&quot;: syntax error"

for proper Draft.sql content:

CREATE TABLE /*_*/drafts (
    -- Unique ID for drafts
    draft_id INTEGER AUTO_INCREMENT, ...

Isn't there something wrong with wikimedia update.php which cause undescore removement from valid sql syntax?
Comment 7 MWJames 2012-11-07 06:34:02 UTC
This bug hasn't seen any update during the last year and it is unknown if this bug still relates the current SMW 1.8/SQLStore3.

Please feel free to reopen this bug again if it applies to SMW 1.8.

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


Navigation
Links