]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 352967: [PostgreSQL] Changing a DB column type to "serial" is broken on PostgreSQ...
authorlpsolit%gmail.com <>
Mon, 18 Sep 2006 20:49:04 +0000 (20:49 +0000)
committerlpsolit%gmail.com <>
Mon, 18 Sep 2006 20:49:04 +0000 (20:49 +0000)
Bugzilla/DB/Schema/Pg.pm

index 09e3bfbd4765f3fc8a72d41de592d0fbe0a97817..21b0c6d96a53524341933c8e52fbd3f949ee9b19 100644 (file)
@@ -120,7 +120,8 @@ sub _get_alter_type_sql {
     if ($new_def->{TYPE} =~ /serial/i && $old_def->{TYPE} !~ /serial/i) {
         push(@statements, "CREATE SEQUENCE ${table}_${column}_seq");
         push(@statements, "SELECT setval('${table}_${column}_seq',
-                                         MAX($table.$column))");
+                                         MAX($table.$column))
+                             FROM $table");
         push(@statements, "ALTER TABLE $table ALTER COLUMN $column 
                            SET DEFAULT nextval('${table}_${column}_seq')");
     }