无法在PostgreSQL中加载CSV文件 [英] unable to load CSV file in Postgresql

查看:174
本文介绍了无法在PostgreSQL中加载CSV文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是PostgresSQL的新手,我正尝试加载以下格式的数据:

I am new to PostgresSQL and i am trying to load a data of the following format:


1,57000000000A,A,EN,0:01,male,hahaha,"Address is address",1234567,Not Applicable,,
walk in and 
scream,papa,00:20:54,02:17:41,ABC,00:20:54,02:17:41,musical,farm,,cody,9,bad 
boy,,,,,X,,rest,,,musical is muscal,John Kotters ,,,2011-01-01

记录超过1万,某些列可能包含NULL数据。当我尝试执行此操作时:

There are more than 10k records and some columns may have NULL data. When i try to do this:

COPY ane FROM 'C:/Program Files (x86)/PostgreSQL/8.4/csv-data/my-data.csv' WITH
DELIMITER ',';

我收到以下错误:错误:最后一个预期的列
之后的额外数据SQL状态:22P04

I am getting the following error:ERROR: extra data after last expected column SQL state: 22P04

我已经检查了列,它们还可以。

I have checked the columns and they are ok. This means that no columns are left out.

希望有人可以提供帮助。

Hope someone can help. Advance thanks.

推荐答案

应该是

 COPY ane FROM 'C:/Program Files (x86)/PostgreSQL/8.4/csv-data/my-data.csv' WITH
 DELIMITER ',' CSV;

对我有用

这篇关于无法在PostgreSQL中加载CSV文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆