Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id EEEA3634F7D for ; Tue, 23 Jun 2009 15:44:31 -0300 (ADT) 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 67968-07 for ; Tue, 23 Jun 2009 15:44:21 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-px0-f198.google.com (mail-px0-f198.google.com [209.85.216.198]) by mail.postgresql.org (Postfix) with ESMTP id 94BDB634FA6 for ; Tue, 23 Jun 2009 15:44:24 -0300 (ADT) Received: by pxi36 with SMTP id 36so162976pxi.15 for ; Tue, 23 Jun 2009 11:44:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:cc:subject :message-id:references:mime-version:content-type:content-disposition :in-reply-to:user-agent; bh=hUiWNTH72mFVBstI6nS9PnYVWUhXJUktY20CnYjEp5E=; b=MyZhcEU99Gur9myo2K2jP5VnGfgn1Cc8jHILMAjmcfLkG3ZWuPG2sHFJr5O4PyaRB8 7cn9R6kw52HbQrDaQ2x2H4OgE8wLNqphCjSIhqZapFRHK6VMfsRoRHb82T/s8DVtKOev /469YlU+KXQnRCrl8NG1pi/E3wSErD75ezIEs= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; b=nXqmQuzW6ysNthQ9Au8LO+zqW2c4B0qWdhwxS/aYeXu01ONv/ZD/7z+T+TsaVs5flF BZB4KYk4Hhkp3YqxJtCyMyGjEyd7LJ0SBJQ01BWy5YH6ss0fnHtbK4fExlBSuXLjr/Vv aeX7OKxGW8j99lc4Co5AbY/nargU9OGyi4Wzo= Received: by 10.114.151.4 with SMTP id y4mr538431wad.27.1245782663133; Tue, 23 Jun 2009 11:44:23 -0700 (PDT) Received: from eddie (c-67-182-227-82.hsd1.ut.comcast.net [67.182.227.82]) by mx.google.com with ESMTPS id k37sm521410waf.42.2009.06.23.11.44.21 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 23 Jun 2009 11:44:21 -0700 (PDT) Date: Tue, 23 Jun 2009 12:44:12 -0600 From: Joshua Tolley To: Harald Fuchs Cc: pgsql-sql@postgresql.org Subject: Re: Composite primary keys Message-ID: <20090623184412.GG27474@eddie> References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="FwyhczKCDPOVeYh6" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.18 (2008-05-17) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=AWL=0.000 X-Spam-Level: X-Archive-Number: 200906/94 X-Sequence-Number: 32699 --FwyhczKCDPOVeYh6 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Tue, Jun 23, 2009 at 05:14:36PM +0200, Harald Fuchs wrote: > test=# CREATE TABLE t2 ( > test(# id int NOT NULL REFERENCES t1, > test(# language char(3) NULL, > test(# txt text NOT NULL, > test(# PRIMARY KEY (id, language) > test(# ); > CREATE TABLE > test=# INSERT INTO t2 (id, language, txt) VALUES (2, NULL, 'text 1 no language'); > ERROR: null value in column "language" violates not-null constraint Primary keys are NOT NULL and UNIQUE. You can't have null values in a primary key. - Josh / eggyknap --FwyhczKCDPOVeYh6 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iEYEARECAAYFAkpBInwACgkQRiRfCGf1UMOaowCdGbb0RkvZ4up5L8TvfkLpgA5s I7oAnj0v4lMrccmbcg/3tu7iZphM6Z2S =zVAC -----END PGP SIGNATURE----- --FwyhczKCDPOVeYh6--