1
0
mirror of https://github.com/postgres/postgres.git synced 2025-09-02 04:21:28 +03:00

Make a code-cleanup pass over the collations patch.

This patch is almost entirely cosmetic --- mostly cleaning up a lot of
neglected comments, and fixing code layout problems in places where the
patch made lines too long and then pgindent did weird things with that.
I did find a bug-of-omission in equalTupleDescs().
This commit is contained in:
Tom Lane
2011-04-22 17:43:18 -04:00
parent 0cfdc1c657
commit 9e9b9ac7d1
24 changed files with 179 additions and 118 deletions

View File

@@ -2159,8 +2159,8 @@
(<structfield>collname</>, <structfield>collnamespace</>).
<productname>PostgreSQL</productname> generally ignores all
collations that do not have <structfield>collencoding</> equal to
either the current database's encoding or -1, and creation of new
entries matching an entry with <structfield>collencoding</> = -1
either the current database's encoding or -1, and creation of new entries
with the same name as an entry with <structfield>collencoding</> = -1
is forbidden. Therefore it is sufficient to use a qualified SQL name
(<replaceable>schema</>.<replaceable>name</>) to identify a collation,
even though this is not unique according to the catalog definition.
@@ -6138,8 +6138,8 @@
of the type. If the type does not support collations, this will
be zero. A base type that supports collations will have
<symbol>DEFAULT_COLLATION_OID</symbol> here. A domain over a
collatable type can have some other collation OID, if one was defined
for the domain.
collatable type can have some other collation OID, if one was
specified for the domain.
</para></entry>
</row>

View File

@@ -1004,12 +1004,11 @@ SELECT am.amname AS index_method,
<sect1 id="indexes-collations">
<title>Collations and Indexes</title>
<title>Indexes and Collations</title>
<para>
An index can only support one collation for one column or
expression. If multiple collations are of interest, multiple
indexes may be created.
An index can support only one collation per index column.
If multiple collations are of interest, multiple indexes may be needed.
</para>
<para>
@@ -1022,23 +1021,21 @@ CREATE TABLE test1c (
CREATE INDEX test1c_content_index ON test1c (content);
</programlisting>
The created index automatically follows the collation of the
underlying column, and so a query of the form
The index automatically uses the collation of the
underlying column. So a query of the form
<programlisting>
SELECT * FROM test1c WHERE content = <replaceable>constant</replaceable>;
SELECT * FROM test1c WHERE content &gt; <replaceable>constant</replaceable>;
</programlisting>
could use the index.
</para>
<para>
If in addition, a query of the form, say,
could use the index, because the comparison will by default use the
collation of the column. However, this index cannot accelerate queries
that involve some other collation. So if queries of the form, say,
<programlisting>
SELECT * FROM test1c WHERE content &gt; <replaceable>constant</replaceable> COLLATE "y";
</programlisting>
is of interest, an additional index could be created that supports
the <literal>"y"</literal> collation, like so:
are also of interest, an additional index could be created that supports
the <literal>"y"</literal> collation, like this:
<programlisting>
CREATE INDEX test1c_content_index ON test1c (content COLLATE "y");
CREATE INDEX test1c_content_y_index ON test1c (content COLLATE "y");
</programlisting>
</para>
</sect1>

View File

@@ -108,8 +108,8 @@ CREATE COLLATION <replaceable>name</replaceable> FROM <replaceable>existing_coll
<listitem>
<para>
The name of an existing collation to copy. The new collation
will have the same properties as the existing one, but they
will become independent objects.
will have the same properties as the existing one, but it
will be an independent object.
</para>
</listitem>
</varlistentry>
@@ -134,7 +134,8 @@ CREATE COLLATION <replaceable>name</replaceable> FROM <replaceable>existing_coll
<title>Examples</title>
<para>
To create a collation from the locale <literal>fr_FR.utf8</literal>
To create a collation from the operating system locale
<literal>fr_FR.utf8</literal>
(assuming the current database encoding is <literal>UTF8</literal>):
<programlisting>
CREATE COLLATION french (LOCALE = 'fr_FR.utf8');

View File

@@ -90,7 +90,7 @@ CREATE DOMAIN <replaceable class="parameter">name</replaceable> [ AS ] <replacea
<para>
An optional collation for the domain. If no collation is
specified, the underlying data type's default collation is used.
The underlying type must be collatable when <literal>COLLATE</>
The underlying type must be collatable if <literal>COLLATE</>
is specified.
</para>
</listitem>

View File

@@ -188,9 +188,8 @@ CREATE [ UNIQUE ] INDEX [ CONCURRENTLY ] [ <replaceable class="parameter">name</
The name of the collation to use for the index. By default,
the index uses the collation declared for the column to be
indexed or the result collation of the expression to be
indexed. Indexes with nondefault collations are
available for use by queries that involve expressions using
nondefault collations.
indexed. Indexes with non-default collations can be useful for
queries that involve expressions using non-default collations.
</para>
</listitem>
</varlistentry>
@@ -537,6 +536,13 @@ CREATE INDEX ON films ((lower(title)));
will choose a name, typically <literal>films_lower_idx</>.)
</para>
<para>
To create an index with non-default collation:
<programlisting>
CREATE INDEX title_idx_german ON films (title COLLATE "de_DE");
</programlisting>
</para>
<para>
To create an index with non-default sort ordering of nulls:
<programlisting>

View File

@@ -355,10 +355,10 @@ CREATE TYPE <replaceable class="parameter">name</replaceable>
</para>
<para>
If the optional
If the optional boolean
parameter <replaceable class="parameter">collatable</replaceable>
is true, column definitions and expressions of the type may carry
collation information and allow the use of
collation information through use of
the <literal>COLLATE</literal> clause. It is up to the
implementations of the functions operating on the type to actually
make use of the collation information; this does not happen

View File

@@ -238,7 +238,7 @@ gmake check LANG=C ENCODING=EUC_JP
</sect2>
<sect2>
<title>Extra tests</title>
<title>Extra Tests</title>
<para>
The regression test suite contains a few test files that are not
@@ -253,8 +253,8 @@ gmake check EXTRA_TESTS=numeric_big
<screen>
gmake check EXTRA_TESTS=collate.linux.utf8 LANG=en_US.utf8
</screen>
This test works only on Linux/glibc platforms and when run in a
UTF-8 locale.
The <literal>collate.linux.utf8</> test works only on Linux/glibc
platforms, and only when run in a locale that uses UTF-8 encoding.
</para>
</sect2>
</sect1>