Re: Importing CSV File

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: David Blomstrom <david(dot)blomstrom(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Importing CSV File
Date: 2015-10-26 22:17:31
Message-ID: 562EA67B.6020102@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 10/26/2015 02:45 PM, David Blomstrom wrote:
> I tried to import a CSV file into a PostgreSQL table using pgAdmin III.
> I got an error message: "extra data after last column."
>
>
> All my spreadsheets have an "end of data" column that has /r/n in each
> cell. When I import a CSV file into a MySQL table, everything beyond
> /r/n is ignored. Is there some way to tell PostgreSQL to stop at /r/n?

No Postgres will not stop at /r/n. The specifics of what goes on can be
found here:

http://www.postgresql.org/docs/9.4/interactive/sql-copy.html

Short version, you can import a CSV file with fewer fields then the
table you are importing to but not the other way around. There has to be
a place for all the CSV fields in the table.

>
> Thanks.

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David Blomstrom 2015-10-26 22:18:11 Re: Recursive Arrays 101
Previous Message Aaron_Wright 2015-10-26 22:00:14 PAM LDAP CREATE USER