in reply to How to get inserted id from postgres

$sth->execute(...) || die "...: $sqlstatement $sth->errstr";

Tangentially, note that the object reference $sth in the double-quoted string in the statement quoted above will stringify to something like HASH(0x123abc) and the printed output will look something like
    "... HASH(0x123abc)->errstr"
(update: unless maybe it's tie-ed or something weird like that). See Perl::Critic policy to catch quoted execution?

An effective alternative would be (untested):
    $sth->execute(...) || die "...: $sqlstatement ", $sth->errstr;


Give a man a fish:  <%-{-{-{-<