Alphanumeric case in-sensitive sorting in postgres

前端 未结 6 1162
青春惊慌失措
青春惊慌失措 2020-12-17 09:33

I am new to postrges and want to sort varchar type columns. want to explain the problem with with below example:

table name: testsorting

   order             


        
6条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-17 10:36

    I agree with Clodoaldo Neto's answer, but also don't forget to add the index

    CREATE INDEX testsorting_name on testsorting(upper(left(name,1)), substring(name from 2)::integer)
    

提交回复
热议问题