Re: Greetings folks, dumb question maybe? - Mailing list pgsql-sql

From Little, Douglas
Subject Re: Greetings folks, dumb question maybe?
Date
Msg-id 8585BA53443004458E0BAA6134C5A7FB061CA5A5@EGEXCMB01.oww.root.lcl
Whole thread Raw
In response to Re: Greetings folks, dumb question maybe?  (Richard Broersma <richard.broersma@gmail.com>)
List pgsql-sql
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-owner@postgresql.org [mailto:pgsql-sql-owner@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 <jgooding@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


pgsql-sql by date:

Previous
From: Richard Broersma
Date:
Subject: Re: Greetings folks, dumb question maybe?
Next
From: "Gnanakumar"
Date:
Subject: Re: Invalid message format Exception