From: | Greg Smith <gsmith(at)gregsmith(dot)com> |
---|---|
To: | "D(dot) Dante Lorenso" <dante(at)lorenso(dot)com> |
Cc: | Postgres-General <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: convert very large unsigned numbers to base62? |
Date: | 2008-05-15 01:50:31 |
Message-ID: | Pine.GSO.4.64.0805142143590.27290@westnet.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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(at)gregsmith(dot)com http://www.gregsmith.com Baltimore, MD
From | Date | Subject | |
---|---|---|---|
Next Message | Eliot, Christopher | 2008-05-15 02:10:26 | Populating a sparse array piecemeal in plpgsql |
Previous Message | D. Dante Lorenso | 2008-05-15 01:36:18 | Re: convert very large unsigned numbers to base62? |