Hi Gurus,

This has been bothered me for a couple of days. I wrote a postgres db application in perl which parses a syslog file and inserts some data into a table. I put the actual insertion in a eval block, so the application won't die when insertion fails. But it doesn't work as I expected. When it encounter a "DBD::Pg::st execute failed: ERROR:  Bad timestamp external representation 'Jan 11 18:05:50   at (eval 9) line 426, <MSGS> line 1." error, the whole program die.

I'm using DBD::Pg intereface, postgres 7.1.3. Here is the codes:

-----------------------------------------------------------------------
my $dbh = DBI->connect("dbi:Pg:dbname=$dbname",$dbuser,$dbpass,{AutoCommit => 0,RaiseError => 1,PrintError => 0}) || die "Unable to connect to $dbname on $dbhost [$DBI::errstr]\n";

while(1)
{
        # reading from MSGS and parsing here

        $sth = $dbh->prepare("insert into http_request
                                (INTERFACE_ID,INTERFACE_DIR,REQUEST_TIME,SRC,URL,result_id)
                        values(?, ?, ?, ?, ?, ?)");

        eval {
          $sth->execute($ifid,$idir,$timestamp,$userip,$destip,$rid);
          $sth->finish;
          $dbh->commit;
        };

        if($@)
        {
                print "Insert failed\n";
                print "$@";
        }
}

---------------------------------------------------------------------------

I noticed that the timestamp is not valid, but the excution should continue. Strange thing is that it didn't die right away. After print"$@" prints out the error "DBD::Pg::st execute failed: ERROR:  Bad timestamp external representation 'Jan 11 18:05:50   at (eval 9) line 426, <MSGS> line 1." it dies.

So what do I miss here?

Thanks in advance!


Andy