On Sat, Jun 14, 2003 at 09:52:26 -0400,
Alan Searles <alien@attglobal.net> wrote:
> Is PostgreSQL able to perform multi-row inserts using a single INSERT
> statement as shown below ?
>
> INSERT INTO table ( col1, col2, col3 )
> VALUES ( value1, value2, value3 ),
> ( value4, value5, value6 ),
> ( value7, value8, value9 )
>
> Yes, I have looked through the PostgreSQL documentation, and it DOES
> NOT appear as though it can.
> I was hoping that I did not read it right.
This was recently covered on one of the postgres lists. For small
(I am not sure how long query strings can be, but small is at least
hundreds of values.) numbers of values you can use union. For example:
INSERT INTO table ( col1, col2, col3 )
select value1, value2, value3 union
select value4, value5, value6 union
select value7, value8, value9;