From: Jason Godden <jasongodden@optushome.com.au>
To: expect <expect@ihubbell.com>
Cc: pgsql-general@postgresql.org
Subject: Re: importing db as text files
Date: Thu, 14 Aug 2003 14:50:41 +1000
Message-ID: <200308141450.41485.jasongodden@optushome.com.au> (raw)
In-Reply-To: <20030813211701.031090a6.expect@ihubbell.com>
References: <71E37EF6B7DCC1499CEA0316A2568328DC9819@loki.globexplorer.com>
<20030813211701.031090a6.expect@ihubbell.com>
On Thu, 14 Aug 2003 02:17 pm, expect wrote:
> On Wed, 13 Aug 2003 14:59:29 -0700
>
> "Gregory S. Williamson" <gsw@globexplorer.com> wrote:
> > have to fix missing numeric values (if the column allows nulls why can't
> > the copy command accept an empty field, I wonder?), missing dates. In
> > other cases
>
> This seems to be the question I need answered as well. Does anyone know
> the answer?
Copy can accept an empty field (representing null):
copy datatable from stdin delimiter '\t' null '';
by default pg expects '\N' to mean null but you can override it:
Description: copy data between files and tables
Syntax:
COPY table [ ( column [, ...] ) ]
FROM { 'filename' | stdin }
[ [ WITH ]
[ BINARY ]
[ OIDS ]
[ DELIMITER [ AS ] 'delimiter' ]
[ NULL [ AS ] 'null string' ] ]
COPY table [ ( column [, ...] ) ]
TO { 'filename' | stdout }
[ [ WITH ]
[ BINARY ]
[ OIDS ]
[ DELIMITER [ AS ] 'delimiter' ]
[ NULL [ AS ] 'null string' ] ]
Rgds,
Jason
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: jasongodden@optushome.com.au, expect@ihubbell.com
Subject: Re: importing db as text files
In-Reply-To: <200308141450.41485.jasongodden@optushome.com.au>
References: <71E37EF6B7DCC1499CEA0316A2568328DC9819@loki.globexplorer.com> <20030813211701.031090a6.expect@ihubbell.com> <200308141450.41485.jasongodden@optushome.com.au>
* 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