Received: from candle.pha.pa.us (216-55-132-35.dsl.san-diego.abac.net [216.55.132.35]) by postgresql.org (Postfix) with ESMTP id 67ADA4793F2 for ; Mon, 15 Apr 2002 16:39:49 -0400 (EDT) Received: (from pgman@localhost) by candle.pha.pa.us (8.11.6/8.10.1) id g3FKdhL21970; Mon, 15 Apr 2002 16:39:43 -0400 (EDT) From: Bruce Momjian Message-Id: <200204152039.g3FKdhL21970@candle.pha.pa.us> Subject: Re: oid and oidvector In-Reply-To: <26386.1018903017@sss.pgh.pa.us> To: Tom Lane Date: Mon, 15 Apr 2002 16:39:42 -0400 (EDT) Cc: Camila Rocha , pgsql-sql@postgresql.org X-Mailer: ELM [version 2.4ME+ PL97 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Archive-Number: 200204/196 X-Sequence-Number: 7460 Tom Lane wrote: > Bruce Momjian writes: > > No, you can't use oid as a foreign key. You must use a PRIMARY column. > > Oh? > > regression=# create table foo(f1 int); > CREATE > regression=# create unique index fooi on foo(oid); > CREATE > regression=# create table bar (ref oid references foo(oid)); > NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s) > CREATE > regression=# > > I agree with the advice *not* to do this, but that doesn't mean it can't > be done. Oh, oh, TODO has: * Allow oid to act as a foreign key So I should mark the item as completed? -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 853-3000 + If your life is a hard drive, | 830 Blythe Avenue + Christ can be your backup. | Drexel Hill, Pennsylvania 19026