Page MenuHomePhabricator

$wgSharedDB crashes with SQLite DB
Closed, ResolvedPublic

Description

Steps to reproduce:

  1. Make a fresh installation of MediaWiki (I tried 1.27.4 LTS, 1.29.2, last snapshot 1.29, 1.30) targeted to SQLite DB. Other info in installation is not important.
  2. Set parameter $wgSharedDB to the same name of main DB from installation process
  3. Set parameter $wgSharedTables = array('user', 'user_properties', 'ipblocks', 'user_former_groups', 'user_groups', 'site_stats', 'interwiki', 'mwuser');
  4. Open main page of wiki, and it will crash

Cause:

  • "ATTACH DATABASE" is probably not included well if executing query contains JOIN statements.
  • If file name of main/shared DB is "en.sqlite", then the JOIN statement transforms to "INNER JOIN en.user" but crashes with error "no such table: en.user"

Log:

Original exception: [375c9086ffee3a81b773c183] /wiki-en/index.php Wikimedia\Rdbms\DBQueryError from line 1075 of C:\Dev\Web\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 rev_id,rev_page,rev_text_id,rev_timestamp,rev_comment,rev_user_text,rev_user,rev_minor_edit,rev_deleted,rev_len,rev_parent_id,rev_sha1,rev_content_format,rev_content_model,page_namespace,page_title,page_id,page_latest,page_is_redirect,page_len,user_name FROM revision INNER JOIN page ON ((page_id = rev_page)) LEFT JOIN en.user ON ((rev_user != 0) AND (user_id = rev_user)) WHERE rev_page = '1' AND page_id = '1' AND rev_id = '1' LIMIT 1 Function: Revision::fetchFromConds Error: 1 no such table: en.user