public inbox for [email protected]  
help / color / mirror / Atom feed
From: Bruce Momjian <[email protected]>
To: Robert Haas <[email protected]>
Cc: Grzegorz Szpetkowski <[email protected]>
Cc: [email protected]
Subject: Re: 5.3.5. Foreign Keys (The SQL Language) possible enhance
Date: Wed, 12 Oct 2011 16:59:04 -0400 (EDT)
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>

Robert Haas wrote:
> On Fri, May 6, 2011 at 9:50 PM, Grzegorz Szpetkowski
> <[email protected]> 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.

Done with the attached patch.

-- 
  Bruce Momjian  <[email protected]>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

  + It's impossible for everything to be true. +


Attachments:

  [text/x-diff] /rtmp/null (660B, 2-%2Frtmp%2Fnull)
  download | inline diff:
diff --git a/doc/src/sgml/ddl.sgml b/doc/src/sgml/ddl.sgml
new file mode 100644
index c624fc2..ea840fb
*** a/doc/src/sgml/ddl.sgml
--- b/doc/src/sgml/ddl.sgml
*************** CREATE TABLE orders (
*** 688,694 ****
      quantity integer
  );
  </programlisting>
!     Now it is impossible to create orders with
      <structfield>product_no</structfield> entries that do not appear in the
      products table.
     </para>
--- 688,694 ----
      quantity integer
  );
  </programlisting>
!     Now it is impossible to create orders with non-NULL
      <structfield>product_no</structfield> entries that do not appear in the
      products table.
     </para>


view thread (5+ messages)

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: 5.3.5. Foreign Keys (The SQL Language) possible enhance
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox