When dealing with 'bigint'or 'int8', the command 'copy'doesn't work

Started by Dong, Mengover 24 years ago2 messagesbugs
Jump to latest
#1Dong, Meng
eddy@securities.com

Hi guys,

I meet a problem when try to import data from a Tab-delimited-text file to a table by command 'copy from'. A sample procedure is explained as follow,

first, I generate a file called /home/temp/test.txt, let's suppose it has only two lines, ( the four figures are delimited by tab)
123 456
789 999

Second, I type the following command under PSQL,
create table ttt ( c1 bigint, c2 bigint);

Finally, I try to import the data from test.txt into table ttt by,
copy ttt from '/home/temp/test.txt';

But I was told,
ERROR: copy: line 1, Bad int8 external representation "'123'"

(My PostgreSQL is v7.1)

I would appreciate any help or advice.

thanks in advance,

Dong, Meng
eddy@securities.com

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Dong, Meng (#1)
Re: When dealing with 'bigint'or 'int8', the command 'copy'doesn't work

"Dong, Meng" <eddy@securities.com> writes:

SGkgZ3V5cywNCg0KSSBtZWV0IGEgcHJvYmxlbSB3aGVuIHRyeSB0byBpbXBv
cnQgZGF0YSBmcm9tIGEgVGFiLWRlbGltaXRlZC10ZXh0IGZpbGUgdG8gYSB0
YWJsZSBieSBjb21tYW5kICdjb3B5IGZyb20nLiBBIHNhbXBsZSBwcm9jZWR1
cmUgaXMgZXhwbGFpbmVkIGFzIGZvbGxvdywNCg0KDQpmaXJzdCwgSSBnZW5l
cmF0ZSBhIGZpbGUgY2FsbGVkICAvaG9tZS90ZW1wL3Rlc3QudHh0LCBsZXQn
[ etc ]

Please don't send HTML mail to the lists.

Although I'm not having any luck quoting your mail, I can tell
you that copying int8 values works fine for me. If the error
message is spelled exactly as you show it, it suggests that's
what's really in your data file is not

123 456

but

'123' '456'

regards, tom lane