Closed tassoevan closed 11 years ago
Currently, I'm using the following workaround:
$obj->save();
$obj->id = $obj->orm->get_db()->lastInsertId('schema.table_id_seq');
Some code has just been added to the develop branch of Idiorm earlier today that uses PostgreSQL's RETURNING keyword to return last insert ID. Perhaps you could test that code out and let me know how you get on.
Just swap out idiorm.php in your project with the one in the develop branch of Idiorm after backing up.
I don't regularly use PostgreSQL so I cannot comment on your question in your initial issue report.
It works like a charm! I've forgot that RETURNING keyword is a better solution. Thanks for the answer and for this beautiful ORM library!
I know that exist an annoying problem in PDO pgsql driver that required the sequence name in lastInsertId() method. The sequence ID often has a column-based default name that can be used here, right?