| From: | Martijn van Oosterhout <kleptog(at)svana(dot)org> |
|---|---|
| To: | phazon <phazon(dot)ml(at)gmail(dot)com> |
| Cc: | pgsql-general(at)postgresql(dot)org |
| Subject: | Re: prepare, execute & oids |
| Date: | 2006-08-02 07:38:50 |
| Message-ID: | 20060802073850.GB29699@svana.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
On Wed, Aug 02, 2006 at 09:25:43AM +0200, phazon wrote:
> When I make juste a simple insert like
>
> Insert Into my_table (my_field) values ('value')
>
> I get back the OID of the inserted line.
You really don't want to use OID, you want a sequence. (Hint: OIDs are
not really unique, not a primary key).
> I can't use the curval of a sequence because it can be the value of another
> insert made by another user.
currval() is the last value in *your current session*. It won't be
affected by other users.
Have a nice day,
--
Martijn van Oosterhout <kleptog(at)svana(dot)org> http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.
| From | Date | Subject | |
|---|---|---|---|
| Next Message | A. Kretschmer | 2006-08-02 07:40:26 | Re: Strange error message |
| Previous Message | Christian Rengstl | 2006-08-02 07:34:25 | Re: Strange error message |