From: | Michael Enke <michael(dot)enke(at)wincor-nixdorf(dot)com> |
---|---|
To: | pgsql-hackers(at)postgresql(dot)org |
Subject: | copy table from file: with row replacement? |
Date: | 2007-01-11 08:50:51 |
Message-ID: | 45A5FA6B.9010001@wincor-nixdorf.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hello all,
I have a feature request as I think it is not possible with the actual version:
I want to load huge amount of data and I know that COPY is much faster than doing inserts.
But in my case I have an already filled table and rows (not all, only partly) from this table
should be replaced. The table has a primary key for one column.
If I do a COPY table FROM file and the key value already exists, postgresql tells me
that the import is not possible because of the violation of the PK.
If postgres is aware of such a violation, couldn't there be an option to the COPY command
to delete such existing rows so that a COPY table FROM file will never generate a PK violation message
but replaces existing rows?
If this is not possible, would it be the next fastes solution to create a before trigger and to
delete rows in this trigger? Or is this not different from issuing for every line an insert
and if this fails (because of the PK) than an update?
Thank you,
Michael
PS: Please CC to my email
From | Date | Subject | |
---|---|---|---|
Next Message | Joachim Wieland | 2007-01-11 08:51:11 | Re: [COMMITTERS] pgsql: Stamp major release 8.3.0, |
Previous Message | Magnus Hagander | 2007-01-11 07:51:58 | Re: installcheck vs regression DLLs |