Re: importing db as text files - Mailing list pgsql-general

From Bruno Wolff III
Subject Re: importing db as text files
Date
Msg-id 20030814135725.GE27870@wolff.to
Whole thread Raw
In response to Re: importing db as text files  (Jason Godden <jasongodden@optushome.com.au>)
List pgsql-general
On Thu, Aug 14, 2003 at 14:50:41 +1000,
  Jason Godden <jasongodden@optushome.com.au> 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.

pgsql-general by date:

Previous
From: Bruno Wolff III
Date:
Subject: Re: importing db as text files
Next
From: Bruno Wolff III
Date:
Subject: Re: query tuning