Richard:
On Wed, Mar 16, 2011 at 08:45, Richard Broersma
<richard.broersma@gmail.com> wrote:
> How about:
>
> INSERT INTO weather (station_id, date, temperature )
> SELECT A.station_id, A.date, A.temperature
> FROM ( VALUES(2257, '2001-01-01', 22.5),
> (2257, '2001-01-02', 25.3) ) AS A ( station_id, date, temperature)
> LEFT JOIN weather AS B
> ON ( A.station_id, A.date ) = ( B.station_id, B.date )
> WHERE B.station_id IS NULL;
That would work, though I was hoping there'd be some mechanism that
used the key to determine if the incoming record was unique or not
(rather than writing a custom query).
Are there limits to the size of the VALUES sub-query? I'm processing
about 500 records at a time, and each record is fairly wide (about 350
characters without the field names).