Re: currval question
| От | Jason Earl |
|---|---|
| Тема | Re: currval question |
| Дата | |
| Msg-id | 87it15o44i.fsf@npa01zz001.simplot.com обсуждение исходный текст |
| Ответ на | currval question ("Andy Kriger" <akriger@greaterthanone.com>) |
| Список | pgsql-general |
"Andy Kriger" <akriger@greaterthanone.com> writes: > I am trying to get the last value updated by an column > auto-incrementing with nextval(). In MySQL, you'd use > LAST_INSERT_ID() - in Postgre, currval() appears to do the trick. Yes, currval is the thing to use to do this. > Is this maintained on a per-connection basis? For example, user A > inserts and the nextval() updates to 5, user B does 2 inserts, > updating nextval() to 7. When user A calls currval() they should get > 5 if the updates are per-cnx. What does psql do under the hood > here? currval is per connection. User A's currval would get them 5 and user B would get 7. Basically as long as you are using the same connection currval will do "The right thing"TM. Jason
В списке pgsql-general по дате отправления: