Page MenuHomePhabricator

Wikibase update.php run - Wikibase\PropertyInfoTableBuilder::rebuildPropertyInfo SQL error
Closed, ResolvedPublic

Description

When installing a new wiki, enabling wikibase and running update.php I get the following:

Creating wb_property_info table ...done.
Populating wb_property_info
[c9b64565b4ed9b87f56943c3] [no req]   Wikimedia\Rdbms\DBQueryError from line 1233 of /var/www/mediawiki/includes/libs/rdbms/database/Database.php: A database query error has occurred. Did you forget to run your application's database schema updater after upgrading?
Query: SELECT  page_title,page_id  FROM `page` LEFT JOIN `wb_property_info` ON ((CONCAT('P',pi_property_id) = page_title))   WHERE (page_id > 1) AND (page_namespace = ) AND (pi_property_id IS NULL)  ORDER BY page_id ASC LIMIT 100   FOR UPDATE
Function: Wikibase\PropertyInfoTableBuilder::rebuildPropertyInfo
Error: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ') AND (pi_property_id IS NULL)  ORDER BY page_id ASC LIMIT 100
  FOR UPDATE' at line 1 (db-master)

Backtrace:
#0 /var/www/mediawiki/includes/libs/rdbms/database/Database.php(1044): Wikimedia\Rdbms\Database->reportQueryError(string, integer, string, string, boolean)
#1 /var/www/mediawiki/includes/libs/rdbms/database/Database.php(1428): Wikimedia\Rdbms\Database->query(string, string)
#2 /var/www/mediawiki/extensions/Wikibase/repo/includes/Store/Sql/PropertyInfoTableBuilder.php(177): Wikimedia\Rdbms\Database->select(array, array, array, string, array, array)
#3 /var/www/mediawiki/extensions/Wikibase/repo/includes/Store/Sql/DatabaseSchemaUpdater.php(210): Wikibase\PropertyInfoTableBuilder->rebuildPropertyInfo()
#4 /var/www/mediawiki/includes/installer/DatabaseUpdater.php(482): Wikibase\Repo\Store\Sql\DatabaseSchemaUpdater::rebuildPropertyInfo(MysqlUpdater)
#5 /var/www/mediawiki/includes/installer/DatabaseUpdater.php(450): DatabaseUpdater->runUpdates(array, boolean)
#6 /var/www/mediawiki/maintenance/update.php(200): DatabaseUpdater->doUpdates(array)
#7 /var/www/mediawiki/maintenance/doMaintenance.php(94): UpdateMediaWiki->execute()
#8 /var/www/mediawiki/maintenance/update.php(245): require_once(string)
#9 {main}

Event Timeline

So the issue is:

(page_namespace = )

it looks like that is because I failed to load the example settings (I only loaded the default settings) for wikibase.
I can probably improve this slightly.

Change 416656 had a related patch set uploaded (by Addshore; owner: Addshore):
[mediawiki/extensions/Wikibase@master] Throw usefull exception if rebuildPropertyInfo is run with no NS

https://gerrit.wikimedia.org/r/416656

The patch changes the error to the following while trying to run with no defined namespace:

Populating wb_property_info
[51ded37ce3f4421d44ad29f6] [no req]   RuntimeException from line 132 of /var/www/mediawiki/extensions/Wikibase/repo/includes/Store/Sql/PropertyInfoTableBuilder.php: Wikibase\PropertyInfoTableBuilder::rebuildPropertyInfo can not run with no Property namespace defined.
Backtrace:
#0 /var/www/mediawiki/extensions/Wikibase/repo/includes/Store/Sql/DatabaseSchemaUpdater.php(210): Wikibase\PropertyInfoTableBuilder->rebuildPropertyInfo()
#1 /var/www/mediawiki/includes/installer/DatabaseUpdater.php(482): Wikibase\Repo\Store\Sql\DatabaseSchemaUpdater::rebuildPropertyInfo(MysqlUpdater)
#2 /var/www/mediawiki/includes/installer/DatabaseUpdater.php(450): DatabaseUpdater->runUpdates(array, boolean)
#3 /var/www/mediawiki/maintenance/update.php(200): DatabaseUpdater->doUpdates(array)
#4 /var/www/mediawiki/maintenance/doMaintenance.php(94): UpdateMediaWiki->execute()
#5 /var/www/mediawiki/maintenance/update.php(245): require_once(string)
#6 {main}
Addshore moved this task from Unsorted 💣 to Active 🚁 on the User-Addshore board.

Change 416656 merged by jenkins-bot:
[mediawiki/extensions/Wikibase@master] Throw usefull exception if rebuildPropertyInfo is run with no NS

https://gerrit.wikimedia.org/r/416656