From qinghuamail-postgresqlfans@yahoo.com Mon Aug 27 08:18:44 2007 Received: from localhost (maia-3.hub.org [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id 714B09F9D9A for ; Mon, 27 Aug 2007 05:18:44 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 21037-05 for ; Mon, 27 Aug 2007 05:18:33 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.5 Received: from web58108.mail.re3.yahoo.com (web58108.mail.re3.yahoo.com [68.142.236.131]) by postgresql.org (Postfix) with SMTP id F2D199F9DD5 for ; Mon, 27 Aug 2007 05:18:36 -0300 (ADT) Received: (qmail 48430 invoked by uid 60001); 27 Aug 2007 08:18:36 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=X-YMail-OSG:Received:Date:From:Reply-To:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-ID; b=Zsx1x+BjRJXxE933Jrs5EJ5+ke6aq1NW4G1B4BC4QCY91SXyTcUxIE4eb1DrscUmn+J5CR08YhTrXx743PFwXINVmllXYsNKXI8H5NkmTKsvB0RimKXdrHnKmCP5+O8ZU0bz/xLaNz3qNlzI0ngPXphOwtpVYNvMsgrUXJe7Iok=; X-YMail-OSG: U5z6lCwVM1m4J9pvRWxiLLpsFIPOWFeBsYZkQrF9M3m49x_PLzqqzrCtc0S_EWVNUFKnZ9bSqQ0bHB3.V6kPG88lElHTVLCr90BDsU3H.aCiR3y1iILG9j2JcvGhEg-- Received: from [219.142.118.227] by web58108.mail.re3.yahoo.com via HTTP; Mon, 27 Aug 2007 16:18:35 CST Date: Mon, 27 Aug 2007 16:18:35 +0800 (CST) From: Reply-To: qinghuamail-postgresqlfans@yahoo.com Subject: Copy cmd error To: postgresql-admin MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="0-579661364-1188202715=:48089" Content-Transfer-Encoding: 8bit Message-ID: <972942.48089.qm@web58108.mail.re3.yahoo.com> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=1.001 tagged_above=0 required=5 tests=BAYES_60=1, HTML_MESSAGE=0.001 X-Spam-Level: * X-Archive-Number: 200708/323 X-Sequence-Number: 26654 --0-579661364-1188202715=:48089 Content-Type: text/plain; charset=gb2312 Content-Transfer-Encoding: 8bit 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? thanks! --------------------------------- 雅虎邮箱,以安全著称,是值得信赖的邮箱专家! --0-579661364-1188202715=:48089 Content-Type: text/html; charset=gb2312 Content-Transfer-Encoding: 8bit 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?

thanks!



雅虎邮箱,以安全著称,是值得信赖的邮箱专家! --0-579661364-1188202715=:48089-- From scott.marlowe@gmail.com Mon Aug 27 21:41:03 2007 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.