pgsql-bugs(at)postgresql(dot)org writes:
> create table aaa ( aa varchar(3) );
> insert into aaa values ('001');
> insert into aaa values ('002');
> insert into aaa values ('003');
> select max(aa) from aaa;
> max
> -----
> 002
> (1 row)
Hm. It works for me, and doubtless for most other people. Something
is badly wrong with your installation. What platform are you on, and
how did you obtain or compile Postgres? If you enabled locale support,
what locale are you running the postmaster in?
regards, tom lane