Page MenuHomePhabricator

Wikibase does not support database table prefix
Open, LowPublic


I have two mediawiki instances to different databases:

  1. web_common_base - WikiBase repo.
  2. web_kitsune_solar - WikiBase client.

Both databases have tables prefix "qw1233_"

I have sql error in url:Заглавная_страница&action=info.
It seems, in query missing table prefix.

DB name "web_common_base" there is, table "wb_items_per_site" there is, but not table prefix "qw1233_".

WikiBase version: Wikibase-REL1_31-8178d16

Event Timeline

Restricted Application added a project: Wikidata. · View Herald TranscriptOct 14 2018, 11:38 PM
Restricted Application added a subscriber: Aklapper. · View Herald Transcript
Reedy renamed this task from Not support database table prefix to Wikibase does not support database table prefix.Oct 14 2018, 11:46 PM

I just checked this with a fresh install using install.php and then update.php to install the wikibase dbs and the table was correctly created with the prefix.

How did you install wikibase?
Is it possible you ran update.php without having$wgDBprefix correctly set for example?

Addshore triaged this task as Low priority.Oct 15 2018, 11:53 AM
Addshore moved this task from incoming to needs discussion or investigation on the Wikidata board.

Tables is correct created prefix. Prefix missing in query!

KitsuneSolar added a comment.EditedOct 15 2018, 12:53 PM

Here is my real prefix. I did not want to show it.

Tables are created correctly. But the SQL query goes WITHOUT the prefix. seems to load correctly for me now? Is this definitely still happened?

I looked through all of the code and couldn't find any occurrence of a wb_items_per_site query that should be messed up.
This is the code for the query, and the prefix should be handled by the mediawiki DB abstraction

		$result = $db->selectRow(
			[ 'ips_item_id' ],
				'ips_site_id' => $globalSiteId,
				'ips_site_page' => $pageTitle,

It's possible there is an issue with the abstraction.

KitsuneSolar added a comment.EditedOct 16 2018, 1:53 PM

@Addshore i just removed tables prefixes :)
But the problem is present somewhere in the code.

I think...
The SQL query does not correctly handle this line.
SQL query does not include table prefix.

lucamauri removed a subscriber: lucamauri.
lucamauri added a subscriber: lucamauri.

I just setup my own Wikibase installation using two instances as per the original message of @KitsuneSolar .
I created one wiki where both Repository and Client are installed and it worked like a charm even with table prefix. The other instance only contains Client and in fact I had the same issue explained here: the client only look for wb_items_per_site without any table prefix.

I believe the problem lies in the fact that the table prefix is set in the Localsettings.php file of the Repository instance, but there is no way to configure the table prefix in WikibaseClient.example.php of the Client instance. In fact reinstalling a new Repository MediaWiki instance without table prefix solved the issue.