Sunday, May 13, 2012

Using generate_series() in PostgreSQL

If you want to dummy up a bunch of data in PostgreSQL you can use this neat little trick
create table test (a int);
insert into test (select generate_series(0,999,1));
INSERT 0 1000;

2 comments:

  1. What does the `INSERT 0 1000;` do?

    ReplyDelete
    Replies
    1. Oh, that's actually the output from the line above.

      Delete

Web Statistics