Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 704C963265D for ; Wed, 4 Nov 2009 16:26:06 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 32364-09 for ; Wed, 4 Nov 2009 20:25:52 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-iw0-f186.google.com (mail-iw0-f186.google.com [209.85.223.186]) by mail.postgresql.org (Postfix) with ESMTP id 7563163410D for ; Wed, 4 Nov 2009 16:25:55 -0400 (AST) Received: by iwn16 with SMTP id 16so5031075iwn.29 for ; Wed, 04 Nov 2009 12:25:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=qCnv4XO9JTf+sUT2vdMKsU8rB+MwyM54fJIjUVD7dr8=; b=mPT1+c5tNfXz4ZcpjUJyE05fsoCl7rBw5kGcJKQOkSxINnS5pd8Pkz830rDiJHp2i2 tb6hAIx/AFjJCLuwF0Z6WDf+Tv3+OaAPmobQn1Cp+X3BhdRl2D2qq3htT2eiTnf4S8GS CDgJioQrXG/fXHTwCu2TdrfBvp1siOPcNFxwQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=pETL7L/dthG2YXOEXHFRbOrjyJCD6U5pXHOUHoDjxxZ1g6jM7qQC3Hh6yl8gMJy0O2 1wmNxNmI+NKTo4pkhVkGPeKv8Goc8URKxiPm01q4qGeyXaZF9BGj7+v5smHIAGEhVRZJ nSEaLmqX5OcxTzXKFr3rJ5uGx2GTwKtqLbyCY= MIME-Version: 1.0 Received: by 10.231.170.201 with SMTP id e9mr908950ibz.15.1257366354110; Wed, 04 Nov 2009 12:25:54 -0800 (PST) In-Reply-To: <200911042114.32722.leif@solumslekt.org> References: <200911041903.36563.leif@solumslekt.org> <200911041953.11714.leif@solumslekt.org> <200911042114.32722.leif@solumslekt.org> Date: Wed, 4 Nov 2009 13:25:53 -0700 Message-ID: Subject: Re: DDL problems: Referential issue? From: Scott Marlowe To: Leif Biberg Kristensen Cc: pgsql-sql@postgresql.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.507 tagged_above=-10 required=5 tests=AWL=0.092, BAYES_00=-2.599 X-Spam-Level: X-Archive-Number: 200911/18 X-Sequence-Number: 33369 On Wed, Nov 4, 2009 at 1:14 PM, Leif Biberg Kristensen wrote: > On Wednesday 4. November 2009 21.03.26 Scott Marlowe wrote: >> On Wed, Nov 4, 2009 at 11:53 AM, Leif Biberg Kristensen >> > This looks strange to me, but it works: >> > >> > pgslekt=3D> CREATE TABLE participant_notes ( >> > pgslekt(> =A0 =A0 person_fk =A0 INTEGER NOT NULL, >> > pgslekt(> =A0 =A0 event_fk =A0 =A0INTEGER NOT NULL, >> > pgslekt(> =A0 =A0 part_note =A0 TEXT, >> > pgslekt(> =A0 =A0 PRIMARY KEY (person_fk, event_fk), >> > pgslekt(> =A0 =A0 FOREIGN KEY (person_fk, event_fk) REFERENCES partici= pants >> > (person_fk, event_fk) >> > pgslekt(> ); >> > NOTICE: =A0CREATE TABLE / PRIMARY KEY will create implicit index >> > "participant_notes_pkey" for table "participant_notes" >> > CREATE TABLE >> >> Note that this will limit you to one record in your participant notes >> for each record in the participants table. > > That's exactly what I want :) > > For all practical purposes, the design is equivalent to adding a TEXT col= umn > to the participants table. But as I expect a very small number of notes > compared to the number of rows in the participants table, I prefer to cre= ate a > small extra table rather than having a large number of null values in the > participants table. Performance-wise, it probably doesn't matter much. It= 's > more a matter of taste. Exactly. Note that null values i pgsql take up VERY little space, so performance-wise one table is likely faster, but it's not gonna break the bank to have two.