Closed taai closed 12 years ago
The simplest way to resolve this problem without modifying too many files was to query the last insert id from database:
SELECT lastval();
In the future I will try to figure out how to implement RETURNING
, but for now this fix is just fine.
The
last_insert_id()
isn't working for PostgreSQL 9.1, because in PostgreSQL 9.1 (already since version 8.1) the OIDS are turned off by default ( http://www.postgresql.org/docs/8.4/interactive/runtime-config-compatible.html#GUC-DEFAULT-WITH-OIDS ). So, if you don't turn on OIDS, you can't get the last insert id with Kohana Leap ORM. :(The query is:
The error is:
But the
RETURNING
could be the solution!The query:
The PHP:
And (!) the cool thing is that the
RETURNING id
returns all id's, so I can get all id's for inserted rows:I can immagine that in model's there could be some function that defined wich columns to return (
RETURNING
can return values from multiple columns), for example like this:Can you resolve this, please?