Skip site navigation (1) Skip section navigation (2)

Re: Greetings folks, dumb question maybe?

From: Jasen Betts <jasen(at)xnet(dot)co(dot)nz>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: Greetings folks, dumb question maybe?
Date: 2010-05-13 10:09:51
Message-ID: hsgj5f$o21$1@reversiblemaps.ath.cx (view raw or flat)
Thread:
Lists: pgsql-sql
On 2010-05-12, Josh <jgooding(at)ttitech(dot)net> wrote:
> Hello, I'm a little new at this so please bear with me.
>
> 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.
>
> I'm trying to do this in PGAdmin III for Ubuntu.  Is there something 
> that I have wrong with this?  I know that this works in MySQL (and yes I 
> know that MySQL bends the SQL Standards), but I am not sure what I am 
> doing wrong exactly.  I am coming up with the error that says there's an 
> error in my syntax near the v INTEGER := 0 line.  I get the same error 
> in psql as I do in the PGAdmin III.
>
> I have the following so far:
>
> DECLARE
> v INTEGER := 0;
> BEGIN
> while v < 100000000
> DO
> INSERT INTO unpart_tbl_test VALUES
> (v, 'test string data', adddate('1995-01-01', (rand(v)*36520) mod 3652));
> v := v + 1;
> END WHILE;
> END;
>
> Any insight would be greatly appreciated.
>
> - J

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);

In response to

Responses

pgsql-sql by date

Next:From: Jasen BettsDate: 2010-05-13 10:51:22
Subject: Re: [Trigger] Help needed with NEW.* and TG_TABLE_NAME
Previous:From: silly sadDate: 2010-05-13 08:41:30
Subject: Re: best paging strategies for large datasets?

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group