Re: multiple row insertion

From: "A(dot) Kretschmer" <andreas(dot)kretschmer(at)schollglas(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: multiple row insertion
Date: 2007-10-04 14:15:02
Message-ID: 20071004141502.GI15428@a-kretschmer.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

am Thu, dem 04.10.2007, um 18:47:01 +0500 mailte test tester folgendes:
>
>
> On 10/4/07, test tester <test896(at)gmail(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2007-10-04 14:18:25 Re: Postgres8: subselect and optimizer/planner
Previous Message Simon Riggs 2007-10-04 14:14:35 Re: PITR Recovery and out-of-sync indexes