Last modified: 2012-08-04 20:49:08 UTC

Wikimedia Bugzilla is closed!

Wikimedia has migrated from Bugzilla to Phabricator. Bug reports should be created and updated in Wikimedia Phabricator instead. Please create an account in Phabricator and add your Bugzilla email address to it.
Wikimedia Bugzilla is read-only. If you try to edit or create any bug report in Bugzilla you will be shown an intentional error message.
In order to access the Phabricator task corresponding to a Bugzilla report, just remove "static-" from its URL.
You could still run searches in Bugzilla or access your list of votes but bug reports will obviously not be up-to-date in Bugzilla.
Bug 15836 - Special:AllPages gives a database error for empty namespaces on PostgreSQL-based installations
Special:AllPages gives a database error for empty namespaces on PostgreSQL-ba...
Product: MediaWiki
Classification: Unclassified
Special pages (Other open bugs)
All All
: Normal normal (vote)
: ---
Assigned To: Nobody - You can work on this!
Depends on:
Blocks: postgres
  Show dependency treegraph
Reported: 2008-10-04 22:03 UTC by Brad Jorsch
Modified: 2012-08-04 20:49 UTC (History)
2 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---

Patch against r41664 that fixes the issue locally (727 bytes, patch)
2008-10-04 22:03 UTC, Brad Jorsch

Description Brad Jorsch 2008-10-04 22:03:33 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.


#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}
Comment 1 Huji 2008-10-05 18:24:28 UTC
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 > '' ....
Comment 2 Brad Jorsch 2008-10-06 14:02:06 UTC
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.
Comment 3 Greg Sabino Mullane 2008-10-10 18:16:18 UTC
Patch tested and applied in r41943, thanks!

Note You need to log in before you can comment on or make changes to this bug.