Re: multiple row insertion

From: "Dawid Kuroczko" <qnex42(at)gmail(dot)com>
To: "test tester" <test896(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: multiple row insertion
Date: 2007-10-04 14:02:55
Message-ID: 758d5e7f0710040702n19c9a57ahe93394820a80c074@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> 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 don't top post.

If you need this functionality, you should really upgrade.

In cases where you want to insert multiple rows in version 8.1, you
could use COPY command:
http://www.postgresql.org/docs/8.1/interactive/sql-copy.html

You use it like this:
COPY cars FROM STDIN DELIMITER AS ',' CSV;
5,toyota
6,ford
\.

Or if you really need to use INSERT you could use such construct:

INSERT INTO cars SELECT 5, 'toyota' UNION ALL SELECT 6, 'ford'
UNION ALL SELECT 7, 'bmw';

In short: really get the 8.2 version. 8.2 is compatible with earlier
versions and will be coming soon.

Regards,
Dawid
--
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Simon Riggs 2007-10-04 14:14:35 Re: PITR Recovery and out-of-sync indexes
Previous Message Miroslav Šulc 2007-10-04 14:02:15 Re: ERROR: variable not found in subplan target lists