Re: importing db as text files

From: expect <expect(at)ihubbell(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: importing db as text files
Date: 2003-08-15 15:35:44
Message-ID: 20030815083544.6657322a.expect@ihubbell.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, 15 Aug 2003 08:03:04 -0700 (PDT)
Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com> wrote:

> On Fri, 15 Aug 2003, expect wrote:
>
> > On Fri, 15 Aug 2003 00:32:01 -0700 (PDT)
> > Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com> wrote:
> >
> > >
> > > On Thu, 14 Aug 2003, expect wrote:
> > >
> > > > On Thu, 14 Aug 2003 12:46:07 -0500
> > > > Bruno Wolff III <bruno(at)wolff(dot)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?

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.

>
>
>
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ron Johnson 2003-08-15 15:36:04 Re: Why the duplicate messages to pgsql-general?
Previous Message Murthy Kambhampaty 2003-08-15 15:35:12 Re: importing db as text files