Open pali opened 5 years ago
Given the way that DBD::Pg interacts between $sth and $dbh, I don't see a way to make $sth->last_insert_id different from $dbh->last_insert_id. But maybe that's ok. I added some tests for $sth->last_insert_id in 2b11c6d273375f1996b66600c439937b6f57d313
If you can think of a way to differentiate the two, please update this issue.
Is it feasible to call $dbh->last_insert_id
after every query and store its value in the $sth
?
DBI API since version 1.642 has support for
last_insert_id
also for statement handle (not only database handle), see: https://metacpan.org/pod/DBI#last_insert_id1It would be nice if DBD::Pg supports and implement this method.
Difference between
$dbh->last_insert_id
and$sth->last_insert_id
is that$dbh
's one returns last global insert id and$sth
's one returns insert id for the last executed query by$sth
.