pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Erik Thiele <erik@thiele-hydraulik.de>
To: pgsql-sql@postgresql.org
Subject: get sequence value of insert command
Date: Fri, 19 Nov 2004 09:41:34 +0100
Message-ID: <20041119094134.2437d867.erik@thiele-hydraulik.de> (raw)

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



view thread (8+ messages)  latest in thread

Message-ID: <20041119094134.2437d867.erik@thiele-hydraulik.de>
Permalink:  ../20041119094134.2437d867.erik@thiele-hydraulik.de/
Also on:    postgresql.org/message-id/20041119094134.2437d867.erik@thiele-hydraulik.de

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: erik@thiele-hydraulik.de
  Subject: Re: get sequence value of insert command
  In-Reply-To: <20041119094134.2437d867.erik@thiele-hydraulik.de>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox