Doc: be more precise about conflicts between relation names.

Use verbiage like "The name of the table must be distinct from the name
of any other relation (table, sequence, index, view, materialized view,
or foreign table) in the same schema." in the reference pages for all
those object types.  The main change here is to mention materialized
views explicitly; although a couple of these pages failed to say
anything at all about name conflicts.

Per suggestion from Daniel Westermann.

Discussion: https://postgr.es/m/ZR0P278MB0920D0946509233459AF0DEFD2889@ZR0P278MB0920.CHEP278.PROD.OUTLOOK.COM
This commit is contained in:
Tom Lane 2021-11-02 12:12:02 -04:00
parent 65c6cab136
commit af8c580e5c
6 changed files with 16 additions and 10 deletions

View File

@ -69,8 +69,8 @@ CHECK ( <replaceable class="parameter">expression</replaceable> ) [ NO INHERIT ]
myschema.mytable ...</literal>) then the table is created in the specified myschema.mytable ...</literal>) then the table is created in the specified
schema. Otherwise it is created in the current schema. schema. Otherwise it is created in the current schema.
The name of the foreign table must be The name of the foreign table must be
distinct from the name of any other foreign table, table, sequence, index, distinct from the name of any other relation (table, sequence, index, view,
view, or materialized view in the same schema. materialized view, or foreign table) in the same schema.
</para> </para>
<para> <para>

View File

@ -202,7 +202,10 @@ CREATE [ UNIQUE ] INDEX [ CONCURRENTLY ] [ [ IF NOT EXISTS ] <replaceable class=
<para> <para>
The name of the index to be created. No schema name can be included The name of the index to be created. No schema name can be included
here; the index is always created in the same schema as its parent here; the index is always created in the same schema as its parent
table. If the name is omitted, <productname>PostgreSQL</productname> chooses a table. The name of the index must be distinct from the name of any
other relation (table, sequence, index, view, materialized view, or
foreign table) in that schema.
If the name is omitted, <productname>PostgreSQL</productname> chooses a
suitable name based on the parent table's name and the indexed column suitable name based on the parent table's name and the indexed column
name(s). name(s).
</para> </para>

View File

@ -77,7 +77,9 @@ CREATE MATERIALIZED VIEW [ IF NOT EXISTS ] <replaceable>table_name</replaceable>
<listitem> <listitem>
<para> <para>
The name (optionally schema-qualified) of the materialized view to be The name (optionally schema-qualified) of the materialized view to be
created. created. The name must be distinct from the name of any other relation
(table, sequence, index, view, materialized view, or foreign table) in
the same schema.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>

View File

@ -46,8 +46,9 @@ CREATE [ TEMPORARY | TEMP ] SEQUENCE [ IF NOT EXISTS ] <replaceable class="param
specified schema. Otherwise it is created in the current schema. specified schema. Otherwise it is created in the current schema.
Temporary sequences exist in a special schema, so a schema name cannot be Temporary sequences exist in a special schema, so a schema name cannot be
given when creating a temporary sequence. given when creating a temporary sequence.
The sequence name must be distinct from the name of any other sequence, The sequence name must be distinct from the name of any other relation
table, index, view, or foreign table in the same schema. (table, sequence, index, view, materialized view, or foreign table) in
the same schema.
</para> </para>
<para> <para>

View File

@ -124,8 +124,8 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
schema. Otherwise it is created in the current schema. Temporary schema. Otherwise it is created in the current schema. Temporary
tables exist in a special schema, so a schema name cannot be given tables exist in a special schema, so a schema name cannot be given
when creating a temporary table. The name of the table must be when creating a temporary table. The name of the table must be
distinct from the name of any other table, sequence, index, view, distinct from the name of any other relation (table, sequence, index, view,
or foreign table in the same schema. materialized view, or foreign table) in the same schema.
</para> </para>
<para> <para>

View File

@ -52,8 +52,8 @@ CREATE [ OR REPLACE ] [ TEMP | TEMPORARY ] [ RECURSIVE ] VIEW <replaceable class
schema. Otherwise it is created in the current schema. Temporary schema. Otherwise it is created in the current schema. Temporary
views exist in a special schema, so a schema name cannot be given views exist in a special schema, so a schema name cannot be given
when creating a temporary view. The name of the view must be when creating a temporary view. The name of the view must be
distinct from the name of any other view, table, sequence, index or foreign table distinct from the name of any other relation (table, sequence, index, view,
in the same schema. materialized view, or foreign table) in the same schema.
</para> </para>
</refsect1> </refsect1>