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

From Joshua Tolley
Subject Re: Greetings folks, dumb question maybe?
Date
Msg-id 4bebf2ae.1249650a.19f4.2ea8@mx.google.com
Whole thread Raw
In response to Re: Greetings folks, dumb question maybe?  (Jasen Betts <jasen@xnet.co.nz>)
List pgsql-sql
On Thu, May 13, 2010 at 10:09:51AM +0000, Jasen Betts wrote:
> On 2010-05-12, Josh <jgooding@ttitech.net> wrote:
> don't need a function for that one.
>
> INSERT INTO unpart_tbl_test
>  SELECT  GENERATE_SERIES(0,9999999),
>      'teststring data',
>      date '1995-01-01' +(floor(random()*36520)::int % 3652);

...and if you'd rather it were a function anyway, do this:

CREATE FUNCTION populate_table() RETURNS VOID AS $$   INSERT INTO unpart_tbl_test     SELECT
GENERATE_SERIES(0,9999999),       'teststring data',        date '1995-01-01' +(floor(random()*36520)::int % 3652); 
$$ LANGUAGE SQL;

--
Joshua Tolley / eggyknap
End Point Corporation
http://www.endpoint.com

pgsql-sql by date:

Previous
From: Jasen Betts
Date:
Subject: Re: [Trigger] Help needed with NEW.* and TG_TABLE_NAME
Next
From: Justin Graf
Date:
Subject: Re: best paging strategies for large datasets?