Re: Looking for postgres equivalent of mysqlimport

From: Sean Davis <sdavis2(at)mail(dot)nih(dot)gov>
To: "M(dot) Bastin" <marcbastin(at)mindspring(dot)com>
Cc: Postgres <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Looking for postgres equivalent of mysqlimport
Date: 2004-09-17 16:31:47
Message-ID: 118C4FCE-08C7-11D9-B5A4-000A95D7BA10@mail.nih.gov
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Marc,

That seemed to get most of the way (setting to NULL). However, it
seems that does not work for integer columns? I'm still getting an
error:

ERROR: invalid input syntax for integer: "NULL"
CONTEXT: COPY cgap_lib,line 1, column clones: "NULL"

Here is the schema:
CREATE TABLE "cgap_lib" (
"cgap_lib_id" character varying(16) NOT NULL,
"organism" character varying(64) NOT NULL,
"libid" character varying(16) NOT NULL,
"unilib_id" character varying(16) NOT NULL,
"descr" character varying(3500),
"keywords" character varying(256),
"clones" smallint,
"strain" character varying(128),
"tissue" character varying(256),
"unique_tissue" character varying(128),
"edit_date" date NOT NULL,
"get_date" date NOT NULL
);

Here is the first line:
cg2_000000027681 Mus musculus 241 78 Mouse liver library liver, normal,
bulk, EST NULL NULL NULL liver 2004-8-17 2004-8-23

Any more insights?

Thanks again,
Sean

On Sep 17, 2004, at 12:15 PM, M. Bastin wrote:

> At 9:37 AM -0400 9/17/04, Sean Davis wrote:
>> Marc,
>>
>> Thanks. That is what I had thought. Another detail--I have fields
>> (including some dates) that include "" (empty fields). What is the
>> best way to deal with those? Should I just convert them to NULL
>> (assuming that was the actual meaning) and then use that as the NULL
>> string in the copy command?
>
> Sean,
>
> I think you could try that. You may leave them empty as well (after
> stripping '"') and use that for NULL with the COPY command.
>
> Marc

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message M. Bastin 2004-09-17 16:37:35 Re: Looking for postgres equivalent of mysqlimport
Previous Message M. Bastin 2004-09-17 16:15:12 Re: Looking for postgres equivalent of mysqlimport