From: Brad Jorsch Date: Wed, 20 Feb 2019 15:22:26 +0000 (-0500) Subject: DatabasePostgres: Ignore "IGNORE" option to update() X-Git-Tag: 1.31.2~29 X-Git-Url: http://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=commitdiff_plain;h=669a21a925ca4b30f850905806c08dbd82ecf03d DatabasePostgres: Ignore "IGNORE" option to update() PostgreSQL doesn't support anything like this. For now, avoid generating invalid SQL by just ignoring the option. If we come up with a use case someday, that can guide implementation of a workalike. Bug: T215169 Change-Id: I1409c80b39834d1977c82c489226255a8cc93fd0 (cherry picked from commit 814605a979633fc37bcfa8319ddbfe627a66a308) --- diff --git a/RELEASE-NOTES-1.31 b/RELEASE-NOTES-1.31 index 17a47635a5..d705520cd5 100644 --- a/RELEASE-NOTES-1.31 +++ b/RELEASE-NOTES-1.31 @@ -56,6 +56,7 @@ THIS IS NOT A RELEASE YET removed. * (T209885) Prevent populateSearchIndex.php from breaking once actor migration has been started. +* (T215169) Fix for Database::update() with IGNORE option fails on PostgreSQL. == MediaWiki 1.31.1 == diff --git a/includes/libs/rdbms/database/DatabasePostgres.php b/includes/libs/rdbms/database/DatabasePostgres.php index 9610839c15..94509a3c02 100644 --- a/includes/libs/rdbms/database/DatabasePostgres.php +++ b/includes/libs/rdbms/database/DatabasePostgres.php @@ -640,6 +640,18 @@ __INDEXATTR__; return true; } + protected function makeUpdateOptionsArray( $options ) { + if ( !is_array( $options ) ) { + $options = [ $options ]; + } + + // PostgreSQL doesn't support anything like "ignore" for + // UPDATE. + $options = array_diff( $options, [ 'IGNORE' ] ); + + return parent::makeUpdateOptionsArray( $options ); + } + /** * INSERT SELECT wrapper * $varMap must be an associative array of the form [ 'dest1' => 'source1', ... ]