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

Re: Trouble w/ COPY command

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Wells Oliver <wellsoliver(at)gmail(dot)com>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: Trouble w/ COPY command
Date: 2012-04-15 00:01:02
Message-ID: 19492.1334448062@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-admin
Wells Oliver <wellsoliver(at)gmail(dot)com> writes:
> I have CSV files blowing up because they have double quotes around numeric
> values: " 1.34" yields ERROR:  invalid input syntax for type numeric: "
> 1.34"

Is that an exact copy of the error message?  Because there are double
quotes in that error message's text; what you are showing does not
suggest that they are part of the data value.  I'm wondering about
non-visible characters myself.

> And occasionally these are empty, and you see invalid syntax for type
> numeric: " "

Well, that you're going to have to do something else about.  Possibly
you could treat the empty string as null?  (See the 'null string'
option to COPY.)

			regards, tom lane

In response to

pgsql-admin by date

Next:From: Rural HunterDate: 2012-04-15 05:32:53
Subject: Re: invalid byte sequence for encoding "UTF8": 0xf481 - how could this happen?
Previous:From: Greg WilliamsonDate: 2012-04-14 23:17:07
Subject: Re: Trouble w/ COPY command

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