Re: Insert more than one t-uple in a single sql

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Rick Gigger <rick(at)alpinenetworking(dot)com>
Cc: Chris <dmagick(at)gmail(dot)com>, Gonzalo Villegas <chalo1970(at)hotmail(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Insert more than one t-uple in a single sql
Date: 2006-02-10 00:12:45
Message-ID: 6116.1139530365@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

>> You can't do that in postgres, sorry. That's a mysql-ism.
>>
>> Gonzalo Villegas wrote:
>>
>>> It must be something like
>>> insert into table (field1,field2,...) values (v1,v2,...),(b1,b2,...),
>>> (c1,c2,...)

Actually, that's not a mysql-ism, it's SQL-spec syntax. We haven't got
round to implementing it, partly because the SELECT ... UNION ALL ...
syntax provides a perfectly good substitute. It is on the TODO list
though.

I wouldn't recommend trying to insert more than a few dozen rows with
the UNION ALL approach, else the planner overhead might swamp any
savings. If you want to insert thousands of rows at once, you almost
certainly want to find a way to use COPY.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2006-02-10 00:20:19 Re: distinct not working in a multiple join
Previous Message David Rio Deiros 2006-02-09 23:33:09 distinct not working in a multiple join