From 5750cad16151bf7ad028f7dc79a8ab39b2f9a07a Mon Sep 17 00:00:00 2001 From: "lpsolit%gmail.com" <> Date: Mon, 18 Sep 2006 20:49:04 +0000 Subject: Bug 352967: [PostgreSQL] Changing a DB column type to "serial" is broken on PostgreSQL 8.1 - Patch by RĂ©mi Zara r=mkanat a=myk MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Bugzilla/DB/Schema/Pg.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Bugzilla/DB/Schema/Pg.pm b/Bugzilla/DB/Schema/Pg.pm index 09e3bfbd4..21b0c6d96 100644 --- a/Bugzilla/DB/Schema/Pg.pm +++ b/Bugzilla/DB/Schema/Pg.pm @@ -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')"); } -- cgit v1.2.3-24-g4f1b