Received: from magus.postgresql.org (magus.postgresql.org [87.238.57.229]) by mail.postgresql.org (Postfix) with ESMTP id CD28A2D4D06 for ; Wed, 4 Jan 2012 05:02:04 -0400 (AST) Received: from lo.gmane.org ([80.91.229.12]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1RiMjR-00067k-3b for pgsql-sql@postgresql.org; Wed, 04 Jan 2012 09:02:04 +0000 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1RiMjE-0004fA-GT for pgsql-sql@postgresql.org; Wed, 04 Jan 2012 10:01:48 +0100 Received: from ip-118-90-27-196.xdsl.xnet.co.nz ([118.90.27.196]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 04 Jan 2012 10:01:48 +0100 Received: from jasen by ip-118-90-27-196.xdsl.xnet.co.nz with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 04 Jan 2012 10:01:48 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: pgsql-sql@postgresql.org From: Jasen Betts Subject: Re: ignore unique violation OR check row exists Date: 4 Jan 2012 08:58:28 GMT Organization: Dis (not Dat) Organisation Lines: 16 Message-ID: References: <1640378676151393930@unknownmsgid> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: ip-118-90-27-196.xdsl.xnet.co.nz X-Face: ?)Aw4rXwN5u0~$nqKj`xPz>xHCwgi^q+^?Ri*+R(&uv2=E1Q0Zk(>h!~o2ID@6{uf8s; a +M[5[U[QT7xFN%^gR"=tuJw%TXXR'Fp~W; (T"1(739R%m0Yyyv*gkGoPA.$b,D.w:z+<'"=-lVT?6 {T?=R^:W5g|E2#EhjKCa+nt":4b}dU7GYB*HBxn&Td$@f%.kl^:7X8rQWd[NTc"P"u6nkisze/Q; 8 "9Z{peQF,w)7UjV$c|RO/mQW/NMgWfr5*$-Z%u46"/00mx-,\R'fLPe.)^ User-Agent: slrn/pre1.0.0-18 (Linux) X-Pg-Spam-Score: -6.1 (------) X-Archive-Number: 201201/13 X-Sequence-Number: 36184 On 2012-01-03, Misa Simic wrote: > If exists is better, though insert line by line and check if exists may > be very slow... > > The best would be if you can use copy command from csv to staging table > (without constraints) and then > > Insert to live from stage where stage constraint column not exist in > live... > Its a good idea to check that the staging table doesn't conflict with itself, before tryign to insert it. -- ⚂⚃ 100% natural