Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 48D8E63292A for ; Wed, 4 Nov 2009 14:53:24 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 93872-09 for ; Wed, 4 Nov 2009 18:53:16 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail42.e.nsc.no (mail42.e.nsc.no [193.213.115.42]) by mail.postgresql.org (Postfix) with ESMTP id 43E0B63265D for ; Wed, 4 Nov 2009 14:53:14 -0400 (AST) Received: from balapapa.localnet (42.185.16.62.customer.cdi.no [62.16.185.42]) (authenticated bits=0) by mail42.nsc.no (8.14.3/8.14.3) with ESMTP id nA4IrCVX029327 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT) for ; Wed, 4 Nov 2009 19:53:12 +0100 (MET) From: Leif Biberg Kristensen To: pgsql-sql@postgresql.org Subject: Re: DDL problems: Referential issue? Date: Wed, 4 Nov 2009 19:53:11 +0100 User-Agent: KMail/1.12.1 (Linux/2.6.27-gentoo-r10; KDE/4.3.1; i686; ; ) References: <200911041903.36563.leif@solumslekt.org> <200911041936.15292.leif@solumslekt.org> In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <200911041953.11714.leif@solumslekt.org> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.599 tagged_above=-10 required=5 tests=BAYES_00=-2.599 X-Spam-Level: X-Archive-Number: 200911/15 X-Sequence-Number: 33366 On Wednesday 4. November 2009 19.37.41 Scott Marlowe wrote: > On Wed, Nov 4, 2009 at 11:36 AM, Leif Biberg Kristensen > wrote: >> I'd missed that particular syntax. >> >> This table is now without a primary key, but is that a problem? I don't >> expect it to grow beyond maybe a few thousand rows. > > Hard to say, but if you really need a PK, you can always create one later. This looks strange to me, but it works: pgslekt=> CREATE TABLE participant_notes ( pgslekt(> person_fk INTEGER NOT NULL, pgslekt(> event_fk INTEGER NOT NULL, pgslekt(> part_note TEXT, pgslekt(> PRIMARY KEY (person_fk, event_fk), pgslekt(> FOREIGN KEY (person_fk, event_fk) REFERENCES participants (person_fk, event_fk) pgslekt(> ); NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "participant_notes_pkey" for table "participant_notes" CREATE TABLE And is probably what I want. -- Leif Biberg Kristensen http://solumslekt.org