I have a table and I'm use UUID
type for the USERID field, I generate it with uuid_generate_v4()
. I trying to get the last USERID that insert in my table. I,m use CodeIgniter and PostgreSQL.
this is my code
$array = array('some data');
$this->db->set('"USERID"', 'uuid_generate_v4()', FALSE);
$this->db->set('"INPUTDATE"', 'CURRENT_TIMESTAMP', FALSE);
$this->db->insert('rbac."MSTPENGGUNA"',$array);
$id = $this->db->insert_id('rbac."MSTPENGGUNA"."USERID"');
echo "<pre>";
var_dump($id);
echo "</pre>";
that code return error cross-database references are not implemented: "rbac.MSTPENGGUNA.USERID" LINE 1: SELECT CURRVAL('rbac."MSTPENGGUNA"."USERID"') AS ins_id ^
rbac
is schema and "MSTPENGGUNA"
is table.
I had use manual query with RETURNING USERID
but it made more error in my query.
Anyone can help me ?