Why is ' 2' > '10'?

后端 未结 2 1094
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-02-07 04:12

Why is \' 2\' with an initial space bigger than \'10\'?

select \' 2\' > \'10\';
 ?column? 
----------
 t
(1 row)

I tried i

2条回答
  •  無奈伤痛
    2021-02-07 04:42

    I think this has to do with locale settings.

    According to PostgreSQL docs: Locale Support:

    The locale settings influence the following SQL features:

    • Sort order in queries using ORDER BY on textual data
    • The ability to use indexes with LIKE clauses
    • The upper, lower, and initcap functions
    • The to_char family of functions

提交回复
热议问题