Re: Using oids

Поиск
Список
Период
Сортировка
От Alvaro Herrera Munoz
Тема Re: Using oids
Дата
Msg-id 20030903150341.GD2452@dcc.uchile.cl
обсуждение исходный текст
Ответ на Re: Using oids  (Malcolm Warren <malcolm@villeinitalia.com>)
Список pgsql-general
On Wed, Sep 03, 2003 at 01:05:30PM +0200, Malcolm Warren wrote:

> I agree with you about database design and in fact fortunately I don't use
> oids as foreign keys, which I thought unwise.  However I have found oids very
> useful as temporary unique references to a record in my programming.  If I
> had known when I started writing my code three years ago that there was even
> the slightest doubt about continuing with oids then I wouldn't have used
> them.

You can create tables WITH OIDS (this is by default on 7.3, but will
probably changed in some future release).  If you also create an unique
index on the oid column of the table, you have all you need.  But beware
that some INSERTs will fail because the OID counter will wrap around at some
point.  There is a non-zero probability that the newly generated OID will
collide with an existing tuple in that table; you have to be prepared to
repeat your query in that case, which can be a pain if you are doing
something else in the same transaction.

--
Alvaro Herrera (<alvherre[@]dcc.uchile.cl>)
"Lo esencial es invisible para los ojos" (A. de Saint Ex�pery)

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

Предыдущее
От: Jeff Eckermann
Дата:
Сообщение: Re: Oracle decode Function in Postgres
Следующее
От: Vivek Khera
Дата:
Сообщение: Re: Commercial postgresql