From 9e9b9ac7d1860fbb98eb4db17a94ff25524b6447 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Fri, 22 Apr 2011 17:43:18 -0400 Subject: 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(). --- doc/src/sgml/catalogs.sgml | 8 ++++---- doc/src/sgml/indices.sgml | 27 ++++++++++++--------------- doc/src/sgml/ref/create_collation.sgml | 7 ++++--- doc/src/sgml/ref/create_domain.sgml | 2 +- doc/src/sgml/ref/create_index.sgml | 12 +++++++++--- doc/src/sgml/ref/create_type.sgml | 4 ++-- doc/src/sgml/regress.sgml | 6 +++--- 7 files changed, 35 insertions(+), 31 deletions(-) (limited to 'doc/src') 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 @@ (collname, collnamespace). PostgreSQL generally ignores all collations that do not have collencoding equal to - either the current database's encoding or -1, and creation of new - entries matching an entry with collencoding = -1 + either the current database's encoding or -1, and creation of new entries + with the same name as an entry with collencoding = -1 is forbidden. Therefore it is sufficient to use a qualified SQL name (schema.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 DEFAULT_COLLATION_OID 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. 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, - Collations and Indexes + Indexes and Collations - 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. @@ -1022,23 +1021,21 @@ CREATE TABLE test1c ( CREATE INDEX test1c_content_index ON test1c (content); - 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 -SELECT * FROM test1c WHERE content = constant; +SELECT * FROM test1c WHERE content > constant; - could use the index. - - - - 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, SELECT * FROM test1c WHERE content > constant COLLATE "y"; - is of interest, an additional index could be created that supports - the "y" collation, like so: + are also of interest, an additional index could be created that supports + the "y" collation, like this: -CREATE INDEX test1c_content_index ON test1c (content COLLATE "y"); +CREATE INDEX test1c_content_y_index ON test1c (content COLLATE "y"); 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 name FROM existing_coll 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. @@ -134,7 +134,8 @@ CREATE COLLATION name FROM existing_coll Examples - To create a collation from the locale fr_FR.utf8 + To create a collation from the operating system locale + fr_FR.utf8 (assuming the current database encoding is UTF8): 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 name [ AS ] 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 COLLATE + The underlying type must be collatable if COLLATE is specified. 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 ] [ name @@ -537,6 +536,13 @@ CREATE INDEX ON films ((lower(title))); will choose a name, typically films_lower_idx.) + + To create an index with non-default collation: + +CREATE INDEX title_idx_german ON films (title COLLATE "de_DE"); + + + To create an index with non-default sort ordering of nulls: 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 name - If the optional + If the optional boolean parameter collatable is true, column definitions and expressions of the type may carry - collation information and allow the use of + collation information through use of the COLLATE 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 - Extra tests + Extra Tests The regression test suite contains a few test files that are not @@ -253,8 +253,8 @@ gmake check EXTRA_TESTS=numeric_big gmake check EXTRA_TESTS=collate.linux.utf8 LANG=en_US.utf8 - This test works only on Linux/glibc platforms and when run in a - UTF-8 locale. + The collate.linux.utf8 test works only on Linux/glibc + platforms, and only when run in a locale that uses UTF-8 encoding. -- cgit v1.2.3