diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2011-04-22 17:43:18 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2011-04-22 17:43:18 -0400 |
commit | 9e9b9ac7d1860fbb98eb4db17a94ff25524b6447 (patch) | |
tree | b8505f0c0aa817e1611f43d130248fa7bbb2103c /doc/src | |
parent | 0cfdc1c657b7c2aa1e4524f495e84005f750ec02 (diff) | |
download | postgresql-9e9b9ac7d1860fbb98eb4db17a94ff25524b6447.tar.gz postgresql-9e9b9ac7d1860fbb98eb4db17a94ff25524b6447.zip |
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().
Diffstat (limited to 'doc/src')
-rw-r--r-- | doc/src/sgml/catalogs.sgml | 8 | ||||
-rw-r--r-- | doc/src/sgml/indices.sgml | 27 | ||||
-rw-r--r-- | doc/src/sgml/ref/create_collation.sgml | 7 | ||||
-rw-r--r-- | doc/src/sgml/ref/create_domain.sgml | 2 | ||||
-rw-r--r-- | doc/src/sgml/ref/create_index.sgml | 12 | ||||
-rw-r--r-- | doc/src/sgml/ref/create_type.sgml | 4 | ||||
-rw-r--r-- | doc/src/sgml/regress.sgml | 6 |
7 files changed, 35 insertions, 31 deletions
diff --git a/doc/src/sgml/catalogs.sgml b/doc/src/sgml/catalogs.sgml index d0a8dc72cb6..7b62818ce4b 100644 --- a/doc/src/sgml/catalogs.sgml +++ b/doc/src/sgml/catalogs.sgml @@ -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> diff --git a/doc/src/sgml/indices.sgml b/doc/src/sgml/indices.sgml index 15fbe0d614e..2dedb153c06 100644 --- a/doc/src/sgml/indices.sgml +++ b/doc/src/sgml/indices.sgml @@ -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 > <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 > <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> diff --git a/doc/src/sgml/ref/create_collation.sgml b/doc/src/sgml/ref/create_collation.sgml index fc792250011..c8535768143 100644 --- a/doc/src/sgml/ref/create_collation.sgml +++ b/doc/src/sgml/ref/create_collation.sgml @@ -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'); diff --git a/doc/src/sgml/ref/create_domain.sgml b/doc/src/sgml/ref/create_domain.sgml index 2300edefe3a..8db90f911f6 100644 --- a/doc/src/sgml/ref/create_domain.sgml +++ b/doc/src/sgml/ref/create_domain.sgml @@ -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> diff --git a/doc/src/sgml/ref/create_index.sgml b/doc/src/sgml/ref/create_index.sgml index 8ec7abbbd49..43b6499603c 100644 --- a/doc/src/sgml/ref/create_index.sgml +++ b/doc/src/sgml/ref/create_index.sgml @@ -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> @@ -538,6 +537,13 @@ CREATE INDEX ON films ((lower(title))); </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> CREATE INDEX title_idx_nulls_low ON films (title NULLS FIRST); diff --git a/doc/src/sgml/ref/create_type.sgml b/doc/src/sgml/ref/create_type.sgml index 98e1764b1e9..70b0325f0ec 100644 --- a/doc/src/sgml/ref/create_type.sgml +++ b/doc/src/sgml/ref/create_type.sgml @@ -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 diff --git a/doc/src/sgml/regress.sgml b/doc/src/sgml/regress.sgml index 874d45615e2..bb5f577852c 100644 --- a/doc/src/sgml/regress.sgml +++ b/doc/src/sgml/regress.sgml @@ -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> |