Re: multiple row insertion - Mailing list pgsql-general

From A. Kretschmer
Subject Re: multiple row insertion
Date
Msg-id 20071004141502.GI15428@a-kretschmer.de
Whole thread Raw
In response to Re: multiple row insertion  ("test tester" <test896@gmail.com>)
List pgsql-general
am  Thu, dem 04.10.2007, um 18:47:01 +0500 mailte test tester folgendes:
>
>
> On 10/4/07, test tester <test896@gmail.com> wrote:
>
>     i have version 8.1 and i want to know how to insert multiple rows in this
>     version.

Please no silly top post.

You can insert multiple values with one insert with multiple select and
UNION like this example:

test=*# truncate foo;
TRUNCATE TABLE
test=*# select * from foo;
 w
---
(0 rows)

test=*# insert into foo  select 'foo1' union select 'foo2' union select 'foo3';
INSERT 0 3
test=*# select * from foo;
  w
------
 foo1
 foo2
 foo3
(3 rows)



Andreas
--
Andreas Kretschmer
Kontakt:  Heynitz: 035242/47150,   D1: 0160/7141639 (mehr: -> Header)
GnuPG-ID:   0x3FFF606C, privat 0x7F4584DA   http://wwwkeys.de.pgp.net

pgsql-general by date:

Previous
From: Simon Riggs
Date:
Subject: Re: PITR Recovery and out-of-sync indexes
Next
From: Tom Lane
Date:
Subject: Re: Postgres8: subselect and optimizer/planner