From 814605a979633fc37bcfa8319ddbfe627a66a308 Mon Sep 17 00:00:00 2001 From: Brad Jorsch Date: Wed, 20 Feb 2019 10:22:26 -0500 Subject: [PATCH] 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. Also, remove a pointless "IGNORE" from populateExternallinksIndex60.php. el_index_60 isn't uniquely indexed, so it has no effect anyway. Bug: T215169 Change-Id: I1409c80b39834d1977c82c489226255a8cc93fd0 --- includes/libs/rdbms/database/DatabasePostgres.php | 12 ++++++++++++ maintenance/populateExternallinksIndex60.php | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/includes/libs/rdbms/database/DatabasePostgres.php b/includes/libs/rdbms/database/DatabasePostgres.php index 0935d5a135..381b1fd9c6 100644 --- a/includes/libs/rdbms/database/DatabasePostgres.php +++ b/includes/libs/rdbms/database/DatabasePostgres.php @@ -653,6 +653,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', ... ] diff --git a/maintenance/populateExternallinksIndex60.php b/maintenance/populateExternallinksIndex60.php index 9b029fefaa..695773e2af 100644 --- a/maintenance/populateExternallinksIndex60.php +++ b/maintenance/populateExternallinksIndex60.php @@ -73,7 +73,7 @@ class PopulateExternallinksIndex60 extends LoggedUpdateMaintenance { ], [ 'el_id' => $row->el_id, - ], __METHOD__, [ 'IGNORE' ] + ], __METHOD__ ); } wfWaitForSlaves(); -- 2.20.1