As per question:
PHP Postgres: Get Last Insert ID
they have stated that the best way to retrieve the last insert id is:
INSERT INTO ....
RETURNING id;
I want to create a wrapper class for Postgresql so that when i run, for example:
$id = $db_wrapper->insert("INSERT...");
that it will always return the last id inserted into variable $id
. I do not know the auto_inc column name for queries that will be passed to the insert()
function and I would prefer not to have to add "RETURNING id"
to the end of all my insert queries - any ideas on how to achieve this?