我需要将 csv 文件上传到 postgresql 数据库表。csv文件如
A B C D E F
16777216 16777471 AU AUSTRALIA OC OCEANIA
16777472 16778239 CN CHINA AS ASIA
16778240 16779263 AU AUSTRALIA OC OCEANIA
16779264 16781311 CN CHINA AS ASIA
桌子是
CREATE TABLE ipligence
(
ip_from numeric(11,0) NOT NULL DEFAULT 0,
ip_to numeric(11,0) NOT NULL DEFAULT 0,
country_code character varying(10)[] NOT NULL,
country_name character varying(225)[] NOT NULL,
continent_code character varying(10)[] NOT NULL,
continent_name character varying(255)[] NOT NULL,
CONSTRAINT ipligence_pkey PRIMARY KEY (ip_to )
)
WITH (
OIDS=FALSE
);
ALTER TABLE ipligence
我在 pgsql 中使用复制命令,
copy ipligence
from '/home/pgsql/ipligence-lite.csv'
delimiter as ','
csv quote as '"';
但它显示
ERROR: array value must start with "{" or dimension information
CONTEXT: COPY ipligence, line 1, column country_code: "AU"
我怎样才能成功地将 csv 文件输入到 postgresql 数据库中。谢谢!