Movatterモバイル変換


[0]ホーム

URL:



Facebook
Postgres Pro
Facebook
Downloads
CREATE COLLATION
Prev UpSQL CommandsHome Next

CREATE COLLATION

CREATE COLLATION — define a new collation

Synopsis

CREATE COLLATIONname (    [ LOCALE =locale, ]    [ LC_COLLATE =lc_collate, ]    [ LC_CTYPE =lc_ctype ])CREATE COLLATIONname FROMexisting_collation

Description

CREATE COLLATION defines a new collation using the specified operating system locale settings, or by copying an existing collation.

To be able to create a collation, you must haveCREATE privilege on the destination schema.

Parameters

name

The name of the collation. The collation name can be schema-qualified. If it is not, the collation is defined in the current schema. The collation name must be unique within that schema. (The system catalogs can contain collations with the same name for other encodings, but these are ignored if the database encoding does not match.)

locale

This is a shortcut for settingLC_COLLATE andLC_CTYPE at once. If you specify this, you cannot specify either of those parameters.

lc_collate

Use the specified operating system locale for theLC_COLLATE locale category. The locale must be applicable to the current database encoding. (SeeCREATE DATABASE for the precise rules.)

lc_ctype

Use the specified operating system locale for theLC_CTYPE locale category. The locale must be applicable to the current database encoding. (SeeCREATE DATABASE for the precise rules.)

existing_collation

The name of an existing collation to copy. The new collation will have the same properties as the existing one, but it will be an independent object.

Notes

UseDROP COLLATION to remove user-defined collations.

SeeSection 22.2 for more information about collation support in PostgreSQL.

Examples

To create a collation from the operating system localefr_FR.utf8 (assuming the current database encoding isUTF8):

CREATE COLLATION french (LOCALE = 'fr_FR.utf8');

To create a collation from an existing collation:

CREATE COLLATION german FROM "de_DE";

This can be convenient to be able to use operating-system-independent collation names in applications.

Compatibility

There is aCREATE COLLATION statement in the SQL standard, but it is limited to copying an existing collation. The syntax to create a new collation is aPostgreSQL extension.


Prev Up Next
CREATE CAST Home CREATE CONVERSION
epubpdf
Go to PostgreSQL 9.5
By continuing to browse this website, you agree to the use of cookies. Go toPrivacy Policy.

[8]ページ先頭

©2009-2025 Movatter.jp