Re: [GENERAL] Questions regarding OID - Mailing list pgsql-general

From Karl DeBisschop
Subject Re: [GENERAL] Questions regarding OID
Date
Msg-id 199906261245.IAA22278@skillet.infoplease.com
Whole thread Raw
In response to Re: [GENERAL] Questions regarding OID  (Richi Plana <richip@copycat.mozcom.com>)
List pgsql-general
<not repeating alot of stuff>

Each record has an oid, which is assured to be unique in that
database.  Thus you can use it for your purpose, I believe.  To fine
the oid with any record, just:

SELECT oid,* from mytable;

The OID is always there, and you don't have to add it - you just don't
see it uless you specifically ask for it.

The if you are creating another table that links to the OIDs of
mytable, say as

CREATE TABLE anothertable (firstcol int4, pointer_to_mytable oid,
thirdcol text);

Then you can use the oids you selected above.  As I mentioned before,
see perldoc DBI::Pg for perl interface to the last inserted oid, and
the PHP manual for PHP's equivalent.  C lib and other interfaces can
also do this - I just don't know exactly wher ethat documentation is.

The OID will never change.  With one caveat.  If you dump/restore a
database, you must use -o on pg_dump to preserve OIDs

Hope this clarifies.

--
Karl DeBisschop <kdebisschop@spaceheater.infoplease.com>
617.832.0332 (Fax: 617.956.2696)

Information Please - your source for FREE online reference
http://www.infoplease.com  - Your Ultimate Fact Finder
http://kids.infoplease.com - The Great Homework Helper

pgsql-general by date:

Previous
From: Hans Peter Würmli
Date:
Subject: Re: [GENERAL] decimal(9.2)
Next
From: Adam Haberlach
Date:
Subject: Re: [GENERAL] What does this mean ?