我正在尝试将csv文件中的值插入到我的postgresql数据库中。 这是我的桌子:
CREATE TABLE AllocatedEICDetail (
Id SERIAL NOT NULL,
EntityCreatedAt timestamp(34) with time zone NOT NULL,
EntityModifiedAt timestamp(34) with time zone NOT NULL,
MRID varchar(250),
DocStatusValue varchar(250),
AttributeInstanceComponent varchar(250),
LongNames varchar(250),
DisplayNames varchar(250),
LastRequestDateAndOrTime timestamp(7),
DeactivateRequestDateAndOrTime timestamp(7),
MarketParticipantStreetAddressCountry varchar(250),
MarketParticipantACERCode varchar(250),
MarketParticipantVATcode varchar(250),
Description varchar(255),
EICParentMarketDocumentMRID varchar(250),
ELCResponsibleMarketParticipantMRID varchar(250),
IsDeleted bool NOT NULL,
CONSTRAINT PK_AllocatedEICDetail
PRIMARY KEY (Id));
以及我要插入的数据:
Id;EntityCreatedAt;EntityModifiedAt;MRID;DocStatusValue;AttributeInstanceComponent;LongNames;DisplayNames;LastRequestDateAndOrTime;DeactivateRequestDateAndOrTime;MarketParticipantStreetAddressCountry;MarketParticipantACERCode;MarketParticipantVATcode;Description;EICParentMarketDocumentMRID;ELCResponsibleMarketParticipantMRID;IsDeleted
47677;2019-04-01 09:26:51.2053104 +00:00;2019-04-01 09:26:51.2053104 +00:00;10T-1001-10010AS;A05;International;Tie Line Koman-KosovoB;L_KOM-KOSB;2018-10-31 00:00:00.0000000;NULL;NULL;;NULL;Tieline;NULL;10XAL-KESH-----J;0
47678;2019-04-01 09:26:51.2053104 +00:00;2019-04-01 09:26:51.2053104 +00:00;24X-LE-TRADING-N;A05;International;LE Trading a.s.;LE-TRADING;2013-12-18 00:00:00.0000000;NULL;SK;;SK2023878747;Trade Responsible Party;NULL;NULL;0
但是当我尝试将csv文件插入pgAdmin 4时,出现此错误:
错误:类型为timestamp的无效输入语法:“ NULL” 上下文:COPY已分配eicdetail,第2行,列deactivaterequestdateandortime:“ NULL”
有什么想法吗?
答案 0 :(得分:0)
该错误消息表示您的输入数据中有一个文字“ NULL”(字符串)。您可能应该尝试将其替换为空值,如下所示:
47677;2019-04-01 09:26:51.2053104 +00:00;2019-04-01 09:26:51.2053104 +00:00;10T-1001-10010AS;A05;International;Tie Line Koman-KosovoB;L_KOM-KOSB;2018-10-31 00:00:00.0000000;;;;;Tieline;;10XAL-KESH-----J;0