fixed schema_proc for pgSql to properly rename a table, if forgot to rename the index

This commit is contained in:
Ralf Becker 2003-04-30 11:07:24 +00:00
parent 486e0b043f
commit ad1a0a1cb3

View File

@ -517,10 +517,14 @@
{ {
$indexes[] = $val['index_name']; $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__); $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")); return !!($oProc->m_odb->query("ALTER TABLE $sOldTableName RENAME TO $sNewTableName"));
} }