Re: Use of OIDS as primary keys

Поиск
Список
Период
Сортировка
От Patrick Welche
Тема Re: Use of OIDS as primary keys
Дата
Msg-id 20020512114404.F9305@quartz.newn.cam.ac.uk
обсуждение исходный текст
Ответ на Use of OIDS as primary keys  (Alan Wayne <alanjwayne@yahoo.com>)
Список pgsql-general
On Sat, May 11, 2002 at 11:23:05PM -0700, Alan Wayne wrote:
> Hi!
>
> I'm wondering how I can use the system generated OIDS
> as primary keys. Does postgre automatically fill in
> the system generated oid when a field of type oid is
> created as the primary key? And if so, how do I read
> it back on a record just created so I can use it as a
> secondary key in another table? And lastly, is it even
> a good idea to use the oid as keys at all when I'm
> going to eventually migrate the data from one machine
> to another?

I believe that every row in a table already has a field "oid". You can see
this if you select oid,* from yourtable; If you create another column of
type oid in your table, it's up to you to fill it in (but no need to bother,
column "oid" is already there). I wouldn't use oids as primary keys, but
rather create a column of type "serial".

Cheers,

Patrick

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

Предыдущее
От: Peter Dimov
Дата:
Сообщение: Trigger performance
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Serious environment problem with 7.2 on Solaris