Re: OID

Поиск
Список
Период
Сортировка
От Martijn van Oosterhout
Тема Re: OID
Дата
Msg-id 20041115103500.GB7216@svana.org
обсуждение исходный текст
Ответ на OID  (Jamie Deppeler <jamie@doitonce.net.au>)
Список pgsql-general
Firstly, please don't send email in only HTML, it tends to get them
marked as spam.

> SPAM: Hit! (3.2 points)  HTML-only mail, with no text version

Anyway, as to your question:

> Im planning on using OID for referencing in certain part of the
> system i am building as in this case using normal pk -> fk would
> be inefficient as i have to have once table reference multi tables,
> but i have concerns that if a Database is exported and reconstructed
> the OID's will change making referencing impossible.<br>

There is no use of OIDs that cannot be better served by sequences. I
presume the issue is that in your multiple tables you may have the same
PK appear. Well, there is no reason why a sequence should be tied to a
single table. For example:

CREATE SEQUENCE my_global_counter;

CREATE table_1 ( id int4 default nextval('my_global_counter') primary key, ...
CREATE table_2 ( id int4 default nextval('my_global_counter') primary key, ...
CREATE table_3 ( id int4 default nextval('my_global_counter') primary key, ...

Is this what you're looking for?
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.

Вложения

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

Предыдущее
От: "Stefano Bonnin"
Дата:
Сообщение: Question about indexes
Следующее
От: Dawid Kuroczko
Дата:
Сообщение: Re: Question about indexes