Re: get sequence value of insert command
| От | Achilleus Mantzios |
|---|---|
| Тема | Re: get sequence value of insert command |
| Дата | |
| Msg-id | Pine.LNX.4.44.0411191136220.13400-100000@matrix.gatewaynet.com обсуждение исходный текст |
| Ответ на | get sequence value of insert command (Erik Thiele <erik@thiele-hydraulik.de>) |
| Ответы |
Re: get sequence value of insert command
|
| Список | pgsql-sql |
O Erik Thiele έγραψε στις Nov 19, 2004 :
> hi
>
> create sequence mysequence;
>
> create table foo(
> id integer default nextval('mysequence'),
> bla text,
> wombat integer,
> foobar date,
> primary key(id)
> );
>
> insert into foo (wombat) values (88);
>
> now how do i know the id of my newly inserted element? and
> how can this be done in a completely concurrency safe way?
The way to do this is by reading the docs :)
use currval, it is session safe.
>
>
> cya
> erik
>
> ---------------------------(end of broadcast)---------------------------
> TIP 7: don't forget to increase your free space map settings
>
--
-Achilleus
В списке pgsql-sql по дате отправления: