From 1b60e0f309a32a476993ff6b5dcffa511e1aea3b Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Sun, 30 May 2004 11:18:47 +0000 Subject: [PATCH] fixed droping of non-existing primary keys --- phpgwapi/inc/class.schema_proc_pgsql.inc.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/phpgwapi/inc/class.schema_proc_pgsql.inc.php b/phpgwapi/inc/class.schema_proc_pgsql.inc.php index a84c997386..1e9e5b403f 100644 --- a/phpgwapi/inc/class.schema_proc_pgsql.inc.php +++ b/phpgwapi/inc/class.schema_proc_pgsql.inc.php @@ -611,7 +611,9 @@ $pkeys = $oProc->m_odb->pkey_columns($sOldTableName); if(!in_array($sOldTableName . '_pkey',$indexes) && !isset($pkeys[0])) // no idea how this can happen { - $oProc->m_odb->query("ALTER TABLE " . $sOldTableName . " DROP CONSTRAINT " . $sOldTableName . "_pkey",__LINE__,__FILE__); + // this happens if the table has no primary key --> nothing to do + // trying to drop the (not existing) constrain results in an error + //$oProc->m_odb->query("ALTER TABLE " . $sOldTableName . " DROP CONSTRAINT " . $sOldTableName . "_pkey",__LINE__,__FILE__); } else // rename the index {