Re: [INTERFACES] How can I work thru this key problem?

From: Jeffrey Lyon <lyonj(at)em-systems(dot)com>
To: marc rassbach <marc(at)tandem(dot)milestonerdl(dot)com>
Cc: pgsql-interfaces(at)postgreSQL(dot)org
Subject: Re: [INTERFACES] How can I work thru this key problem?
Date: 1999-07-26 17:39:38
Message-ID: Pine.LNX.4.04.9907261336020.18963-100000@helium.em-systems.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces pgsql-sql


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?
>
>
>

In response to

Browse pgsql-interfaces by date

  From Date Subject
Next Message marc rassbach 1999-07-26 17:50:22 How can I work thru this key problem?
Previous Message Peter Mount 1999-07-26 17:17:03 Re: TQ again

Browse pgsql-sql by date

  From Date Subject
Next Message marc rassbach 1999-07-26 17:50:22 How can I work thru this key problem?
Previous Message Dan Wilson 1999-07-26 13:52:30 Re: [GENERAL] escaping wildcard chars