Last value inserted

Поиск
Список
Период
Сортировка
От MaRCeLO PeReiRA
Тема Last value inserted
Дата
Msg-id 20041111125916.82486.qmail@web52703.mail.yahoo.com
обсуждение исходный текст
Ответы Re: Last value inserted  (Franco Bruno Borghesi <franco@akyasociados.com.ar>)
Re: Last value inserted  (Robby Russell <robby@planetargon.com>)
Re: Last value inserted  ("Uwe C. Schroeder" <uwe@oss4u.com>)
Re: Last value inserted  (Bruno Wolff III <bruno@wolff.to>)
Re: Last value inserted  (Richard Huxton <dev@archonet.com>)
Список pgsql-general
Hi guys,

I am in troubles with a SERIAL field.

I have five tables. A parent table and four child
tables. When I do the INSERT in the parent table, I
have an ID (generated) by the sequence (SERIAL field),
and I have to use this ID to reference all child
tables.

Well, once I do an INSERT in the parent table, how can
I know (for sure) which number id was generated by the
sequence?

Simple example:

------------------------------------------------------
CREATE TABLE parent(id SERIAL, descrip CHAR(50));
------------------------------------------------------

So,

------------------------------------------------------
INSERT INTO parent (descrip) VALUES ('project 1');
------------------------------------------------------

How can I now (for sure) with value was generated by
the sequence to fill the field ID?

(There is lots of users using the software at the same
time, so I am not able to use the last_value()
function on the sequence.)

Best Regards,

Marcelo Pereira
Brazil





_______________________________________________________
Yahoo! Acesso Grátis - Internet rápida e grátis. Instale o discador agora! http://br.acesso.yahoo.com/

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

Предыдущее
От: Shridhar Daithankar
Дата:
Сообщение: New Opteron server from pogo linux
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Can't insert date in field with foreign key