> I have a field which is a primary key and an auto-incrementing one. Is
> there a way to get this value through DBI (!DBD) once an insert sql
> command is fired. I know it is possible in DBD::Mysql (through
> $sth->{'mysql_insertid'}, you can get it). But i am using
> DBD::Pg and it
> is always good if it is not Database Specific.
select currval('table_column_seq');
Gives the current value immediately after an insert in a Postgres database.
The docs imply there's some magic in the backend that keeps the
synchronisation correct between connections (Which is the hard part).
select nextval(<whatever>);
Increments the value.
Alas, not portable though.
Jon