-
Notifications
You must be signed in to change notification settings - Fork 370
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix last insert ID not being returned with postgresql. #62
Conversation
I am thinking that RETURNING id is possibly the better of all the options there for this. I don't regularly use Postgres though so can anyone else chime in? |
This feature is going to slip to version 1.4 as there has been no further input. |
Thank you. I missed this notification from github. Answering your question - |
Is it likely that the servers will not have been upgraded to version 9.1? Ubuntu appear to have been running 9.1 as the default postgresql package for over a year now (Oneiric) although Debian are still 8.4 from what I can see. |
I would bet that there is still a lot of 8.x servers out there. Some are just legacy systems, others probably do not upgrade for various reasons (plugin compatibility, syntax changes, no need to, etc). I would not rely on 9.1 being the minimum version available. |
According to comments in the answer on the SO question that you linked to the In fact as I go back through documentation |
@treffynnon Oh, then I read it diagonally. Relied on best answer. Then, of course, |
Is there anyway you could have a go at getting |
OK, I'll do that. That will be separate pull request then. |
That would be perfect. Thanks! |
When using PostgreSQL, upon saving new entries id is not being updated.
That's because PDO's implementation of lastInsertId requires sequence name as a parameter. One of three available options is fetching LASTVAL(). All three are described in the answer to this SO question.
I 'fixed' it by adding driver specific last_insert_id() method to ORM class.