Received: from localhost (maia-4.hub.org [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 7D1EF9FB468 for ; Thu, 17 May 2007 09:10:52 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 23620-03 for ; Thu, 17 May 2007 09:10:49 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from tigger.fuhr.org (tigger.fuhr.org [63.214.45.158]) by postgresql.org (Postfix) with ESMTP id 210BE9FB40D for ; Thu, 17 May 2007 09:10:48 -0300 (ADT) Received: from winnie.fuhr.org (winnie.fuhr.org [10.1.0.1]) by tigger.fuhr.org (8.13.8/8.13.8) with ESMTP id l4HCAhCG066166 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 17 May 2007 06:10:46 -0600 (MDT) Received: from winnie.fuhr.org (localhost [127.0.0.1]) by winnie.fuhr.org (8.13.8/8.13.8) with ESMTP id l4HCAhTN026655; Thu, 17 May 2007 06:10:43 -0600 (MDT) (envelope-from mfuhr@winnie.fuhr.org) Received: (from mfuhr@localhost) by winnie.fuhr.org (8.13.8/8.13.8/Submit) id l4HCAg6L026654; Thu, 17 May 2007 06:10:42 -0600 (MDT) (envelope-from mfuhr) Date: Thu, 17 May 2007 06:10:42 -0600 From: Michael Fuhr To: Sandeep Khandelwal Cc: pgsql-interfaces@postgresql.org Subject: Re: COPY command with bad input Message-ID: <20070517121042.GA26576@winnie.fuhr.org> References: <126544.67764.qm@web33313.mail.mud.yahoo.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <126544.67764.qm@web33313.mail.mud.yahoo.com> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200705/34 X-Sequence-Number: 6541 On Tue, May 15, 2007 at 02:11:00AM -0700, Sandeep Khandelwal wrote: > I am trying to load data from a text file to Postgres table using > COPY command. If text file has some invalid rows then COPY command > stops at the first error. > > As you can see, MySQL “load data infile” has IGNORE option. If you > specify IGNORE, input rows that duplicate an existing row on a > unique key value are skipped. Do we have similar option for Postgres > COPY command ? Not yet; it's on the developers' TODO list: http://www.postgresql.org/docs/faqs.TODO.html * Allow COPY to report error lines and continue In the meantime you could check out pgloader: http://pgfoundry.org/projects/pgloader/ -- Michael Fuhr