Re: numeric SORT order - Mailing list pgsql-general

From Doug McNaught
Subject Re: numeric SORT order
Date
Msg-id m3y9ih6uaj.fsf@varsoon.denali.to
Whole thread Raw
In response to Re: numeric SORT order  (Ben Ausden <benedict@navyblue.com>)
List pgsql-general
Ben Ausden <benedict@navyblue.com> writes:

> thanks Mitch.
> the problem is that casting to int won't work for non-numeric data
> (obviously), and I can't guarantee that values in this column will
> definitely be numeric... I should have made that clearer in my post. Ideally
> I'd like to sort numbers in numeric order and text in regular alphabetic
> order, like: 1,2,3,40,50,a,b,c,d,e...[etc]

Then you'll need to write a custom comparison operator and do
"ORDER BY ... USING my_op".

-Doug
--
Let us cross over the river, and rest under the shade of the trees.
   --T. J. Jackson, 1863

pgsql-general by date:

Previous
From: Jeff Eckermann
Date:
Subject: Re: numeric SORT order
Next
From: "Peter Darley"
Date:
Subject: Re: Moving my business to PostgreSQL