From: ivan Date: Thu, 12 Jun 2003 13:47:51 +0000 (+0000) Subject: debugging X-Git-Tag: freeside_1_5_0pre3~57 X-Git-Url: http://git.freeside.biz/gitweb/?a=commitdiff_plain;h=cbf32a25fcfc38632d1262ad8261e679e1c9b7c5;p=freeside.git debugging --- diff --git a/bin/fix-sequences b/bin/fix-sequences index 55639d962..d5349ee74 100755 --- a/bin/fix-sequences +++ b/bin/fix-sequences @@ -42,16 +42,19 @@ foreach my $table ( @tables ) { my $seq = "${table}_${primary_key}_seq"; if ( driver_name eq 'Pg' && defined($col->default) - && $col->default =~ /^nextval\('"(\w+_seq)"'::text\)$/ + && $col->default =~ /^nextval\('"(public\.)?(\w+_seq)"'::text\)$/ ) { - $seq = $1; + $seq = $2; } warn "fixing sequence for $table\n"; - $dbh->do( "SELECT setval( '$seq', - ( SELECT max($primary_key) FROM $table ) );" ) - or die $dbh->errstr; + + my $sql = "SELECT setval( '$seq', + ( SELECT max($primary_key) FROM $table ) );" ); + + warn $col->default. " $seq\n$sql\n"; + $dbh->do( $sql ) or die $dbh->errstr; }