Re: convert very large unsigned numbers to base62?

Поиск
Список
Период
Сортировка
От Greg Smith
Тема Re: convert very large unsigned numbers to base62?
Дата
Msg-id Pine.GSO.4.64.0805142143590.27290@westnet.com
обсуждение исходный текст
Ответ на Re: convert very large unsigned numbers to base62?  ("D. Dante Lorenso" <dante@lorenso.com>)
Список pgsql-general
On Wed, 14 May 2008, D. Dante Lorenso wrote:

> Stuart Cooper wrote:
>> base 62 is cruel and unusual punishment. Introduce two more printing
>> characters to your set a..z, A..Z, 0..9 such as "_" and "!" and do it in
>> base 64
>> instead.
>
> I thought about adding 2 more characters, but I didn't like anything that was
> on my keyboard

You really should use as much of an existing wheel here as possible rather
than completely reinventing one:

http://en.wikipedia.org/wiki/Base64

The standard additional two characters to add are "+/".

> My original question is more along the lines of trying to see if there
> were built-in functions in PostgreSQL that already do this type of base
> conversion.

http://www.postgresql.org/docs/current/static/functions-string.html shows
an encode and decode pair that can use base64, you may be able to leverage
those here.

--
* Greg Smith gsmith@gregsmith.com http://www.gregsmith.com Baltimore, MD

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

Предыдущее
От: "D. Dante Lorenso"
Дата:
Сообщение: Re: convert very large unsigned numbers to base62?
Следующее
От: "Eliot, Christopher"
Дата:
Сообщение: Populating a sparse array piecemeal in plpgsql