Re: [NOVICE] OID Question

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Geoffrey <esoteric(at)3times25(dot)net>
Cc: pgsql-general(at)postgresql(dot)org, pgsql-novice(at)postgresql(dot)org
Subject: Re: [NOVICE] OID Question
Date: 2004-11-11 20:42:57
Message-ID: 20041111204256.GA21986@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-novice

On Thu, Nov 11, 2004 at 03:34:14PM -0500, Geoffrey wrote:
> So this prompts a question regarding the documentation. I'm assuming
> that I can address the wrap-around issue based on the following found
> under "Notes" section of the "Create Table" document:
>
> "Whenever an application makes use of OIDs to identify specific rows of
> a table, it is recommended to create a unique constraint on the oid
> column of that table, to ensure that OIDs in the table will indeed
> uniquely identify rows even after counter wraparound."
>
> Am I reading this correctly? If I place a unique constraint on the oid
> column, I will not have to worry about oid wrap around?

Nope, it means that OIDs are not inherintly unique and you need to make
an index to force them to be unique. The OID counter will still
wraparound but now if the OID is reused your INSERT will just fail
instead of inserting a duplicate.

Seriously, use a SERIAL, OIDs are nowhere near as interesting as people
keep suggesting...
--
Martijn van Oosterhout <kleptog(at)svana(dot)org> http://svana.org/kleptog/
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Bruno Wolff III 2004-11-11 21:01:46 Re: [NOVICE] OID Question
Previous Message jao 2004-11-11 20:42:54 Re: When to switch to Postgres 8.0?

Browse pgsql-novice by date

  From Date Subject
Next Message Bruno Wolff III 2004-11-11 21:01:46 Re: [NOVICE] OID Question
Previous Message Geoffrey 2004-11-11 20:34:14 Re: [NOVICE] OID Question