我正在尝试导入 CSV,但最近一直遇到错误:
ERROR: invalid input syntax for integer: ""
CONTEXT: COPY locations, line 1, column ext: ""
我对此仍然很陌生,但据我所知,它似乎没有null
用于任何空白整数列。任何帮助,将不胜感激。
以下是 CSV 中的几行:
1 STOP ELECTRONICS CENTER,1100 CONEY ISLAND AVENUE,BROOKLYN,NY,11230,USA,7182491201,,,,
1 STOP FURNITURE WAREHOUSE,9050 KENMAR DR.,SAN DIEGO,CA,92121,USA,8582719400,,,,
309 OFFICE FURNITURE,1711 BETHLEHEM PARK,HATFIELD,PA,19440,USA,2158223333,,,,
"A & W OFFICE SUPPLY & DESIGN, INC.",10653 DUTCHTOWN ROAD,KNOXVILLE,TN,37932,USA,8656758532,,,,
这是我正在使用的 COPY 命令:
COPY locations(name, address, city, province, postal_code, country, phone, ext, phone_alt, ext_alt, url) FROM '/Volumes/Data/Users/me/Dealers.csv' WITH (FORMAT csv, DELIMITER ',', NULL 'NULL');
这是我的位置表:
Table "public.locations"
Column | Type | Modifiers
-------------+-----------------------------+--------------------------------------------------------
id | integer | not null default nextval('locations_id_seq'::regclass)
name | character varying(255) |
address | character varying(255) |
city | character varying(255) |
province | character varying(255) |
postal_code | character varying(255) |
country | character varying(255) |
phone | bigint |
ext | bigint |
phone_alt | bigint |
ext_alt | bigint |
latitude | double precision |
longitude | double precision |
created_at | timestamp without time zone | not null
updated_at | timestamp without time zone | not null
url | character varying(255) |
Indexes:
"locations_pkey" PRIMARY KEY, btree (id)