Received: from localhost (maia-2.hub.org [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id 876799F9F60 for ; Mon, 27 Aug 2007 18:41:03 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.187]) (amavisd-maia, port 10024) with ESMTP id 77086-02 for ; Mon, 27 Aug 2007 18:40:23 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.5 Received: from nz-out-0506.google.com (nz-out-0506.google.com [64.233.162.229]) by postgresql.org (Postfix) with ESMTP id A172D9F9F14 for ; Mon, 27 Aug 2007 18:40:26 -0300 (ADT) Received: by nz-out-0506.google.com with SMTP id l8so1077521nzf for ; Mon, 27 Aug 2007 14:40:25 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=K3lxhvmuQYaazHuVx5ZNydwis5+Q/5Wsi0RXw44VFB/sQMAwjz+npL4mSkphurtxI1r538qo2+JM2KcGP6ao6Cx2xb2w70M9DJCxxHXphtrdNkPD8MUOoispkw6TbcG+Qm5HHh5fJwE60TSBaC7ZoWido6iyVp+H2wCPvsw8gzI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=Tc6jANUoEtZhdFnR87GYs57p1gsZEaOmX9LOEoreIxjOy5t+s64bdNYNx42DqN5HpNIh1AFlchLXSCLmIV5G1IKBogl2EkpRI0tHZ4JcXtL2lwo1vvpyJ5NfAa3njxTqq2ZvQtesqyyTluugX0xWpnuUzkpch/6TvO9LjDMj6Y8= Received: by 10.141.171.6 with SMTP id y6mr3065400rvo.1188250825081; Mon, 27 Aug 2007 14:40:25 -0700 (PDT) Received: by 10.141.159.11 with HTTP; Mon, 27 Aug 2007 14:40:25 -0700 (PDT) Message-ID: Date: Mon, 27 Aug 2007 16:40:25 -0500 From: "Scott Marlowe" To: qinghuamail-postgresqlfans@yahoo.com Subject: Re: Copy cmd error Cc: postgresql-admin In-Reply-To: <972942.48089.qm@web58108.mail.re3.yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <972942.48089.qm@web58108.mail.re3.yahoo.com> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200708/334 X-Sequence-Number: 26665 On 8/27/07, qinghuamail-postgresqlfans@yahoo.com wrote: > hi,all > > I use COPY cmd to import large data to database,but I have a question, > > when occured the first error, It always stopped, I need it to be > continue,and reject the error rows to a file, how to do this? There are two common ways to do this. First, import to a temp table then fix up the data there until an "insert into real_table select * from temp_table" type statement to import the data. The second is to swrite some kind of app in bash, perl, php, awd, sed, C or whatever language you like to put the data into a format that the database won't choke on.