From: | Oliver Vecernik <vecernik(at)aon(dot)at> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | "pgsql-admin(at)postgresql(dot)org" <pgsql-admin(at)postgresql(dot)org> |
Subject: | Re: general question on OIDs |
Date: | 2001-05-06 15:51:56 |
Message-ID: | 3AF5731C.4C5E087F@aon.at |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-admin |
Tom Lane wrote:
>
> Oliver Vecernik <vecernik(at)aon(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Einar Karttunen | 2001-05-07 09:04:11 | Re: Primary Keys |
Previous Message | Tom Lane | 2001-05-06 04:36:02 | Re: general question on OIDs |