Re: Question reagarding serial type.

Поиск
Список
Период
Сортировка
От Dustin Sallings
Тема Re: Question reagarding serial type.
Дата
Msg-id Pine.NEB.4.10.10006132118020.284-100000@foo.west.spy.net
обсуждение исходный текст
Ответ на Question reagarding serial type.  ("Mirko Geffken" <mgeffken@corcoranweb.com>)
Список pgsql-general
On Thu, 8 Jun 2000, Mirko Geffken wrote:

# i have tried to find info elsewhere, but did not find anything to my
# satisfaction, so I was wondering if anyone on this list could point me
# into the right direction.
#
# When I create a table
#
# e.g.:
# create table xyz
# (
#   id    serial PRIMARY KEY,
#   uvw   varchar2(100)
# );
#
# I would like to get the id returned when I insert into this table. In
# oracle it is possible to do this: insert into xyz(uvw) values ('Test')
# returning id;

    What if you had two serials?  I guess that's not terribly likely.

# How can I do this with SQL in Postgres. Any ideas.

insert into xyz(uvw) values ('Test');
INSERT 18968479 1
dustin=# select currval('xyz_id_seq');
 currval
---------
       1
(1 row)


--
dustin sallings                            The world is watching America,
http://2852210114/~dustin/                 and America is watching TV.


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

Предыдущее
От: "Marc Gehling"
Дата:
Сообщение: pg_dump error: cache lookup failed
Следующее
От: selkovjr@mcs.anl.gov
Дата:
Сообщение: Re: Size Limit