Re: Use of OIDS as primary keys

Поиск
Список
Период
Сортировка
Искать
От
Oliver Elphick
Тема
Re: Use of OIDS as primary keys
Дата
в 12:07:16
Msg-id
1021303476.1521.52.camel@linda
Ответ на
Список
Дерево обсуждения
Re: Use of OIDS as primary keys Bill Moran <wmoran@potentialtech.com>
Re: Use of OIDS as primary keys Tom Lane <tgl@sss.pgh.pa.us>
tool for comparing databases (?) Michael Adler <adler@glimpser.org>
On Sun, 2002-05-12 at 06:56, Alan Wayne wrote:
> Hi!
> 
> I'm wondering how I can use the system generated OIDS
> as primary keys. Does postgre automatically fill in

Don't do it!

Oids are not saved in a dump unless you specifically ask for them;
you'll be in a right mess if you forget and then need to restore from
the dump.  Then, oids aren't guaranteed to be unique.  In any case, your
database design should not depend on an internal feature of the database
implementation.

If there is no primary key in the data, create one by including a SERIAL
field (an integer with an associated next number generator) and use that
as the key.

-- 
Oliver Elphick                                Oliver.Elphick@lfix.co.uk
Isle of Wight                              http://www.lfix.co.uk/oliver
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839  932A 614D 4C34 3E1D 0C1C

     "Watch ye and pray, lest ye enter into temptation. The 
      spirit truly is ready, but the flesh is weak."      
                           Mark 14:38 
В списке pgsql-general по дате отправления
От: Joe Conway
Дата:
От: murphy pope
Дата:
FAQ