doc: Document more that relations share a namespace
authorPeter Eisentraut <peter@eisentraut.org>
Wed, 31 Jan 2024 10:53:56 +0000 (11:53 +0100)
committerPeter Eisentraut <peter@eisentraut.org>
Wed, 31 Jan 2024 11:05:41 +0000 (12:05 +0100)
This was already documented in the CREATE INDEX reference, but not in
the introductory "Data Definition" chapter.  Also, document that the
index that implements a constraint has the same name as the
constraint.

Author: Laurenz Albe <laurenz.albe@cybertec.at>
Reviewed-by: jian he <jian.universality@gmail.com>
Reviewed-by: David G. Johnston <david.g.johnston@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/CACJufxFG682tYcP9aH_F-jrqq5End8MHZR77zcp1%3DDUrEsSu1Q%40mail.gmail.com

doc/src/sgml/ddl.sgml
doc/src/sgml/ref/create_table.sgml

index 0a0ff42e881393766e93553d9911f1fef1c0202d..9d7e2c756be31d5403d96027b2ef73997f806416 100644 (file)
@@ -3003,7 +3003,11 @@ SELECT * FROM information WHERE group_id = 2 FOR UPDATE;
   <para>
    A database contains one or more named <firstterm>schemas</firstterm>, which
    in turn contain tables.  Schemas also contain other kinds of named
-   objects, including data types, functions, and operators.  The same
+   objects, including data types, functions, and operators.  Within one
+   schema, two objects of the same type cannot have the same name.
+   Furthermore, tables, sequences, indexes, views, materialized views, and
+   foreign tables share the same namespace, so that, for example, an index and
+   a table must have different names if they are in the same schema.  The same
    object name can be used in different schemas without conflict; for
    example, both <literal>schema1</literal> and <literal>myschema</literal> can
    contain tables named <literal>mytable</literal>.  Unlike databases,
index d563f02b00ff9908914f6dd5bb623b50cf47d60e..4cbaaccaf7cd80f6416f85884cba2d3f361e2e7d 100644 (file)
@@ -1027,7 +1027,8 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
       Adding a unique constraint will automatically create a unique B-tree
       index on the column or group of columns used in the constraint.  But if
       the constraint includes a <literal>WITHOUT OVERLAPS</literal> clause, it
-      will use a GiST index.
+      will use a GiST index.  The created index has the same name as the unique
+      constraint.
      </para>
 
      <para>
@@ -1082,6 +1083,7 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
       <literal>PRIMARY KEY</literal> constraint will automatically create a
       unique B-tree index, or GiST if <literal>WITHOUT OVERLAPS</literal> was
       specified, on the column or group of columns used in the constraint.
+      That index has the same name as the primary key constraint.
      </para>
 
      <para>
@@ -1118,8 +1120,8 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
 
      <para>
       Exclusion constraints are implemented using
-      an index, so each specified operator must be associated with an
-      appropriate operator class
+      an index that has the same name as the constraint, so each specified
+      operator must be associated with an appropriate operator class
       (see <xref linkend="indexes-opclass"/>) for the index access
       method <replaceable>index_method</replaceable>.
       The operators are required to be commutative.