pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Herouth Maoz <herouth@oumail.openu.ac.il>
To: marc rassbach <marc@tandem.milestonerdl.com>
To: pgsql-sql@postgreSQL.org
Subject: Re: [INTERFACES] How can I work thru this key problem?
Date: Tue, 27 Jul 1999 17:36:09 +0300
Message-ID: <l03130303b3c373b6cb10@[147.233.159.109]> (raw)
In-Reply-To: <Pine.BSF.4.05.9907261248380.86691-100000@tandem.milestonerdl.com>

At 20:50 +0300 on 26/07/1999, marc rassbach wrote:


>
> When I place, oh say the string "Whatsmyid" into exampletable, I'd like to
> be able to know the value of keyiwant is, without going back and doing a
> select keyiwant from exampletable where otherinfo = "Whatsmyid"
>
> Ideas on how I can get to where I want to go?

Yes, after the INSERT, do:

SELECT currval('thenextkey');

This gives you the latest value of the sequence which your current session
has produced. Yes, it is multiuser-safe - no other process will receive the
number you produced except you.

BTW, this shouldn't be in the interfaces list. It's an SQL question.

Herouth

--
Herouth Maoz, Internet developer.
Open University of Israel - Telem project
http://telem.openu.ac.il/~herutma





view thread (3+ messages)

Message-ID: <l03130303b3c373b6cb10@[147.233.159.109]>
Permalink:  ../l03130303b3c373b6cb10@%5B147.233.159.109%5D/
Also on:    postgresql.org/message-id/l03130303b3c373b6cb10@[147.233.159.109]

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: herouth@oumail.openu.ac.il, marc@tandem.milestonerdl.com
  Subject: Re: [INTERFACES] How can I work thru this key problem?
  In-Reply-To: <l03130303b3c373b6cb10@[147.233.159.109]>
  References: <Pine.BSF.4.05.9907261248380.86691-100000@tandem.milestonerdl.com> <l03130303b3c373b6cb10@[147.233.159.109]>

* 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