fixed problem for PostgreSQL when changing primary keys for a table
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@4819 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
parent
6426ca1e56
commit
6394de13d9
@ -864,15 +864,15 @@ sub updateschema
|
||||
xCAT::MsgUtils->message("S", "Error changing the keys for table " . $self->{tabname} .":" . $self->{dbh}->errstr);
|
||||
}
|
||||
} else { #for the rest, recreate the table
|
||||
print "need to change keys\n";
|
||||
#print "need to change keys\n";
|
||||
my $btn=$tn . "_xcatbackup";
|
||||
|
||||
#remove the backup table just in case;
|
||||
my $str="DROP TABLE $btn";
|
||||
$self->{dbh}->do($str);
|
||||
#my $str="DROP TABLE $btn";
|
||||
#$self->{dbh}->do($str);
|
||||
|
||||
#rename the table name to name_xcatbackup
|
||||
$str = "ALTER TABLE $tn RENAME TO $btn";
|
||||
my $str = "ALTER TABLE $tn RENAME TO $btn";
|
||||
$self->{dbh}->do($str);
|
||||
if ($self->{dbh}->errstr) {
|
||||
xCAT::MsgUtils->message("S", "Error renaming the table from $tn to $btn:" . $self->{dbh}->errstr);
|
||||
@ -898,6 +898,11 @@ sub updateschema
|
||||
$str = "DROP TABLE $btn";
|
||||
$self->{dbh}->do($str);
|
||||
}
|
||||
|
||||
if (!$self->{dbh}->{AutoCommit}) {
|
||||
$self->{dbh}->commit;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user