Fix autoincrement table generation for postgres
authorMichael M Slusarz <slusarz@curecanti.org>
Tue, 2 Nov 2010 17:50:36 +0000 (11:50 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Tue, 2 Nov 2010 18:04:40 +0000 (12:04 -0600)
framework/Db/lib/Horde/Db/Adapter/Postgresql/Schema.php

index 4df3e71..4cc858a 100644 (file)
@@ -550,9 +550,9 @@ class Horde_Db_Adapter_Postgresql_Schema extends Horde_Db_Adapter_Base_Schema
 
         if ($autoincrement) {
             $seq_name = $this->defaultSequenceName($tableName, $columnName);
-            if ($this->table($seq_name)) {
+            try {
                 $this->execute('DROP SEQUENCE ' . $seq_name . ' CASCADE');
-            }
+            } catch (Horde_Db_Exception $e) {}
             $this->execute('CREATE SEQUENCE ' . $seq_name);
 
             /* Can't use changeColumnDefault() since it quotes the