Thom Brown <t...@linux.com> wrote:
 
> Looks good.  Do we usually got into fine details such as the name
> of the index?  They'll see the index name returned when they
> create the table or add the constraint anyway, and if they missed
> it they only need to do a "\dt tablename" to find out what it was.
 
Hmmm...  Perhaps that is overkill.  It seemed like a good idea at
the time, but I'm not inclined to argue about it if it seems too
detailed to you.  Revised patch attached.
 
-Kevin

*** a/doc/src/sgml/ddl.sgml
--- b/doc/src/sgml/ddl.sgml
***************
*** 550,555 **** CREATE TABLE products (
--- 550,560 ----
     </indexterm>
  
     <para>
+     Adding a unique constraint will automatically create a unique btree
+     index on the column or group of columns declared for the constraint.
+    </para>
+ 
+    <para>
      In general, a unique constraint is violated when there is more than
      one row in the table where the values of all of the
      columns included in the constraint are equal.
***************
*** 623,628 **** CREATE TABLE example (
--- 628,638 ----
     </para>
  
     <para>
+     Adding a primary key will automatically create a unique btree index
+     on the column or group of columns declared for the primary key.
+    </para>
+ 
+    <para>
      A table can have at most one primary key.  (There can be any number
      of unique and not-null constraints, which are functionally the same
      thing, but only one can be identified as the primary key.)
***************
*** 832,837 **** CREATE TABLE order_items (
--- 842,857 ----
     </para>
  
     <para>
+     Since a <command>DELETE</command> of a row from a referenced table
+     or an <command>UPDATE</command> of a referenced column will require
+     a scan of the referencing table for rows matching the old value, it
+     is often a good idea to index the referencing columns.  Because it
+     is not always needed, and there are many choices available on how
+     index, declaration of a foreign key constraint does not
+     automatically create an index.
+    </para>
+ 
+    <para>
      More information about updating and deleting data is in <xref
      linkend="dml">.
     </para>
***************
*** 875,880 **** CREATE TABLE circles (
--- 895,905 ----
      See also <link linkend="SQL-CREATETABLE-EXCLUDE"><command>CREATE
      TABLE ... CONSTRAINT ... EXCLUDE</></link> for details.
     </para>
+ 
+    <para>
+     Adding an exclusion constraint will automatically create an index
+     of the type specified in the constraint declaration.
+    </para>
    </sect2>
   </sect1>
  
-- 
Sent via pgsql-docs mailing list (pgsql-docs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-docs

Reply via email to