From: Marcel Werk Date: Thu, 5 Jan 2012 15:46:57 +0000 (+0100) Subject: Fixed a PostgreSQL issue X-Git-Tag: 2.0.0_Beta_1~1445^2~6 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=d713ff96c3a36186fd738d2b9afe0d76824a3b9d;p=GitHub%2FWoltLab%2FWCF.git Fixed a PostgreSQL issue --- diff --git a/wcfsetup/install/files/lib/system/database/editor/PostgreSQLDatabaseEditor.class.php b/wcfsetup/install/files/lib/system/database/editor/PostgreSQLDatabaseEditor.class.php index eb8fcaf0eb..18eeea23d4 100644 --- a/wcfsetup/install/files/lib/system/database/editor/PostgreSQLDatabaseEditor.class.php +++ b/wcfsetup/install/files/lib/system/database/editor/PostgreSQLDatabaseEditor.class.php @@ -223,8 +223,15 @@ class PostgreSQLDatabaseEditor extends DatabaseEditor { $columns = ArrayUtil::trim(explode(',', $indexData['columns'])); if (empty($indexName)) { // create index name - // TODO: solve naming conflicts $indexName = $tableName.'_'.(!empty($columns[0]) ? $columns[0] : 'generic').'_key'; + + // solve naming conflicts + $indices = $this->getIndices($tableName); + $i = 2; + while (in_array($indexName, $indices)) { + $indexName = $tableName.'_'.(!empty($columns[0]) ? $columns[0] : 'generic').'_'.$i.'_key'; + $i++; + } } else { $indexName = $tableName.'_'.$indexName.'_key';