Here is a small script that reproduces the problem:
$ cat ii
#!/usr/bin/perl
use strict;
use warnings;
use lib '/ems_src/lib/modules';
use DBI;
my $h = 'foo';
my $v1 = 382;
my $v2 = 1;
my $dbh = DBI->connect("dbi:Pg:dbname='mydb';host='dbhost'");
my $sth = $dbh->prepare("INSERT INTO host_flags (host,total,active) VALUES
(?,?,?)");
$sth->execute($h,$v1,$v2);
__END__
$ ./ii
DBD::Pg::st execute failed: ERROR: column "total" is of type integer but
expression is of type character varying
HINT: You will need to rewrite or cast the expression.
--
Brandon