Sort string on postgresql

2024-07-07 postgresql

Need to be careful when trying to sort varchar field on PostgreSQL.

mydb=# create table t (id varchar);
mydb=# insert into t values ('1'),('2'),('9'),('10');
INSERT 0 4
mydb=# select max(id) from t;
 max 
-----
 9
(1 row)