LINUX.ORG.RU

CREATE TABLE COLLATE and CREATE INDEX (<field> COLLATE ...)

 , ,


0

1

Имеет ли смысл отдельно задавать локаль для индекса, если она задана при определении поля? То есть, для PgSQL:

CREATE TABLE <name> (
  ...
  <field> varchar(N) COLLATE pg_catalog."C",
  ...
);

CREATE INDEX <idx> ON <name> USING "btree" (<field> COLLATE pg_catalog."C" ASC NULLS LAST);

LMGTFY

https://www.postgresql.org/docs/12/sql-createindex.html

CREATE [ UNIQUE ] INDEX [ CONCURRENTLY ] [ [ IF NOT EXISTS ] name ] ON [ ONLY ] table_name [ USING method ]
    ( { column_name | ( expression ) } [ COLLATE collation ] [ opclass ] [ ASC | DESC ] [ NULLS { FIRST | LAST } ] [, ...] )
    [ INCLUDE ( column_name [, ...] ) ]
    [ WITH ( storage_parameter = value [, ... ] ) ]
    [ TABLESPACE tablespace_name ]
    [ WHERE predicate ]

collation: 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 non-default collations can be useful for queries that involve expressions using non-default collations.

Legioner ★★★★★
()
Последнее исправление: Legioner (всего исправлений: 1)
Вы не можете добавлять комментарии в эту тему. Тема перемещена в архив.