Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: How to get inserted id from postgres

by AnomalousMonk (Archbishop)
on Sep 30, 2022 at 22:54 UTC ( #11147192=note: print w/replies, xml ) Need Help??


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:  <%-{-{-{-<

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11147192]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (3)
As of 2023-02-04 02:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I prefer not to run the latest version of Perl because:







    Results (30 votes). Check out past polls.

    Notices?