gpt4 book ai didi

mysql: 插入操作错误 "data too long "

转载 作者:行者123 更新时间:2023-11-30 22:05:54 25 4
gpt4 key购买 nike

在mysql中,创建一个表:

CREATE TABLE fb_group_feed (
Post_ID varchar(64),
Permalink varchar(128),
Create_time varchar(32),
Updated_time varchar(32),
Author varchar(32),
Author_ID bigint,
Message text,
Link varchar(1024),
Likes int,
Comments int,
group_ID bigint,
foreign key(group_ID) references fb_group_info(ID)
)

向该表插入一行数据时,出现错误:

INSERT INTO fb_group_feed VALUES (
'1610393525875114_1842755835972214','https://www.facebook.com/groups/1610393525875114/permalink/1842755835972214/',
'2017-01-22T17:12:41+0000','2017-01-23T00:45:16+0000','Chibura Hakkai',457297014658600,
'Pretty hands he has... credit Wilma Alberti',
'https://www.facebook.com/photo.php?fbid=466756323712669&set=gm.1842755835972214&type=3',
175,7,1610393525875114)

错误:

 Error 1406(22001): "Data too long for column 'Post_ID' at row 1")

但我已经设置了'Post_ID' varchar(64),我认为它足够长了。你能帮忙吗

最佳答案

首先您应该做的是describe fb_group_feed,它会告诉您列的当前顺序,如果您不这样做,这就是用于插入的顺序明确指定那些列。根据 doco :

If you do not specify a list of column names for INSERT ... VALUES or INSERT ... SELECT, values for every column in the table must be provided by the VALUES list or the SELECT statement. If you do not know the order of the columns in the table, use DESCRIBE tbl_name to find out.

或者(更安全)是使用显式形式:

INSERT INTO fb_group_feed (
Post_ID,
Permalink,
<other columns>
) VALUES (
'1610393525875114_1842755835972214',
'https://www.facebook.com/groups/blah/blah/blah/',
<other values>
)

关于mysql: 插入操作错误 "data too long ",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41797899/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com