Skip site navigation (1) Skip section navigation (2)

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: (view raw, whole thread or download thread mbox)
Lists: pgsql-sql

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?



pgsql-sql by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group