Re: Sorting by numerical order

Поиск
Список
Период
Сортировка
От Mike Nolan
Тема Re: Sorting by numerical order
Дата
Msg-id 200403142259.i2EMxk1F007960@gw.tssi.com
обсуждение исходный текст
Ответ на Re: Sorting by numerical order  (Peter Eisentraut <peter_e@gmx.net>)
Ответы Re: Sorting by numerical order
Re: Sorting by numerical order
Re: Sorting by numerical order
Re: Sorting by numerical order
Список pgsql-general
> CSN wrote:
> > Is it possible to have items sorted like:
> >
> > abc 1
> > abc 2
> > abc 10
> > abc 20
>
> Cast them to a numeric type.

You can't cast a variable char type to a numeric, though apparently
you can cast text to numeric.  (I'd be curious to know why one but not
the other.)

However, if I understood the original question, 'abc 1' and 'abc 20' are
contents of a single column, which might make separating out just the
numeric part tricky.

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?

I have some data that is mostly numeric but not always so.  I know from
other columns whether a particular row is supposed to contain a numeric
value or not, but the data is coming from a legacy environment
and isn't 100% reliable.

An 'isnumeric(column)' boolean function in a case statment would be
very helpful so that I can program around the bad data.

I'll probably write it in perl, but would making it part of the source
code provide significantly faster execution?
--
Mike Nolan





В списке pgsql-general по дате отправления:

Предыдущее
От: Frank Finner
Дата:
Сообщение: Re: PostgeSQL problem (server crashed?)
Следующее
От: Eric B.Ridge
Дата:
Сообщение: Re: How reliable are the stats collector stats?