From: | Douglas Thomson <dougt(at)mugc(dot)cc(dot)monash(dot)edu(dot)au> |
---|---|
To: | gary(dot)stainburn(at)ringways(dot)co(dot)uk (Gary Stainburn) |
Cc: | pgsql-interfaces(at)postgreSQL(dot)org |
Subject: | Re: [INTERFACES] locking on database updates |
Date: | 1999-12-08 04:34:33 |
Message-ID: | 199912080434.PAA31285@mugca.cc.monash.edu.au |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-interfaces |
Gary Stainburn writes:
> I agree that using a type 'serial' will give me what I want
> regarding the key field for my table, and gets round the problem
> of concurrent users trying to create records with the same number.
>
> The problem is that this does not actually give me the number that
> was just created. As there is no guarantee that the other fields in
> the table are unique (hence the serial field in the first place) I cannot
> simply do a select to retrieve it.
>
> Has anyone any ideas?
For what it is worth, I saved the OID returned by the INSERT (see
PQoidStatus - the details depend on what interface language you use),
and then selected the row I had just inserted using:
SELECT id FROM name_map WHERE oid=12345
Doug.
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 1999-12-08 06:40:16 | Re: [INTERFACES] sql question |
Previous Message | Joseph Shraibman | 1999-12-08 02:14:37 | sql question |