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

Sequences, defaults and getting a new key

From: Jeff Willden <jeff(at)pavanell(dot)com>
To: PostgreSQL List - Novice <pgsql-novice(at)postgresql(dot)org>
Subject: Sequences, defaults and getting a new key
Date: 2008-02-22 04:28:13
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-novice
When the primary key of a table defaults to the nextval() of a  
sequence, if you insert a new record into the table and accept the  
default, how do you then select the value that was just used as the  
new primary key and guarantee that you don't accidentally get the  
value that another user just generated at about the same instant?


Jeff Willden


pgsql-novice by date

Next:From: Tom LaneDate: 2008-02-22 05:16:44
Subject: Re: Sequences, defaults and getting a new key
Previous:From: Greg CocksDate: 2008-02-20 17:37:42
Subject: Re: Wondering how to get the name of the name of the user logged on to 'my' https:// site via PHP

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