Last modified: 2012-08-04 20:49:03 UTC
Steps to reproduce: 1) On a fresh install of MediaWiki 1.11.0, using a PostgreSQL 8.1 database 2) I edit the main page to insert an 'x' at the start (i.e. make an arbitrary change). 3) Go to the 'History' page and click on 'Compare Selected Versions'. The following result ensues because YYYYMMDDHHMMSS is not valid syntax for a timestamp. It should separate the date and time parts with a 'T' like '20071211T072639'. When I manually run the query with that edit it does not cause an error. The full error detail is as follows: A database error has occurred Query: SELECT * FROM recentchanges WHERE rc_timestamp = '20071211074158' AND rc_this_oldid = '2' AND rc_last_oldid = '1' AND rc_patrolled = '0' Function: DifferenceEngine::showDiffPage Error: 1 ERROR: invalid input syntax for type timestamp with time zone: "20071211074158" Backtrace: #0 /usr/share/mediawiki/includes/Database.php(795): DatabasePostgres->reportQueryError('ERROR: invalid...', 1, 'SELECT * FROM...', 'DifferenceEngin...', false) #1 /usr/share/mediawiki/includes/Database.php(1240): Database->query('SELECT * FROM...', 'DifferenceEngin...') #2 /usr/share/mediawiki/includes/RecentChange.php(100): Database->select('recentchanges', '*', Array, 'DifferenceEngin...') #3 /usr/share/mediawiki/includes/DifferenceEngine.php(177): RecentChange::newFromConds(Array, 'DifferenceEngin...') #4 /usr/share/mediawiki/includes/Article.php(674): DifferenceEngine->showDiffPage(false) #5 /usr/share/mediawiki/includes/Wiki.php(383): Article->view() #6 /usr/share/mediawiki/includes/Wiki.php(48): MediaWiki->performAction(Object(OutputPage), Object(Article), Object(Title), Object(User), Object(WebRequest)) #7 /usr/share/mediawiki/index.php(89): MediaWiki->initialize(Object(Title), Object(OutputPage), Object(User), Object(WebRequest)) #8 {main}
Note that I actually have to simplify the query to: SELECT * FROM mediawiki.recentchanges WHERE rc_this_oldid = '2' AND rc_last_oldid = '1' ; Before I get any actual *results*. Changing the format of the timestamp as I described above only means that the query does not generate a parse error in the database. Regards, Andrew McMillan.
This was fixed in r25696. Use the diff there, or simply patch DifferenceEngine.php yourself by changing line 174 or so (the one with rc_timestamp) to: 'rc_timestamp' => $db->timestamp( $this->mNewRev->getTimestamp() ),