I've been using the generate_series function and finding it very useful. It 
generates an integer, but I cast to 'day' interval.
Might be useful.
doug

-----Original Message-----
From: pgsql-sql-ow...@postgresql.org [mailto:pgsql-sql-ow...@postgresql.org] On 
Behalf Of Richard Broersma
Sent: Wednesday, May 12, 2010 4:05 PM
To: Josh
Cc: pgsql-sql@postgresql.org
Subject: Re: [SQL] Greetings folks, dumb question maybe?

On Wed, May 12, 2010 at 10:32 AM, Josh <jgood...@ttitech.net> wrote:

> I am trying to create a function that loads 100M test records into a
> database,  however I am having a hard time building the function that does
> so.

Here is one idea a function, but is could be wrapped by one:

p2082849b=> INSERT INTO Testtable ( n, c, d )
p2082849b-> WITH RECURSIVE T(n,c,d) as ( SELECT 1, 'A', CAST(
'2009-12-31' AS DATE ) + INTERVAL '1 DAY'
p2082849b(>                    UNION ALL SELECT n + 1, c, d + INTERVAL '1 day'
p2082849b(>                                FROM T
p2082849b(>                               WHERE n <= 10000)
p2082849b-> SELECT n,c,d FROM T;
INSERT 0 10001


-- 
Regards,
Richard Broersma Jr.

Visit the Los Angeles PostgreSQL Users Group (LAPUG)
http://pugs.postgresql.org/lapug

-- 
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql

-- 
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql

Reply via email to