Skip site navigation (1) Skip section navigation (2)

Re: Copy From problem

From: Nabil Sayegh <postgresql(at)e-trolley(dot)de>
To: Eduardo Vázquez Rodríguez <evazquez(at)insys-corp(dot)com(dot)mx>
Cc: "'pgsql-novice(at)postgresql(dot)org'" <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Copy From problem
Date: 2004-05-24 18:31:21
Message-ID: 40B23F79.4050604@e-trolley.de (view raw or flat)
Thread:
Lists: pgsql-novice
Eduardo Vázquez Rodríguez wrote:
> Hi I try to "copy from" a plain text file that looks someting like this:
> 
> John Red (\t) Garden Grove (\t) jwayne(at)garden(dot)com
> Jessie Rodriguez (\t) West Beach
> Jane Harrison (\t) Malibu (\t) jharrison(at)malibu(dot)com
> 
> Deliberately I missed the email info in the second line, I try to copy into
> a table that has the following structure:
> 
> CREATE TABLE public."Example"
> (
>   "Name" varchar(30),
>   "Adress" varchar(60),
>   "Email" varchar(30),
> ) WITHOUT OIDS;

> My question is how can I insert a null value into the field email,and that
> "copy from" continue copying the next lines?

In recent versions you can specify the columns to import.

COPY "Example" ("Name", "Adress") FROM ...

or somethign like that.

BTW: I suggest not using uppercase table/field-names.
It's too much hazzle always having to quote table and field names ;)

HTH
-- 
  e-Trolley Sayegh & John, Nabil Sayegh
  Tel.: 0700 etrolley /// 0700 38765539
  Fax.: +49 69 8299381-8
  PGP : http://www.e-trolley.de

In response to

pgsql-novice by date

Next:From: Glenn_WiensDate: 2004-05-24 21:24:25
Subject: Re: Problem with encode() function
Previous:From: Manuel SugawaraDate: 2004-05-24 18:27:51
Subject: Re: Copy From problem

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group