Re: [GENERAL] Questions regarding OID

From: Karl DeBisschop <kdebisschop(at)spaceheater(dot)infoplease(dot)com>
To: richip(at)copycat(dot)mozcom(dot)com
Cc: richip(at)mozcom(dot)com, pgsql-general(at)postgreSQL(dot)org
Subject: Re: [GENERAL] Questions regarding OID
Date: 1999-06-26 12:45:14
Message-ID: 199906261245.IAA22278@skillet.infoplease.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)spaceheater(dot)infoplease(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Adam Haberlach 1999-06-26 18:03:20 Re: [GENERAL] What does this mean ?
Previous Message Hans Peter Würmli 1999-06-26 06:19:55 Re: [GENERAL] decimal(9.2)