Re: base36 sequence

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: ninja <mail(at)schnake(dot)freeserve(dot)co(dot)uk>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: base36 sequence
Date: 2003-02-19 07:24:43
Message-ID: 9286.1045639483@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

ninja <mail(at)schnake(dot)freeserve(dot)co(dot)uk> writes:
> I'm very new to pgsql but I was wondering if it is possible to use
> CREATE SEQUENCE to make auto-increment base36 values for my ID column
> [varchar(252)]. I don't see any base convert function, though.
> Obviously, the reason I'm doing this is so as to maintain hierarchy. Is
> it possible or will I have to increment the sequence outside of pgsql?

If you don't mind my saying so, this seems like an exceedingly bizarre
requirement. Why don't you just use an integer column (or even more
specifically, a serial column) for your ID? Who could possibly care
about a base36 representation for a serial number as opposed to a
plain decimal representation?

FWIW, you could surely write your own display-in-base36 function in
plperl or pltcl. I'm just mildly astonished that you consider this
a significant issue.

regards, tom lane

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Mark Molenda 2003-02-19 13:10:36 getting integer info.
Previous Message Josh Berkus 2003-02-19 00:25:30 Re: null value in date field