Page MenuHomePhabricator

DatabasePostgres missing insertSelect wrapper
Closed, ResolvedPublic


Author: overlordq

The DatabasePostgres class is missing an insertSelect wrapper so it uses the method in Database.php which does not take into account the special handling for INSERT IGNORE.


A database error has occurred
Query: INSERT IGNORE INTO page_restrictions (pr_page,pr_type,pr_level,pr_cascade,pr_user,pr_expiry) SELECT 964,pr_type,pr_level,pr_cascade,pr_user,pr_expiry FROM page_restrictions WHERE pr_page = '5'
Function: Title::moveTo
Error: 1 ERROR: syntax error at or near "IGNORE"
LINE 1: INSERT /* Title::moveTo EvilWiki */ IGNORE INTO page_restric...


#0 /var/www/domain/wiki/includes/db/Database.php(616): DatabasePostgres->reportQueryError('ERROR: syntax ...', 1, 'INSERT IGNORE I...', 'Title::moveTo', false)
#1 /var/www/domain/wiki/includes/db/Database.php(1809): Database->query('INSERT IGNORE I...', 'Title::moveTo')
#2 /var/www/domain/wiki/includes/Title.php(2724): Database->insertSelect('page_restrictio...', 'page_restrictio...', Array, Array, 'Title::moveTo', Array)
#3 /var/www/domain/wiki/extensions/Renameuser/SpecialRenameuser_body.php(306): Title->moveTo(Object(Title), false, 'Automatically m...')
#4 /var/www/domain/wiki/includes/SpecialPage.php(559): SpecialRenameuser->execute(NULL)
#5 /var/www/domain/wiki/includes/Wiki.php(233): SpecialPage::executePath(Object(Title))
#6 /var/www/domain/wiki/includes/Wiki.php(62): MediaWiki->initializeSpecialCases(Object(Title), Object(OutputPage), Object(WebRequest))
#7 /var/www/domain/wiki/index.php(117): MediaWiki->initialize(Object(Title), NULL, Object(OutputPage), Object(User), Object(WebRequest))

#8 {main}

Version: 1.15.x
Severity: normal



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.

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 10:37 PM
bzimport added a project: Wikimedia-Rdbms.
bzimport set Reference to bz18909.

Thanks for the report, I'll look into this. If there is any special action needed on that special page to trigger the problem, please post it here.

overlordq wrote:

bad patch

Nothing special required, just whatever calls insertSelect with the IGNORE option which the only place I've found is in Title::moveTo when moving a protected page.

He's my rough sketchup, lots of duplicated code from insert to handle the ignore, didn't really see a good way to shoehorn it into the existing insert function.


  • Bug 19088 has been marked as a duplicate of this bug. ***
  • Bug 19088 has been marked as a duplicate of this bug. ***

overlordq wrote:

Applied in r58179 likely could be better reworked as a calling DB::select and DB::insert separately instead of duplicating rollback code.

Jdforrester-WMF added a subscriber: Jdforrester-WMF.

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