1CREATE COLLATION(7) PostgreSQL 9.2.24 Documentation CREATE COLLATION(7)
2
3
4
6 CREATE_COLLATION - define a new collation
7
9 CREATE COLLATION name (
10 [ LOCALE = locale, ]
11 [ LC_COLLATE = lc_collate, ]
12 [ LC_CTYPE = lc_ctype ]
13 )
14 CREATE COLLATION name FROM existing_collation
15
17 CREATE COLLATION defines a new collation using the specified operating
18 system locale settings, or by copying an existing collation.
19
20 To be able to create a collation, you must have CREATE privilege on the
21 destination schema.
22
24 name
25 The name of the collation. The collation name can be
26 schema-qualified. If it is not, the collation is defined in the
27 current schema. The collation name must be unique within that
28 schema. (The system catalogs can contain collations with the same
29 name for other encodings, but these are ignored if the database
30 encoding does not match.)
31
32 locale
33 This is a shortcut for setting LC_COLLATE and LC_CTYPE at once. If
34 you specify this, you cannot specify either of those parameters.
35
36 lc_collate
37 Use the specified operating system locale for the LC_COLLATE locale
38 category. The locale must be applicable to the current database
39 encoding. (See CREATE DATABASE (CREATE_DATABASE(7)) for the precise
40 rules.)
41
42 lc_ctype
43 Use the specified operating system locale for the LC_CTYPE locale
44 category. The locale must be applicable to the current database
45 encoding. (See CREATE DATABASE (CREATE_DATABASE(7)) for the precise
46 rules.)
47
48 existing_collation
49 The name of an existing collation to copy. The new collation will
50 have the same properties as the existing one, but it will be an
51 independent object.
52
54 Use DROP COLLATION to remove user-defined collations.
55
56 See Section 22.2, “Collation Support”, in the documentation for more
57 information about collation support in PostgreSQL.
58
60 To create a collation from the operating system locale fr_FR.utf8
61 (assuming the current database encoding is UTF8):
62
63 CREATE COLLATION french (LOCALE = 'fr_FR.utf8');
64
65 To create a collation from an existing collation:
66
67 CREATE COLLATION german FROM "de_DE";
68
69 This can be convenient to be able to use operating-system-independent
70 collation names in applications.
71
73 There is a CREATE COLLATION statement in the SQL standard, but it is
74 limited to copying an existing collation. The syntax to create a new
75 collation is a PostgreSQL extension.
76
78 ALTER COLLATION (ALTER_COLLATION(7)), DROP COLLATION
79 (DROP_COLLATION(7))
80
81
82
83PostgreSQL 9.2.24 2017-11-06 CREATE COLLATION(7)