dbTalk Databases Forums  

copy error

comp.databases.postgresql.novice comp.databases.postgresql.novice


Discuss copy error in the comp.databases.postgresql.novice forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Keith Worthington
 
Posts: n/a

Default copy error - 10-14-2004 , 01:12 PM






Hi All,

I am trying to load a file into a database. The file in part looks like this.

10000,Citizens Bank Checking Account,0,TRUE
10001,Peoples Bank Operating Account,0,FALSE

I issue a copy command as follows and get the error as shown.

# copy myschema.tbl_account from '/dirname/Account.csv' with delimiter ',';
'RROR: copy: line 1, Bad boolean external representation 'TRUE
IPADB=#

What am I doing wrong?

Kind Regards,
Keith

______________________________________________
99main Internet Services http://www.99main.com


---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html


Reply With Quote
  #2  
Old   
Michael Fuhr
 
Posts: n/a

Default Re: copy error - 10-14-2004 , 02:46 PM






On Thu, Oct 14, 2004 at 02:12:49PM -0400, Keith Worthington wrote:

Quote:
I am trying to load a file into a database. The file in part looks like this.

10000,Citizens Bank Checking Account,0,TRUE
10001,Peoples Bank Operating Account,0,FALSE

I issue a copy command as follows and get the error as shown.

# copy myschema.tbl_account from '/dirname/Account.csv' with delimiter ',';
'RROR: copy: line 1, Bad boolean external representation 'TRUE
IPADB=#
I'd guess that there's a carriage return at the end of line 1. The
single quote at the beginning of the line supports this hypothesis:
that's exactly what would happen if 'TRUE\r' were printed.

You might need to run your data through a filter before importing
it into PostgreSQL. Some systems have a dos2unix program; you could
also use tr, sed, perl, awk, etc. to strip trailing carriage returns.

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match



Reply With Quote
  #3  
Old   
Tom Lane
 
Posts: n/a

Default Re: copy error - 10-15-2004 , 09:55 AM



Michael Fuhr <mike (AT) fuhr (DOT) org> writes:
Quote:
I'd guess that there's a carriage return at the end of line 1.
Looks like that to me too.

Quote:
You might need to run your data through a filter before importing
it into PostgreSQL. Some systems have a dos2unix program; you could
also use tr, sed, perl, awk, etc. to strip trailing carriage returns.
Alternatively, update to PG 7.4 or later. Since 7.4 COPY will attempt
to Do The Right Thing with files containing Windows-style newlines.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo (AT) postgresql (DOT) org so that your
message can get through to the mailing list cleanly



Reply With Quote
  #4  
Old   
Keith Worthington
 
Posts: n/a

Default Re: copy error - 10-15-2004 , 10:07 AM



Quote:
Michael Fuhr <mike (AT) fuhr (DOT) org> writes:
I'd guess that there's a carriage return at the end of line 1.

Looks like that to me too.

You might need to run your data through a filter before importing
it into PostgreSQL. Some systems have a dos2unix program; you could
also use tr, sed, perl, awk, etc. to strip trailing carriage returns.

Alternatively, update to PG 7.4 or later. Since 7.4 COPY will
attempt to Do The Right Thing with files containing Windows-style newlines.

regards, tom lane
It turns out there was a carrige return at the end of every line. Thasnk for
the help.

Kind Regards,
Keith

______________________________________________
99main Internet Services http://www.99main.com


---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.