Re: Re: How to insert random character data into tables for testing purpose. THanks.

From: yxj <leaf_yxj(at)163(dot)com>
To: "Bruce Momjian" <bruce(at)momjian(dot)us>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Re: How to insert random character data into tables for testing purpose. THanks.
Date: 2012-05-03 15:23:50
Message-ID: 391833b2.12496.137134cd1a4.Coremail.leaf_yxj$163.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi Bruce,

Thanks. I tried. It works.
Regards.

Grace

At 2012-05-03 07:14:21,"Bruce Momjian" <bruce(at)momjian(dot)us> wrote:
>On Wed, May 02, 2012 at 11:03:47AM -0700, leaf_yxj wrote:
>> Hi Andreas,
>>
>> Thanks a lot.
>>
>> I tried those following , they work.
>>
>> 1) insert into test values ( generate_series(1,100000000000),
>> md5(random()::text));
>>
>>
>> 2) create table t_random as select s, md5(random()::text) from
>> generate_Series(1,5) s;
>
>Here is a method that generates strings with a little more variability:
>
> SELECT
> (
> SELECT string_agg(x, '')
> FROM (
> SELECT chr(ascii('A') + (random() * 25)::integer)
> -- reference 'b' so it is correlated and re-evaluated
> FROM generate_series(1, 40 + b * 0)
> ) AS y(x)
> )
> FROM generate_series(1,5) as a(b);
>
> string_agg
> ------------------------------------------
> JWNRUIEPJQGDVBXDJDTROFSNMKGVNAQWWEORMSHV
> KNYGOWJXBEPOJICURIQGIIDFMRXYLFUUSTCIRLGR
> PVHXEITVQKBZREFEVDDHHYCASEIKPOCFJJDNRWJJ
> HKIYONDLQGSXFUXXZGHPUKUESXRLUATBLCAAPDLG
> JEENYCLYISODDIGWGXHBYCCJECJTFUAOYECXGNWO
> (5 rows)
>
>--
> Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
> EnterpriseDB http://enterprisedb.com
>
> + It's impossible for everything to be true. +

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2012-05-03 15:30:47 Re: SQL functions not being inlined
Previous Message Bruce Momjian 2012-05-03 15:02:39 Re: Removal of BSDi, BSD/OS port