Page MenuHomePhabricator

PostgreSQL API bug in ApiQueryWatchlist::run
Closed, ResolvedPublic

Description

Author: harding.ian

Description:
<?xml version="1.0" encoding="utf-8"?>
<api>

<error code="internal_api_error" info="Exception Caught: A database error has occurred

Query: SELECT rc_cur_id,rc_this_oldid,rc_namespace,rc_title,rc_new,rc_minor,rc_timestamp FROM watchlist,page,recentchanges WHERE (wl_namespace = rc_namespace) AND (wl_title = rc_title) AND (rc_cur_id = page_id) AND wl_user = '1' AND (rc_timestamp > '') ORDER BY rc_timestamp DESC LIMIT 11
Function: ApiQueryWatchlist::run
Error: 1 ERROR: invalid input syntax for type timestamp with time zone: ""
">

#0 /usr/local/mediawiki-1.10.0/includes/Database.php(761): DatabasePostgres->reportQueryError('ERROR: invalid...', 1, 'SELECT rc_cur_...', 'ApiQueryWatchli...', false)
#1 /usr/local/mediawiki-1.10.0/includes/Database.php(1179): Database->query('SELECT rc_cur_...', 'ApiQueryWatchli...')
#2 /usr/local/mediawiki-1.10.0/includes/api/ApiQueryBase.php(121): Database->select(Array, Array, Array, 'ApiQueryWatchli...', Array)
#3 /usr/local/mediawiki-1.10.0/includes/api/ApiQueryWatchlist.php(128): ApiQueryBase->select('ApiQueryWatchli...')
#4 /usr/local/mediawiki-1.10.0/includes/api/ApiQueryWatchlist.php(41): ApiQueryWatchlist->run()
#5 /usr/local/mediawiki-1.10.0/includes/api/ApiQuery.php(155): ApiQueryWatchlist->execute()
#6 /usr/local/mediawiki-1.10.0/includes/api/ApiMain.php(225): ApiQuery->execute()
#7 /usr/local/mediawiki-1.10.0/includes/api/ApiMain.php(137): ApiMain->executeAction()
#8 /usr/local/mediawiki-1.10.0/includes/api/ApiMain.php(126): ApiMain->executeActionWithErrorHandling()
#9 /usr/local/mediawiki-1.10.0/api.php(38): ApiMain->execute()
#10 {main}

</error>
</api>


Version: 1.10.x
Severity: enhancement

Details

Reference
bz10109

Related Objects

View Standalone Graph
This task is connected to more than 200 other tasks. Only direct parents and subtasks are shown here. Use View Standalone Graph to show more of the graph.
StatusSubtypeAssignedTask
InvalidNone
ResolvedNone

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 9:48 PM
bzimport set Reference to bz10109.
bzimport added a subscriber: Unknown Object (MLST).

Not sure why ApiQueryWatchlist.php has a hardcoded:
rc_timestamp > ''
I'm hesitant to remove or change until I understand why this is done, so cc'ing the author of that file.

This has something to do with the way mysql does indexing and query optimizations. I implemented it this way in order to match the query as used in the special:watchlist

The new subversion server won't let me commit, but we can isolate this to MySQL by adding:
if ( $wgDBtype == 'mysql' )
before line 135, and adding $wgDBtype to the global declaration at line 54.

Jdforrester-WMF subscribed.

Migrating from the old tracking task to a tag for PostgreSQL-related tasks.