Re: [GENERAL] Questions regarding OID

Поиск
Список
Период
Сортировка
Искать
От
Karl DeBisschop
Тема
Re: [GENERAL] Questions regarding OID
Дата
Msg-id
199906261245.IAA22278@skillet.infoplease.com
Ответ на
Список
Дерево обсуждения
Questions regarding OID Richi Plana <richip@mozcom.com>
Re: [GENERAL] Questions regarding OID Karl DeBisschop <kdebisschop@spaceheater.infoplease.com>
Re: [GENERAL] Questions regarding OID Richi Plana <richip@copycat.mozcom.com>
Re: [GENERAL] Questions regarding OID Karl DeBisschop <kdebisschop@spaceheater.infoplease.com>



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 
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 по дате отправления
От: Hans Peter Würmli
Дата:
Сообщение: Re: [GENERAL] decimal(9.2)
От: Adam Haberlach
Дата:
FAQ