From 15eeb3b2d50af3b9190890153e539baf04cefd3d Mon Sep 17 00:00:00 2001 From: chenglch Date: Wed, 2 Nov 2016 15:20:08 +0800 Subject: [PATCH] Skit auditlog and eventlog table as auto increment key is uesd (#2066) Close-issue: #2065 --- perl-xCAT/xCAT/Table.pm | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/perl-xCAT/xCAT/Table.pm b/perl-xCAT/xCAT/Table.pm index a97fbf7c0..67b1b2b8f 100644 --- a/perl-xCAT/xCAT/Table.pm +++ b/perl-xCAT/xCAT/Table.pm @@ -1724,12 +1724,15 @@ sub setAttribs my %newpairs; # NOTE(chenglch): Just work around, set the default value to '' due to # null value can not be allowed in composite primary keys in standard - # SQL rules. - my $descr = $xCAT::Schema::tabspec{ $self->{tabname} }; - my @pkeys = @{$descr->{keys}}; - for my $p (@pkeys) { - if(!defined($elems->{$p}) && !defined($pKeypairs->{$p})) { - $elems->{$p}= ''; + # SQL rules. As auto increment key is uesd by 'eventlog' and 'auditlog' + # table, just skip these tables. + if ($self->{tabname} ne "eventlog" && $self->{tabname} ne "auditlog") { + my $descr = $xCAT::Schema::tabspec{ $self->{tabname} }; + my @pkeys = @{$descr->{keys}}; + for my $p (@pkeys) { + if(!defined($elems->{$p}) && !defined($pKeypairs->{$p})) { + $elems->{$p}= ''; + } } }