Page MenuHomePhabricator

MSSQL Database error "bit is invalid for sum operator" on Special:WantedPages
Closed, DeclinedPublic

Description

Installed software
MediaWiki 1.27.1
PHP 5.6.30 (cgi-fcgi)
MS SQL Server 10.50.6529

Problem:
During testing of a SQL Server based MEDIAWIKI installation, We encountered an error documented below. I know this should not be a surprise, since CARGO is not guaranteed to work with SQL Server. We are hoping someone will create a fix for this page.

The Problem was discovered when we selected "Wanted Pages" from the "Special Pages" Page as detailed below:
A database query error has occurred. This may indicate a bug in the software.

Query:
SELECT TOP 51 pl_namespace AS [namespace],pl_title AS [title],COUNT(*) AS [value] FROM [wiki].[pagelinks] LEFT JOIN [wiki].[page] [pg1] ON ((pg1.page_namespace = pl_namespace) AND (pg1.page_title = pl_title)) LEFT JOIN [wiki].[page] [pg2] ON ((pg2.page_id = pl_from)) WHERE (pg1.page_namespace IS NULL) AND (pl_namespace NOT IN ( '2', '3' )) AND (pg2.page_namespace != '8') GROUP BY pl_namespace,pl_title HAVING (COUNT(*) > 0) AND (COUNT(*) > SUM(pg2.page_is_redirect)) ORDER BY value DESC
Function: WantedPagesPage::reallyDoQuery
Error: 8117 [SQLSTATE 42000][Error Code 8117][Microsoft][ODBC Driver 11 for SQL Server][SQL Server]Operand data type bit is invalid for sum operator. [SQLSTATE 42000][Error Code 8180][Microsoft][ODBC Driver 11 for SQL Server][SQL Server]Statement(s) could not be prepared.

Backtrace:
#0 C:\inetpub\wwwroot\WCR\includes\db\Database.php(901): DatabaseBase->reportQueryError('[SQLSTATE 42000...', 8117, 'SELECT TOP 51 ...', 'WantedPagesPage...', false) #1 C:\inetpub\wwwroot\WCR\includes\db\DatabaseMssql.php(427): DatabaseBase->query('SELECT TOP 51 ...', 'WantedPagesPage...') #2 C:\inetpub\wwwroot\WCR\includes\specialpage\QueryPage.php(422): DatabaseMssql->select(Array, Array, Array, 'WantedPagesPage...', Array, Array) #3 C:\inetpub\wwwroot\WCR\includes\specialpage\QueryPage.php(575): QueryPage->reallyDoQuery(51, 0) #4 C:\inetpub\wwwroot\WCR\includes\specials\SpecialWantedpages.php(48): QueryPage->execute(NULL) #5 C:\inetpub\wwwroot\WCR\includes\specialpage\SpecialPage.php(479): WantedPagesPage->execute(NULL) #6 C:\inetpub\wwwroot\WCR\includes\specialpage\SpecialPageFactory.php(576): SpecialPage->run(NULL) #7 C:\inetpub\wwwroot\WCR\includes\MediaWiki.php(282): SpecialPageFactory::executePath(Object(Title), Object(RequestContext)) #8 C:\inetpub\wwwroot\WCR\includes\MediaWiki.php(745): MediaWiki->performRequest() #9 C:\inetpub\wwwroot\WCR\includes\MediaWiki.php(519): MediaWiki->main() #10 C:\inetpub\wwwroot\WCR\index.php(43): MediaWiki->run() #11 {main}

Event Timeline

matmarex renamed this task from Error on "Wanted Pages" to Error on "Wanted Pages" with MSSQL.Mar 20 2017, 3:27 PM
matmarex added a project: MediaWiki-libs-Rdbms.
Krinkle renamed this task from Error on "Wanted Pages" with MSSQL to MSSQL Database error on Special: Wanted Pages.Jul 18 2019, 7:42 PM
Krinkle renamed this task from MSSQL Database error on Special: Wanted Pages to MSSQL Database error "bit is invalid for sum operator" on Special:WantedPages.
Krinkle edited projects, added MediaWiki-Special-pages; removed MediaWiki-libs-Rdbms.
Krinkle moved this task from To triage to Maintenance reports on the MediaWiki-Special-pages board.

Heads-up: As per RFC discussion in August 2019, the previously experimental support for using Oracle or MSSQL as database backends in MediaWiki core has been removed in MediaWiki 1.34, so this task might end up as declined in the future.