Re: How I can read-back a serial value just inserted?

Поиск
Список
Период
Сортировка
От Adam Rich
Тема Re: How I can read-back a serial value just inserted?
Дата
Msg-id 096901c73ac5$9126dcc0$6400a8c0@dualcore
обсуждение исходный текст
Ответ на How I can read-back a serial value just inserted?  ("dfx" <dfx@dfx.it>)
Ответы Re: How I can read-back a serial value just inserted?  (Robert Treat <xzilla@users.sourceforge.net>)
Список pgsql-general
If it's a recent PG:

select lastval()

See this:

http://www.postgresql.org/docs/8.2/interactive/functions-sequence.html


-----Original Message-----
From: pgsql-general-owner@postgresql.org
[mailto:pgsql-general-owner@postgresql.org] On Behalf Of dfx
Sent: Monday, January 01, 2007 11:46 AM
To: pgsql-general@postgresql.org
Subject: [GENERAL] How I can read-back a serial value just inserted?


Dear Sirs,

my question is very simple:
when I insert a row whith a serial field, a value is automatically
generated; how  can I know this value, strictly of my row, without the
risk
of to read the value of another subsequent insertion?

Thank you.

Domenico



---------------------------(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 по дате отправления:

Предыдущее
От: Madison Kelly
Дата:
Сообщение: Re: How I can read-back a serial value just inserted?
Следующее
От: Gene
Дата:
Сообщение: datatype advice numeric vs. varchar