Bug 352967: [PostgreSQL] Changing a DB column type to "serial" is broken on PostgreSQL 8.1 - Patch by R�mi Zara <remi_zara@mac.com> r=mkanat a=myk

This commit is contained in:
lpsolit%gmail.com 2006-09-18 13:49:04 +00:00
parent 2e0d57d2af
commit 437cb983e4

View 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')");
}