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 C346BD1C982 for ; Fri, 15 Aug 2003 15:35:56 +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 66060-08 for ; Fri, 15 Aug 2003 12:35:45 -0300 (ADT) Received: from ohio.stageserver.net (ohio.stageserver.net [216.180.225.74]) by svr1.postgresql.org (Postfix) with ESMTP id CAE63D1C969 for ; Fri, 15 Aug 2003 12:35:43 -0300 (ADT) Received: from ip68-6-45-108.sb.sd.cox.net ([68.6.45.108] helo=localhost.localdomain) by ohio.stageserver.net with esmtp (TLSv1:DES-CBC3-SHA:168) (Exim 4.20) id 19ngcD-0005YW-DQ for pgsql-general@postgresql.org; Fri, 15 Aug 2003 10:35:45 -0500 Date: Fri, 15 Aug 2003 08:35:44 -0700 From: expect To: pgsql-general@postgresql.org Subject: Re: importing db as text files Message-Id: <20030815083544.6657322a.expect@ihubbell.com> In-Reply-To: <20030815075948.I19338-100000@megazone.bigpanda.com> References: <20030815005303.17eb4c7d.expect@ihubbell.com> <20030815075948.I19338-100000@megazone.bigpanda.com> Organization: iHubbell X-Mailer: Sylpheed version 0.9.4claws (GTK+ 1.2.10; i686-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - ohio.stageserver.net X-AntiAbuse: Original Domain - postgresql.org X-AntiAbuse: Originator/Caller UID/GID - [0 0] / [47 12] X-AntiAbuse: Sender Address Domain - ihubbell.com X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200308/744 X-Sequence-Number: 47161 On Fri, 15 Aug 2003 08:03:04 -0700 (PDT) Stephan Szabo wrote: > On Fri, 15 Aug 2003, expect wrote: > > > On Fri, 15 Aug 2003 00:32:01 -0700 (PDT) > > Stephan Szabo wrote: > > > > > > > > On Thu, 14 Aug 2003, expect wrote: > > > > > > > On Thu, 14 Aug 2003 12:46:07 -0500 > > > > Bruno Wolff III wrote: > > > > > Note that it isn't obvious what empty strings should map to for numbers. > > > > > NULL and 0 make about as much sense as using the default value. > > > > > > > > Well I'm new here but it seems to me they should map to the default value > > > > for that column. Why wouldn't they? > > > > > > One problem with doing that is that it's inconsistent. > > > > Please elaborate. How is it inconsistent, exactly? > > See my comments below. > > > > > > > Given > > > create table test( > > > a text default 'abc', > > > b int default 5 > > > ); > > > > > > copy test from stdin with delimiter ','; > > > , > > > \. > > > > > > What would you expect the values of the row in test > > > to be? > > > > > > Oh a test.... > > > > Does the \. end the STDIN input? > > > > Where's the null option? Don't you mean: > > > > copy test from stdin with delimiter ',' null ''; > > No, I'm saying without a null specifier. > > > In this case I would expect the row to have: > > > > a | b > > ---------- > > | > > abc | 5 > > > > > > Is this too much to expect? > > Without a null specifier of '', empty string is a valid value for a. > Why would it get the default, and how would you insert an empty string? > Should it treat b differently because '' isn't valid for that type, that'd > be inconsistent. > > With a null specifier of '', empty string is valid for both and means > NULL. Otherwise, how would you specify a null when you have that > null specifier? Don't want to specify a null. > > What you probably really want is another specifier that inserts the > default for a column, so you could say something like: > copy test from stdin with delimiter ',' default ''; No, I don't want anyone else to do anymore work. I'd much rather see improvements than new features, unless the new feature is a big improvement. > > > >