purpose of collate in Postgres

前端 未结 1 1906
后悔当初
后悔当初 2021-02-07 00:54

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 \"         


        
1条回答
  •  终归单人心
    2021-02-07 01:20

    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.

    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.

    0 讨论(0)
提交回复
热议问题