From: | Gavin Sherry <swm(at)alcove(dot)com(dot)au> |
---|---|
To: | Sorin Schwimmer <sxn02(at)yahoo(dot)com> |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: New feature proposal |
Date: | 2007-01-24 23:38:54 |
Message-ID: | Pine.LNX.4.58.0701251036060.30287@linuxworld.com.au |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Wed, 24 Jan 2007, Sorin Schwimmer wrote:
> Dear Developers,
>
> I would like to suggest the inclusion of an extension
> in PostgreSQL. There are instances, I found, when one
> needs to INSERT several times the same record in a
> table. The front-end application can do it easy in a
> loop of a sort, but on remote servers (and that's the
> norm these days) it creates unnecessary network
> traffic.
>
> My suggestion is to allow INSERT to do it REPEAT x.
> This should allow, in my view, the followings:
> a) INSERT INTO my_table (field1, field2, field3)
> VALUES (value1, value2, value3) REPEAT 5;
postgres=# create table baz (i int, j text);
CREATE TABLE
postgres=# insert into baz (i, j) select 1, 'hello' from
generate_series(1, 5);
INSERT 0 5
postgres=# select * from baz;
i | j
---+-------
1 | hello
1 | hello
1 | hello
1 | hello
1 | hello
(5 rows)
> b) INSERT INTO my_table (field1, field2, field3)
> VALUES (x, value2/x, value3) REPEAT (x=3);
> should insert the followings:
> 1, value2, value3
> 2, value2/2, value3
> 3, value2/3, value3
Yuk! Besides, it can be done similarly to the above.
> This suggestion comes for a practical project that I
> have.
Well, the good thing is, you can use generate_series() now! :-)
Thanks,
Gavin
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2007-01-24 23:55:49 | Re: New feature proposal |
Previous Message | Neil Conway | 2007-01-24 23:35:39 | Re: New feature proposal |