From: | "Dann Corbit" <DCorbit(at)connx(dot)com> |
---|---|
To: | "Ron St-Pierre" <rstpierre(at)syscor(dot)com>, <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: COPY - Ignore Problems |
Date: | 2003-12-23 00:03:10 |
Message-ID: | D90A5A6C612A39408103E6ECDD77B829408CB6@voyager.corporate.connx.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
How about this:
Let's call your current table tab.
Insert into a table with the same shape as your table tab called 'lfd'.
Create an index on table lfd on fields lname, fname, workdate.
Delete from lfd where lfd.lname = tab.lname and lfd.fname = tab.fname
and lfd.workdata = tab.workdate
Insert into tab select * from lfd
Or something like that. SQL*Server has something called
IGNORE_DUPLICATES. It is the only database I recall that has that
feature.
> -----Original Message-----
> From: Ron St-Pierre [mailto:rstpierre(at)syscor(dot)com]
> Sent: Monday, December 22, 2003 3:48 PM
> To: pgsql-general(at)postgresql(dot)org
> Subject: [GENERAL] COPY - Ignore Problems
>
>
> I wish to insert data into a table from a very large text
> file (from a
> cron script) using COPY. However if the lName (TEXT), fName(TEXT),
> workDate(DATE) already exist I don't want to insert data and
> just want
> to move onto the next record. Is there any way I can tell my bash
> script/COPY to ignore the case where the unique constraint exists
> (lName,fName,workDate), and move on to the next record?
>
> ps 7.4, debian stable
> TIA
> Ron
>
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 7: don't forget to increase your free space map settings
>
From | Date | Subject | |
---|---|---|---|
Next Message | Paul Thomas | 2003-12-23 00:27:59 | Re: CHECK versus a Table for an enumeration |
Previous Message | Ron St-Pierre | 2003-12-22 23:47:36 | COPY - Ignore Problems |