postgresql COLLATE pg_catalog."default" 对 postgres 数据库表中的文本属性有什么作用?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/44008252/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 06:26:27  来源:igfitidea点击:

What does COLLATE pg_catalog."default" do on text attribute in postgres database table?

postgresql

提问by Saurabh Bhatia

One of the fields while creating the table is described as below

创建表时的字段之一如下所述

id text COLLATE pg_catalog."default"

采纳答案by Michel Milezzi

It's just telling that you're using default lc_collatefor this column.

它只是告诉您正在lc_collate为此列使用默认值。

But what's the default collate? Use SHOWto discover that.

但是默认的整理是什么?使用SHOW来发现。

SHOW lc_collate;

PostgreSQL allows to create columns with different types of collation:

PostgreSQL 允许创建具有不同类型排序规则的列:

CREATE TABLE collate_test
(
  default_collate text, --Default collation
  custom_collate text COLLATE pg_catalog."C" --Custom collation
);

Did you see the difference?

你看到区别了吗?

More info about collation is on docs:

有关整理的更多信息在docs 上

The collation feature allows specifying the sort order and character classification (...)

整理功能允许指定排序顺序和字符分类 (...)