pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Oliver Vecernik <vecernik@aon.at>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-admin@postgresql.org <pgsql-admin@postgresql.org>
Subject: Re: general question on OIDs
Date: Sun, 06 May 2001 17:51:56 +0200
Message-ID: <3AF5731C.4C5E087F@aon.at> (raw)
References: <3AF436A6.8BFAC3FD@aon.at>
	<26978.989123762@sss.pgh.pa.us>

Tom Lane wrote:
> 
> Oliver Vecernik <vecernik@aon.at> writes:
> > Using of OIDs as foreign keys is recommended in the docs.
> 
> Er ... where?  It shouldn't be.

Sorry, it was not in the official docs, but in Bruce's book in the
chapter about OIDs:

| Object identification numbers can be used as primary and foreign key 
values in  | joins. Since every row has a unique object ID, a separate
column is not needed to | hold the row's unique number. 
| 
| For example, in Chapter  we used a column called customer.customer_id.
This
| column held the customer number and uniquely identified each row.
Alternatively, | we could have used the row's object identification
number as the unique number
| for each row, eliminating the need to create the | | column
customer.customer_id. | In that case, customer.oid would be the unique
customer number. 

> 
> [...]
>
> This is why it shouldn't be.  Reloading a pg_dump-with-OIDs will
> probably yield a conflict-free database, but it's not certain;
> and it is certain that you'll waste lots of OIDs that way.  Much
> better to use serial columns for foreign keys.
> 
>                         regards, tom lane

Everthing is clear now. I won't use OIDs for foreign keys.

Regards,
Oliver



view thread (3+ messages)

Message-ID: <3AF5731C.4C5E087F@aon.at>
Permalink:  ../3AF5731C.4C5E087F@aon.at/
Also on:    postgresql.org/message-id/3AF5731C.4C5E087F@aon.at

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: vecernik@aon.at, tgl@sss.pgh.pa.us
  Subject: Re: general question on OIDs
  In-Reply-To: <3AF5731C.4C5E087F@aon.at>
  References: <3AF436A6.8BFAC3FD@aon.at> <26978.989123762@sss.pgh.pa.us> <3AF5731C.4C5E087F@aon.at>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox