Re: OID

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Jamie Deppeler <jamie(at)doitonce(dot)net(dot)au>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: OID
Date: 2004-11-15 10:35:21
Message-ID: 20041115103500.GB7216@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 -&gt; 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(at)svana(dot)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.

In response to

  • OID at 2004-11-15 06:59:02 from Jamie Deppeler

Browse pgsql-general by date

  From Date Subject
Next Message Stefano Bonnin 2004-11-15 10:38:29 Question about indexes
Previous Message Richard Huxton 2004-11-15 09:37:03 Re: suggestion for "psql"