Re: SEQUENCE primary key

Поиск
Список
Период
Сортировка
От John McCawley
Тема Re: SEQUENCE primary key
Дата
Msg-id 45D26146.80903@hardgeus.com
обсуждение исходный текст
Ответ на SEQUENCE primary key  (gustavo halperin <ggh.develop@gmail.com>)
Ответы Re: SEQUENCE primary key  (Chris <dmagick@gmail.com>)
Список pgsql-general
In PostgreSQL 8 and up:

SELECT lastval();

gustavo halperin wrote:

> Hello
>
> I have a question, if I have a table with a SEQUENCE primary key, that
> obviously, I doesn't give in each new row inserted. For example if the
> table locks:
>  CREATE SEQUENCE id_seq;
>  CREATE TABLE table (     id    integer         DEFAULT
> nextval('id_seq')  CONSTRAINT table_id PRIMARY KEY,
>    arg1 integer,
>    arg2 integer
>  )
>
> How can I know which id receive each new row. I mean,
>
<http://ultralingua.com/onlinedictionary/index.html?action=define&ignoreaccents=on&wholewords=on&searchtype=stemming&text=sudden&service=english2spanish>

> suddenly  I insert one row (*) with the arg1 and arg2 . So ...,  there
> are something that I receive back ?? Some pointer, something? There
> are any way to know which number receive my row ?
>
> Thank you,
>   Gustavo
>
> (*) This process can be multi-thread. In my case I use the libraries
> with the wxWidget project with the class wxDbTable.
>
> ---------------------------(end of broadcast)---------------------------
> TIP 9: In versions below 8.0, the planner will ignore your desire to
>       choose an index scan if your joining column's datatypes do not
>       match


В списке pgsql-general по дате отправления:

Предыдущее
От: gustavo halperin
Дата:
Сообщение: SEQUENCE primary key
Следующее
От: Chris
Дата:
Сообщение: Re: SEQUENCE primary key