Received: from email01.aon.at (WARSL401PIP1.highway.telekom.at [195.3.96.69]) by postgresql.org (8.11.3/8.11.1) with SMTP id f46FwFA48346 for ; Sun, 6 May 2001 11:58:15 -0400 (EDT) (envelope-from vecernik@aon.at) Received: (qmail 307352 invoked from network); 6 May 2001 15:58:04 -0000 Received: from m221p022.dipool.highway.telekom.at (HELO aon.at) ([62.46.17.150]) (envelope-sender ) by qmail1.highway.telekom.at (qmail-ldap-1.03) with SMTP for ; 6 May 2001 15:58:04 -0000 Message-ID: <3AF5731C.4C5E087F@aon.at> Date: Sun, 06 May 2001 17:51:56 +0200 From: Oliver Vecernik Organization: VECERNIK Datenerfassungssysteme X-Mailer: Mozilla 4.76 [de] (X11; U; Linux 2.4.0-4GB i686) X-Accept-Language: de-AT, en MIME-Version: 1.0 To: Tom Lane CC: "pgsql-admin@postgresql.org" Subject: Re: general question on OIDs References: <3AF436A6.8BFAC3FD@aon.at> <26978.989123762@sss.pgh.pa.us> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Archive-Number: 200105/28 X-Sequence-Number: 1368 Tom Lane wrote: > > Oliver Vecernik 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