X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 8768ED1F58A for ; Thu, 14 Aug 2003 05:01:43 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 79706-08 for ; Thu, 14 Aug 2003 02:00:04 -0300 (ADT) Received: from mail025.syd.optusnet.com.au (mail025.syd.optusnet.com.au [210.49.20.147]) by svr1.postgresql.org (Postfix) with ESMTP id C743DD1F842 for ; Thu, 14 Aug 2003 01:50:56 -0300 (ADT) Received: from jerry (c210-49-244-235.thoms1.vic.optusnet.com.au [210.49.244.235]) by mail025.syd.optusnet.com.au (8.11.6p2/8.11.6) with ESMTP id h7E4op016185; Thu, 14 Aug 2003 14:50:51 +1000 From: Jason Godden Reply-To: jasongodden@optushome.com.au To: expect Subject: Re: importing db as text files Date: Thu, 14 Aug 2003 14:50:41 +1000 User-Agent: KMail/1.5 Cc: References: <71E37EF6B7DCC1499CEA0316A2568328DC9819@loki.globexplorer.com> <20030813211701.031090a6.expect@ihubbell.com> In-Reply-To: <20030813211701.031090a6.expect@ihubbell.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200308141450.41485.jasongodden@optushome.com.au> X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200308/672 X-Sequence-Number: 47089 On Thu, 14 Aug 2003 02:17 pm, expect wrote: > On Wed, 13 Aug 2003 14:59:29 -0700 > > "Gregory S. Williamson" wrote: > > have to fix missing numeric values (if the column allows nulls why can't > > the copy command accept an empty field, I wonder?), missing dates. In > > other cases > > This seems to be the question I need answered as well. Does anyone know > the answer? Copy can accept an empty field (representing null): copy datatable from stdin delimiter '\t' null ''; by default pg expects '\N' to mean null but you can override it: Description: copy data between files and tables Syntax: COPY table [ ( column [, ...] ) ] FROM { 'filename' | stdin } [ [ WITH ] [ BINARY ] [ OIDS ] [ DELIMITER [ AS ] 'delimiter' ] [ NULL [ AS ] 'null string' ] ] COPY table [ ( column [, ...] ) ] TO { 'filename' | stdout } [ [ WITH ] [ BINARY ] [ OIDS ] [ DELIMITER [ AS ] 'delimiter' ] [ NULL [ AS ] 'null string' ] ] Rgds, Jason