From ad1a0a1cb36098f3526d6b04df45e67366261a9e Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Wed, 30 Apr 2003 11:07:24 +0000 Subject: [PATCH] fixed schema_proc for pgSql to properly rename a table, if forgot to rename the index --- phpgwapi/inc/class.schema_proc_pgsql.inc.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/phpgwapi/inc/class.schema_proc_pgsql.inc.php b/phpgwapi/inc/class.schema_proc_pgsql.inc.php index c50f360e4c..5f757b1757 100644 --- a/phpgwapi/inc/class.schema_proc_pgsql.inc.php +++ b/phpgwapi/inc/class.schema_proc_pgsql.inc.php @@ -517,10 +517,14 @@ { $indexes[] = $val['index_name']; } - if(!in_array($sOldTableName . '_pkey',$indexes)) + if(!in_array($sOldTableName . '_pkey',$indexes)) // no idea how this can happen { $oProc->m_odb->query("DROP INDEX " . $sOldTableName . "_pkey",__LINE__,__FILE__); } + else // rename the index + { + $oProc->m_odb->query('ALTER TABLE '.$sOldTableName.'_pkey RENAME TO '.$sNewTableName.'_pkey'); + } return !!($oProc->m_odb->query("ALTER TABLE $sOldTableName RENAME TO $sNewTableName")); }