问题描述
我是Postgres的新手。我刚刚从开始学习。我从选择语句中找到COLLATE C
I am new to Postgres. I have just started learning it from here. I found COLLATE "C" from a select statement
SELECT not_equal(first_name, last_name COLLATE "C")
我想知道COLLATE C会做什么?
I would like to know what the COLLATE "C" will does?
推荐答案
排序规则用于对字符串(文本)进行排序,例如按字母顺序排序,是否区分大小写,如何处理带有重音符号的字母等。COLLATE C告诉您数据库根本不使用排序规则。如果他们正在设计一个数据库来保存不同语言的数据,则可以使用此功能。从技术上讲,COLLATE C将使用字节顺序来驱动文本比较。
Collation is used to sort strings (text), for example by alphabetic order, whether or not case matters, how to deal with letters that have accents etc. COLLATE "C" tells the database not to use collation at all. One might use this if they were designing a database to hold data in different languages. Technically, COLLATE "C" will use byte order to drive text comparisons.
提供了一个很好的示例,说明了使用法语本地化的COLLATE C与COLLATE fr_FR的区别。
The first answer on https://dba.stackexchange.com/questions/94887/what-is-the-impact-of-lc-ctype-on-a-postgresql-database provides a good example of the differences between using COLLATE "C" vs. COLLATE "fr_FR" which uses the French localization.
这篇关于在Postgres中整理的目的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!