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
PostgreSQL uses the C library locale facilities for sorting strings. C library is provided by the host operating system. On Mac OS X or a BSD-family operating system,the UTF-8 locale definitions are broken and hence the results are as per collation "C".
image attached for collation results with ubuntu 15.04 as host OS
Check FAQ's on postgres wiki for more details : https://wiki.postgresql.org/wiki/FAQ