Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 38CD7B5DC4B for ; Sun, 11 Sep 2011 23:09:50 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 15915-01 for ; Mon, 12 Sep 2011 02:09:44 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from momjian.us (momjian.us [70.90.9.53]) by mail.postgresql.org (Postfix) with ESMTP id BA8DAB5DBF2 for ; Sun, 11 Sep 2011 23:09:43 -0300 (ADT) Received: (from bruce@localhost) by momjian.us (8.11.6/8.11.6) id p8C29kF13404; Sun, 11 Sep 2011 22:09:46 -0400 (EDT) From: Bruce Momjian Message-Id: <201109120209.p8C29kF13404@momjian.us> Subject: Re: 5.3.5. Foreign Keys (The SQL Language) possible enhance In-Reply-To: To: Robert Haas Date: Sun, 11 Sep 2011 22:09:46 -0400 (EDT) CC: Grzegorz Szpetkowski , pgsql-docs@postgresql.org X-Mailer: ELM [version 2.4ME+ PL124 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="US-ASCII" X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.404 tagged_above=-5 required=5 tests=BAYES_00=-1.9, RP_MATCHES_RCVD=-0.504 X-Spam-Level: X-Archive-Number: 201109/41 X-Sequence-Number: 6962 Robert Haas wrote: > On Fri, May 6, 2011 at 9:50 PM, Grzegorz Szpetkowski > wrote: > > I have some remark about > > > > "Now it is impossible to create orders with product_no entries that do > > not appear in the products table." > > > > http://www.postgresql.org/docs/9.0/static/ddl-constraints.html#DDL-CONSTRAINTS-FK > [...] > > > > There is still possibility to add product_no (exactly NULL) value, > > which does not appear (cannot because of primary key nature) in > > products table. To get "full solution" you need create orders table as > > > > CREATE TABLE orders ( > > ? ?order_id integer PRIMARY KEY, > > ? ?product_no integer REFERENCES products (product_no) NOT NULL, > > ? ?quantity integer > > ); > > I don't think we should change the example, but we could probably > clarify the wording. Any ideas on how to clarify the wording? -- Bruce Momjian http://momjian.us EnterpriseDB http://enterprisedb.com + It's impossible for everything to be true. +