dbTalk Databases Forums  

Re: [NOVICE] OID Question

comp.databases.postgresql.general comp.databases.postgresql.general


Discuss Re: [NOVICE] OID Question in the comp.databases.postgresql.general forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Martijn van Oosterhout
 
Posts: n/a

Default Re: [NOVICE] OID Question - 11-11-2004 , 02:42 PM






On Thu, Nov 11, 2004 at 03:34:14PM -0500, Geoffrey wrote:
Quote:
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/
Quote:
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.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQFBk87PY5Twig3Ge+YRAgQtAKCa5hHDORzqeKhMaIVrnU goUBZj/gCg0LTf
rWA//MgjAicBljxd5DBfqp0=
=6OjK
-----END PGP SIGNATURE-----



Reply With Quote
  #2  
Old   
Frank Bax
 
Posts: n/a

Default Re: [NOVICE] OID Question - 11-11-2004 , 04:00 PM






At 03:34 PM 11/11/04, Geoffrey wrote:

Quote:
Bruno Wolff III wrote:
On Thu, Nov 11, 2004 at 10:04:30 -0500, Terry Lee Tucker
terry (AT) esc1 (DOT) com> wrote:

Greetings,
Here is a simple question:
Is it ok to put a unique index on the oid for my tables? We are in
the process

Yes, but you may occasionally have insert failures if the oid wraps
around and you try to reuse one on an insert.

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?

Wrong. Wrap around by itself is not the problem here. When wrap around
occurs, it will be possible to have two rows with the same oid. The
"unique contraint" will prevent duplicate oid's in the table.

Frank


---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.