Re: importing db as text files

Поиск
Список
Период
Сортировка
От Jason Godden
Тема Re: importing db as text files
Дата
Msg-id 200308141450.41485.jasongodden@optushome.com.au
обсуждение исходный текст
Ответ на Re: importing db as text files  (expect <expect@ihubbell.com>)
Ответы Re: importing db as text files  (Bruno Wolff III <bruno@wolff.to>)
Список pgsql-general
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

В списке pgsql-general по дате отправления:

Предыдущее
От: Mike Mascari
Дата:
Сообщение: Re: Why the duplicate messages to pgsql-general?
Следующее
От: expect
Дата:
Сообщение: Re: Why the duplicate messages to pgsql-general?