Re: prepare, execute & oids - Mailing list pgsql-general

From Martijn van Oosterhout
Subject Re: prepare, execute & oids
Date
Msg-id 20060802073850.GB29699@svana.org
Whole thread Raw
In response to Re: prepare, execute & oids  (phazon <phazon.ml@gmail.com>)
List 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@svana.org>   http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

Attachment

pgsql-general by date:

Previous
From: "Christian Rengstl"
Date:
Subject: Re: Strange error message
Next
From: "A. Kretschmer"
Date:
Subject: Re: Strange error message