Re: Sorting by numerical order

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Mike Nolan <nolan(at)gw(dot)tssi(dot)com>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, CSN <cool_screen_name90001(at)yahoo(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Sorting by numerical order
Date: 2004-03-14 23:09:54
Message-ID: 20040314230953.GA23397@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sun, Mar 14, 2004 at 04:59:45PM -0600, Mike Nolan wrote:
> On a somewhat related subject, how difficult would it be to write an
> 'isnumeric' function as part of the source code as opposed to a user
> function in pgsql or perl?

Regular expressions? Something like:

column ~ '^[-+]?[0-9]+(\.[0-9]+)?$'

Should do the trick. Ofcourse, if you're dealing with exponentials
you'll need to add more, browsing the web should give you some
examples.

I don't see writing it in C being significantly faster, but it's
possible I guess.
--
Martijn van Oosterhout <kleptog(at)svana(dot)org> http://svana.org/kleptog/
> If the Catholic church can survive the printing press, science fiction
> will certainly weather the advent of bookwarez.
> http://craphound.com/ebooksneitherenorbooks.txt - Cory Doctorow

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Edwin Pauli 2004-03-14 23:46:41 Re: PostgeSQL problem (server crashed?)
Previous Message Steve Atkins 2004-03-14 23:09:06 Re: Sorting by numerical order