Re: mass import to table with unique index

From: Manfred Koizar <mkoi-pg(at)aon(dot)at>
To: John Smith <john_smith_45678(at)yahoo(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: mass import to table with unique index
Date: 2003-01-30 10:33:08
Message-ID: j0vh3v8kmmf4n759qhb855bgijutojmk32@4ax.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, 30 Jan 2003 01:41:51 -0800 (PST), John Smith
<john_smith_45678(at)yahoo(dot)com> wrote:
>> I think that what the OP is looking for is the SQL*Server equivalent of
>> option IGNORE_DUP_KEY, where if you try to insert a record with that key
>> already included, it simply ignores that record.
>
>Exactly :)

John, import into a temporary table and then

INSERT INTO original_table
SELECT DISTINCT ON (your, uniq, cols) *
FROM temp_table t
WHERE NOT EXISTS (
SELECT * FROM original_table o
WHERE o.your=t.your AND o.uniq=t.uniq AND o.cols=t.cols)
ORDER BY your, uniq, cols, whatever;

HTH.
Servus
Manfred

In response to

Browse pgsql-general by date

  From Date Subject
Next Message ayhan 2003-01-30 10:48:58 Re: plperl functions -- can they call each other?
Previous Message Justin Clift 2003-01-30 10:31:04 Re: donations?