From 52fd3a0e830accee917cef77b0977287cf385649 Mon Sep 17 00:00:00 2001 From: Jeff Date: Wed, 28 May 2014 23:28:04 -0700 Subject: [PATCH] PostgreSQL: Support table prefixes PostgreSQL is usually not used with table name prefixes, and some of the PostgreSQL-specific code took the shortcut of not dealing with prefixes. However, the PHPUnit tests do force a prefix to be used, exposing this limitation. Make PostgreSQL code add the prefix to table names being used in FOR UPDATE OF clause. This fixes 13 of the 17 PostgreSQL unit tests errors against git HEAD: EditPageTest::testAutoMerge with data set #1 ('Elmo', 'one EditPageTest::testAutoMerge with data set #2 ('Elmo', 'Intro EditPageTest::testAutoMerge with data set #3 ('Adam', 'one EditPageTest::testAutoMerge with data set #4 ('Adam', 'one EditPageTest::testAutoMerge with data set #5 ('Adam', 'Intro EditPageTest::testAutoMerge with data set #6 ('Berta', 'one EditPageTest::testAutoMerge with data set #7 ('Berta', 'one EditPageTest::testAutoMerge with data set #8 ('Berta', 'Intro WikiPageTest::testDoEdit WikiPageTest::testDoEditContent WikiPageTest::testDoRollback WikiPageTest::testDoRollbackFailureSameContent WikiPageTest::testExists The change also applies to 1.22.6 and fixes several unit tests errors there. Change-Id: I054690f49e250cadd2dc2a6d9e20dea879d896b6 --- includes/db/DatabasePostgres.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/includes/db/DatabasePostgres.php b/includes/db/DatabasePostgres.php index 131b7581a3..1cbd1e22c5 100644 --- a/includes/db/DatabasePostgres.php +++ b/includes/db/DatabasePostgres.php @@ -1565,7 +1565,8 @@ SQL; //} if ( isset( $options['FOR UPDATE'] ) ) { - $postLimitTail .= ' FOR UPDATE OF ' . implode( ', ', $options['FOR UPDATE'] ); + $postLimitTail .= ' FOR UPDATE OF ' . + implode( ', ', array_map( array( &$this, 'tableName' ), $options['FOR UPDATE'] ) ); } elseif ( isset( $noKeyOptions['FOR UPDATE'] ) ) { $postLimitTail .= ' FOR UPDATE'; } -- 2.20.1