Re: [NOVICE] OID Question

Поиск
Список
Период
Сортировка
От Martijn van Oosterhout
Тема Re: [NOVICE] OID Question
Дата
Msg-id 20041111204256.GA21986@svana.org
обсуждение исходный текст
Ответ на Re: [NOVICE] OID Question  (Geoffrey <esoteric@3times25.net>)
Список pgsql-general
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@svana.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.

Вложения

В списке pgsql-general по дате отправления:

Предыдущее
От: Geoffrey
Дата:
Сообщение: Re: [NOVICE] OID Question
Следующее
От: jao@geophile.com
Дата:
Сообщение: Re: When to switch to Postgres 8.0?