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 98167D1C9E7 for ; Thu, 14 Aug 2003 13:52:06 +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 18551-08 for ; Thu, 14 Aug 2003 10:50:31 -0300 (ADT) Received: from wolff.to (wolff.to [66.93.249.74]) by svr1.postgresql.org (Postfix) with SMTP id 22A71D1C7F1 for ; Thu, 14 Aug 2003 10:51:49 -0300 (ADT) Received: (qmail 30752 invoked by uid 500); 14 Aug 2003 13:57:25 -0000 Date: Thu, 14 Aug 2003 08:57:25 -0500 From: Bruno Wolff III To: Jason Godden Cc: expect , pgsql-general@postgresql.org Subject: Re: importing db as text files Message-ID: <20030814135725.GE27870@wolff.to> Mail-Followup-To: Jason Godden , expect , pgsql-general@postgresql.org References: <71E37EF6B7DCC1499CEA0316A2568328DC9819@loki.globexplorer.com> <20030813211701.031090a6.expect@ihubbell.com> <200308141450.41485.jasongodden@optushome.com.au> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200308141450.41485.jasongodden@optushome.com.au> User-Agent: Mutt/1.5.4i X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200308/685 X-Sequence-Number: 47102 On Thu, Aug 14, 2003 at 14:50:41 +1000, Jason Godden wrote: > > Copy can accept an empty field (representing null): That assumes that an empty field is what he means by 'no value'. For some data types an empty string is a perfectly valid data type. > copy datatable from stdin delimiter '\t' null ''; > > by default pg expects '\N' to mean null but you can override it: He wants the default value, not null though. Copy doesn't have a way to specify a string to be replaced by the default value. It probably wouldn't be too hard to add this option, but it is too late for 7.4. If the default value is a constant preprocessing should be an easy way to handle the issue. Another option may be to change null's to the default after importing the data (assuming there aren't actual nulls in the data). If he is trying to use nextval for all rows on one column, then not entering that column would be the way to go. We haven't seen any example of the data he is trying to import so it is hard to give him specific advice.