I have a sort problem in PostgreSQL with below data:
name
-----
@CF
@CG
CD
CE
I used select name from table order by name, the
Use PostgreSQL's collation support to tell it you want a particular collation.
Given:
CREATE TABLE t AS VALUES ('CD'),('CE'),('@CF'),('@CE');
You can force byte-wise collation using:
SELECT * FROM t ORDER BY column1 COLLATE "C";
The "C" collation is a byte-wise collation that ignores national language rules, encoding, etc.