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

Re: copy error

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Keith Worthington <keithw(at)narrowpathinc(dot)com>
Cc: PostgreSQL Novice <pgsql-novice(at)postgresql(dot)org>
Subject: Re: copy error
Date: 2004-10-14 19:46:47
Message-ID: 20041014194647.GA96236@winnie.fuhr.org (view raw or flat)
Thread:
Lists: pgsql-novice
On Thu, Oct 14, 2004 at 02:12:49PM -0400, Keith Worthington wrote:

> 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/

In response to

  • copy error at 2004-10-14 18:12:49 from Keith Worthington

Responses

pgsql-novice by date

Next:From: Michael FuhrDate: 2004-10-14 20:02:22
Subject: Re: Looking for correct SQL
Previous:From: Alexander PucherDate: 2004-10-14 19:46:33
Subject: Looking for correct SQL

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