get sequence value of insert command

From: Erik Thiele <erik(at)thiele-hydraulik(dot)de>
To: pgsql-sql(at)postgresql(dot)org
Subject: get sequence value of insert command
Date: 2004-11-19 08:41:34
Message-ID: 20041119094134.2437d867.erik@thiele-hydraulik.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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?

cya
erik

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Michael Glaesemann 2004-11-19 09:20:21 Re: get sequence value of insert command
Previous Message Thomas F.O'Connell 2004-11-19 06:07:55 Re: Comparing Dates