| From: | Herouth Maoz <herouth(at)oumail(dot)openu(dot)ac(dot)il> |
|---|---|
| To: | marc rassbach <marc(at)tandem(dot)milestonerdl(dot)com>, pgsql-sql(at)postgreSQL(dot)org |
| Subject: | Re: [INTERFACES] How can I work thru this key problem? |
| Date: | 1999-07-27 14:36:09 |
| Message-ID: | l03130303b3c373b6cb10@[147.233.159.109] |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-interfaces pgsql-sql |
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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Ansley, Michael | 1999-07-27 15:34:11 | RE: [INTERFACES] Late mail |
| Previous Message | Tom Lane | 1999-07-27 14:28:33 | Re: [INTERFACES] SOMAXCONN, MaxBackendID and Postgres |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Drew Whittle | 1999-07-27 23:51:48 | WHERE parent IN (0,-1) |
| Previous Message | Don Yury | 1999-07-27 10:24:25 | outer joins |