my $count = 0;
my $starttime = time;
+my $after_commit = '';
while ( my $rec = <> ) {
next unless ($rec);
for my $hint (@order) {
next if (grep { $_ eq $hint} @auto);
next unless ($fieldcache{$hint}{sequence});
- $main_out->print("SELECT setval('$fieldcache{$hint}{sequence}'::TEXT, (SELECT MAX($fieldcache{$hint}{pkey}) FROM $fieldcache{$hint}{table}), TRUE);\n\n");
+ $after_commit .= "SELECT setval('$fieldcache{$hint}{sequence}'::TEXT, (SELECT MAX($fieldcache{$hint}{pkey}) FROM $fieldcache{$hint}{table}), TRUE);\n";
}
if (grep /^mfr$/, %out_files) {
}
$main_out->print("COMMIT;\n\n") unless $nocommit;
+$main_out->print($after_commit);
$main_out->close;
$output->print("SET CLIENT_ENCODING TO 'UNICODE';\n\n");
$output->print("BEGIN;\n\n");
+my $after_commit = '';
for my $h (@order) {
# continue if there was no data for this table
next unless ($fieldcache{$h});
$output->print("SELECT reporter.disable_materialized_simple_record_trigger();\n");
}
- $output->print("SELECT setval('$fieldcache{$h}{sequence}'::TEXT, (SELECT MAX($fieldcache{$h}{pkey}) FROM $fieldcache{$h}{table}), TRUE);\n\n")
+ $after_commit .= "SELECT setval('$fieldcache{$h}{sequence}'::TEXT, (SELECT MAX($fieldcache{$h}{pkey}) FROM $fieldcache{$h}{table}), TRUE);\n";
if (!grep { $_ eq $h} @auto);
}
$output->print("COMMIT;\n\n") unless $nocommit;
+$output->print($after_commit);
$output->close;