| От | Alvaro Herrera |
|---|---|
| Тема | Re: SQL-question: returning the id of an insert querry |
| Дата | |
| Msg-id | 20031109185245.GA28993@dcc.uchile.cl обсуждение исходный текст |
| Ответ на | Re: SQL-question: returning the id of an insert querry (Scott Chapman <scott_list@mischko.com>) |
| Ответы |
Re: SQL-question: returning the id of an insert querry
|
| Список | pgsql-general |
On Sun, Nov 09, 2003 at 10:26:51AM -0800, Scott Chapman wrote:
> On Sunday 09 November 2003 03:13, Martijn van Oosterhout wrote:
> > After you've done the insert on the address table, you can use
> > currval('address_id_seq') (or equivalent) to get the ID. Ofcourse you
> > have to have used nextval() for the original insert.
>
> What if someone else inserts another address before I get the currval?
> I'm out of luck then, right?
No, currval is concurrency-safe. That's exactly what sequences are for.
--
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
"I call it GNU/Linux. Except the GNU/ is silent." (Ben Reiter)
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера