Re: SQL INSERT Statement -- Multi-Row Insert - Mailing list pgsql-novice

From Bruno Wolff III
Subject Re: SQL INSERT Statement -- Multi-Row Insert
Date
Msg-id 20030614171123.GA31163@wolff.to
Whole thread Raw
In response to Re: SQL INSERT Statement -- Multi-Row Insert  (Bruno Wolff III <bruno@wolff.to>)
List pgsql-novice
I made a mistake in my advice. I use just "union" for small examples done
by hand, but when doing it for programattically generated SQL you want
to use "union all". "union all" doesn't remove duplicates and doesn't
waste effort checking for duplicates. So you really want something like:

INSERT INTO table ( col1, col2, col3 )
  select value1, value2, value3 union all
  select value4, value5, value6 union all
  select value7, value8, value9;

pgsql-novice by date:

Previous
From: Bruno Wolff III
Date:
Subject: Re: SQL INSERT Statement -- Multi-Row Insert
Next
From: Tom Lane
Date:
Subject: Re: SQL INSERT Statement -- Multi-Row Insert