Re: Generating random values.

From: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>
To: Fernando Lujan <flujan(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Generating random values.
Date: 2005-08-17 17:26:36
Message-ID: 4303734C.8040105@commandprompt.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Fernando Lujan wrote:
> Hi folks,
>
> I have a table wich contains my users... I want to insert to each user
> a random password, so I need a random function. Is there such function
> in Postgres? I just found the RANDOM which generates values between
> 0.0 and 1.0.
>
> Any help or suggestion will be appreciated. :)

I would do someting like:

select substring(md5(random() || random()), 5, 8);

Sincerely,

Joshua D. Drkae

>
> Fernando Lujan
>
> ---------------------------(end of broadcast)---------------------------
> TIP 9: In versions below 8.0, the planner will ignore your desire to
> choose an index scan if your joining column's datatypes do not
> match

--
Your PostgreSQL solutions company - Command Prompt, Inc. 1.800.492.2240
PostgreSQL Replication, Consulting, Custom Programming, 24x7 support
Managed Services, Shared and Dedicated Hosting
Co-Authors: plPHP, plPerlNG - http://www.commandprompt.com/

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Greg Stark 2005-08-17 17:34:07 Re: table clustering brings joy
Previous Message Bruce Momjian 2005-08-17 17:14:02 Re: Technical FAQ collecting of infos from the mailing list