diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html
index c624d9d004..3b6679250d 100644
--- a/phpBB/docs/CHANGELOG.html
+++ b/phpBB/docs/CHANGELOG.html
@@ -281,6 +281,7 @@ p a {
[Fix] Overcome Oracle's inability to handle IN() clauses with over one thousand elements (Bug #12449)
[Fix] Simulate Firebird's affected rows mechanism for older versions of PHP
[Fix] Custom BBCodes properly handle lowercasing of parameterized tags (Bug #12377)
+ [Fix] Update the forum_id sequence for PostgreSQL during conversion (Bug #11927)
diff --git a/phpBB/install/convertors/functions_phpbb20.php b/phpBB/install/convertors/functions_phpbb20.php
index 5c7bf2f903..ec282c8f46 100644
--- a/phpBB/install/convertors/functions_phpbb20.php
+++ b/phpBB/install/convertors/functions_phpbb20.php
@@ -92,8 +92,6 @@ function phpbb_insert_forums()
$db->sql_query('SET IDENTITY_INSERT ' . FORUMS_TABLE . ' ON');
break;
}
-
-
$cats_added = array();
while ($row = $src_db->sql_fetchrow($result))
@@ -281,6 +279,10 @@ function phpbb_insert_forums()
switch ($db->sql_layer)
{
+ case 'postgres':
+ $db->sql_query("SELECT SETVAL('" . FORUMS_TABLE . "_seq',(select case when max(forum_id)>0 then max(forum_id)+1 else 1 end from " . FORUMS_TABLE . '));');
+ break;
+
case 'mssql':
case 'mssql_odbc':
$db->sql_query('SET IDENTITY_INSERT ' . FORUMS_TABLE . ' OFF');