Last modified: 2012-08-04 20:49:08 UTC
Created attachment 5387 [details] Patch against r41664 that fixes the issue locally When attempting to use Special:AllPages on a empty namespace on a local installation, I get a database error (quoted at the bottom of this report). The error doesn't occur on MySQL because the Database class for MySQL converts php's boolean false to the empty string rather than the integer 0, and anyway MySQL will allow odd comparisons like "string >= integer". The attached patch (against r41664) seems to fix it for my local installation. ------ A database error has occurred Query: SELECT page_title FROM page WHERE page_namespace = '1' AND (page_title >= 0) ORDER BY page_title ASC LIMIT 2 OFFSET 344 Function: SpecialAllpages::showToplevel Error: 1 ERROR: operator does not exist: text >= integer LINE 1: ... page WHERE page_namespace = '1' AND (page_title >= 0) ORD... ^ HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts. Backtrace: #0 /usr/local/src/MediaWiki/phase3/includes/db/Database.php(574): DatabasePostgres->reportQueryError('ERROR: operato...', 1, 'SELECT page_ti...', 'SpecialAllpages...', false) #1 /usr/local/src/MediaWiki/phase3/includes/db/Database.php(982): Database->query('SELECT page_ti...', 'SpecialAllpages...') #2 /usr/local/src/MediaWiki/phase3/includes/specials/SpecialAllpages.php(165): Database->select('page', 'page_title', Array, 'SpecialAllpages...', Array) #3 /usr/local/src/MediaWiki/phase3/includes/specials/SpecialAllpages.php(61): SpecialAllpages->showToplevel(1, NULL, NULL) #4 /usr/local/src/MediaWiki/phase3/includes/SpecialPage.php(538): SpecialAllpages->execute(NULL) #5 /usr/local/src/MediaWiki/phase3/includes/Wiki.php(225): SpecialPage::executePath(Object(Title)) #6 /usr/local/src/MediaWiki/phase3/includes/Wiki.php(55): MediaWiki->initializeSpecialCases(Object(Title), Object(OutputPage), Object(WebRequest)) #7 /usr/local/src/MediaWiki/phase3/index.php(93): MediaWiki->initialize(Object(Title), NULL, Object(OutputPage), Object(User), Object(WebRequest)) #8 {main}
I'm not sure if this is the best solution. As the error message says, the problem is that 'page_title' field, which is a text field, is compared with an integer. Perhaps we should update the SQL statement to .... page_title > '' ....
The code there is already trying to determine if any lastTitle was found, it's just that it doesn't work because selectField returns false instead of null. page.page_title is declared "not null", so the query should never be able to actually return null. The other bit of the change is because passing '' causes the query to contain "AND ()", which is of course invalid SQL.
Patch tested and applied in r41943, thanks!