"Daniel J. Kressin" <dkressin(at)globalcrossing(dot)com> writes:
> Adding an 'ORDER BY host(ip)' clause causes the
> ordering to be:
> 1.2.3.4
> 1.2.3.40
> 1.2.3.41
> 1.2.3.5
host(ip) produces a text result, so the above sort is according to
string-comparison rules. If you want a numeric sort why don't
you just "ORDER BY ip"?
regards, tom lane