Re: Random Numbers/Letters

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: "Hillensbeck, Preston" <PHillensbeck(at)sfbcic(dot)com>
Cc: "'pgsql-general(at)postgresql(dot)org'" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Random Numbers/Letters
Date: 2002-03-18 15:21:43
Message-ID: 20020318152143.GA26618@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Mar 14, 2002 at 08:57:49AM -0600,
"Hillensbeck, Preston" <PHillensbeck(at)sfbcic(dot)com> wrote:
> Hello,
>
> This may have been discussed before(I have looked and could not find
> much on this), but I need to find a way to generate random numbers and
> letters together to insert into a field when a new entry is created. Just
> to give you a little insight, I will be accepting images from people and I
> want to generate a random line of numbers or letters so that I can put a
> name on a picture, and when someone pulls up a profile of the user, it will
> pull the picture with the random name out of the directory. I haven't been
> able to find much on random number/letter generators within PostgreSQL so I
> wanted to post here. If anyone has an easy way for this to be done, please
> let me know. Thanks :)

I think you would be better off using a sequence instead. It seems what
you mostly want is a unique name. If you use random names, there is a chance
of a collision and this will make coding more complicated.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Johnson, Shaunn 2002-03-18 15:52:23 doing math with date function
Previous Message Pirtea Calin 2002-03-18 10:09:22 Re: limit /offset