pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Dennis Gearon <gearond@cvc.net>
To: Stephan Szabo <sszabo@megazone.bigpanda.com>
Cc: expect <expect@ihubbell.com>
Cc: pgsql-general@postgresql.org
Subject: Re: importing db as text files
Date: Fri, 15 Aug 2003 09:14:35 -0700
Message-ID: <3F3D06EB.9010001@cvc.net> (raw)
In-Reply-To: <20030815075948.I19338-100000@megazone.bigpanda.com>
References: <20030815075948.I19338-100000@megazone.bigpanda.com>

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 <sszabo@megazone.bigpanda.com> wrote:
>>
>>
>>>On Thu, 14 Aug 2003, expect wrote:
>>>
>>>
>>>>On Thu, 14 Aug 2003 12:46:07 -0500
>>>>Bruno Wolff III <bruno@wolff.to> 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
> 




view thread (32+ messages)  latest in thread

Message-ID: <3F3D06EB.9010001@cvc.net>
Permalink:  ../3F3D06EB.9010001@cvc.net/
Also on:    postgresql.org/message-id/3F3D06EB.9010001@cvc.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: gearond@cvc.net, sszabo@megazone.bigpanda.com, expect@ihubbell.com
  Subject: Re: importing db as text files
  In-Reply-To: <3F3D06EB.9010001@cvc.net>
  References: <20030815075948.I19338-100000@megazone.bigpanda.com> <3F3D06EB.9010001@cvc.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox