Обсуждение: COPY with null

Поиск
Список
Период
Сортировка

COPY with null

От
"Karen Smallwood"
Дата:
I have seen this question asked, but the answer doesn't seem to have worked for the other person or myself.  I have
severalfiles I need to copy into postgres and if I try   
COPY compmstr from '/user/local/testfile' using delimiters '\t' with null as '' (or '\N' or '\t\t' or anything else);
I get ERROR:  copy: line 1, Bad numeric input format '' (or whatever I used).  I am using files that can have numeric
nullsand/or character nulls 

Anyone figure this one out?  I'm on 7.3.2

Karen Smallwood
Programmer/Analyst
Mighty Distributing System of America, Inc.
650 Engineering Drive
Norcross, Georgia 30092
(770) 448-3900
(770) 446-8627 fax


Re: COPY with null

От
Jeff Eckermann
Дата:
--- Karen Smallwood
<Karen.Smallwood@mightyautoparts.com> wrote:
> I have seen this question asked, but the answer
> doesn't seem to have worked for the other person or
> myself.  I have several files I need to copy into
> postgres and if I try
> COPY compmstr from '/user/local/testfile' using
> delimiters '\t' with null as '' (or '\N' or '\t\t'>
or anything else);
> I get ERROR:  copy: line 1, Bad numeric input format
> '' (or whatever I used).  I am using files that can
> have numeric nulls and/or character nulls
>
> Anyone figure this one out?  I'm on 7.3.2

Your first version will definitely handle empty
strings as nulls.
Are you quite sure that what you are seeing as an
empty string really is empty?  i.e. it could be some
other kind of non printing character.

__________________________________
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree