mysql_insert_id alternative for postgresql
From the PostgreSQL point of view, in pseudo-code: * $insert_id = INSERT…RETURNING foo_id;– only works for PostgreSQL >= 8.2. * INSERT…; $insert_id = SELECT lastval(); — works for PostgreSQL >= 8.1 * $insert_id = SELECT nextval(‘foo_seq’); INSERT INTO table (foo…) values ($insert_id…) for older PostgreSQL (and newer PostgreSQL) pg_last_oid() only works where you have OIDs. … Read more