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 7444ED1B89A for ; Fri, 15 Aug 2003 16:10:30 +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 82488-05 for ; Fri, 15 Aug 2003 13:10:19 -0300 (ADT) Received: from snoopy.oit.edu (snoopy.OIT.EDU [140.211.135.12]) by svr1.postgresql.org (Postfix) with ESMTP id AEB10D1B89F for ; Fri, 15 Aug 2003 13:10:17 -0300 (ADT) Received: from cvc.net (purvine-141-62.oit.edu [140.211.141.62]) by snoopy.oit.edu (8.12.9/8.12.9/OIT-4.0) with ESMTP id h7FGAAWD004593; Fri, 15 Aug 2003 09:10:10 -0700 Message-ID: <3F3D06EB.9010001@cvc.net> Date: Fri, 15 Aug 2003 09:14:35 -0700 From: Dennis Gearon Reply-To: gearond@cvc.net User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4) Gecko/20030624 X-Accept-Language: en-us, ru, es-mx MIME-Version: 1.0 To: Stephan Szabo Cc: expect , pgsql-general@postgresql.org Subject: Re: importing db as text files References: <20030815075948.I19338-100000@megazone.bigpanda.com> In-Reply-To: <20030815075948.I19338-100000@megazone.bigpanda.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200308/732 X-Sequence-Number: 47149 AFAICT, NULL == NULL '' == empty string default == column default Seems pretty clear, and about as intuitive as it gets. Trying to use an empty string for anything else just means it's not availble to represent itself. any other DB using anything else is complicating things Now, for exports/dumps that don't use the ' char to delineate the start and begin of a column, i.e. 454wetoit,Four score and seven years ago,default,, what would the last three values be? Empty strings would be my guess. '454wetoit','Four score and seven years ago','default','','' seems like quoted column values would be necessary to distinguish the constants NULL and default from strings that contain those two text sequences. 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? > > 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 ''; > > > > ---------------------------(end of broadcast)--------------------------- > TIP 7: don't forget to increase your free space map settings >