pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jeffrey Lyon <lyonj@em-systems.com>
To: marc rassbach <marc@tandem.milestonerdl.com>
Cc: pgsql-interfaces@postgreSQL.org
Subject: Re: [INTERFACES] How can I work thru this key problem?
Date: Mon, 26 Jul 1999 13:39:38 -0400 (EDT)
Message-ID: <Pine.LNX.4.04.9907261336020.18963-100000@helium.em-systems.com> (raw)
In-Reply-To: <Pine.BSF.4.05.9907261248380.86691-100000@tandem.milestonerdl.com>


There's probably a better way, but I do a:

SELECT NEXTVAL('thenextkey') AS n_thenextkey;
INSERT INTO exampletable (keyiwant, otherinfo) VALUES (n_thenextkey,
'somestring');

...and then use n_thenextkey to refer to the newly added tuple.

Jeffrey


On Mon, 26 Jul 1999, marc rassbach wrote:

> I am using
> 6.5 postgresql
> DBD pg 0.91
> DBI 1.08
> 
> I have a table that looks like:
> 
> create table exampletable (
> keyiwant      int4 default nextval('thenextkey') not null,
> otherinfo     varchar(20)
> );
> 
>  
> 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?
> 
> 
> 




view thread (3+ messages)  latest in thread

Message-ID: <Pine.LNX.4.04.9907261336020.18963-100000@helium.em-systems.com>
Permalink:  ../Pine.LNX.4.04.9907261336020.18963-100000@helium.em-systems.com/
Also on:    postgresql.org/message-id/Pine.LNX.4.04.9907261336020.18963-100000@helium.em-systems.com

 · 

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: lyonj@em-systems.com, marc@tandem.milestonerdl.com, pgsql-interfaces@postgreSQL.org
  Subject: Re: [INTERFACES] How can I work thru this key problem?
  In-Reply-To: <Pine.LNX.4.04.9907261336020.18963-100000@helium.em-systems.com>
  References: <Pine.BSF.4.05.9907261248380.86691-100000@tandem.milestonerdl.com> <Pine.LNX.4.04.9907261336020.18963-100000@helium.em-systems.com>

* 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