Bug #119827 UPDATE error = 1048,column ‘work_record_id’ cannot be null
Submitted: 1 Feb 20:23 Modified: 3 Mar 12:12
Reporter: wenxiang wang Email Updates:
Status: No Feedback Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:5.7.29 OS:Any
Assigned to: CPU Architecture:Any

[1 Feb 20:23] wenxiang wang
Description:
CREATE TABLE `seven_fresh_wms_picker_di` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  `sts_date` date NOT NULL DEFAULT '2000-01-01' COMMENT '日期',
  `shop_cd` varchar(255) NOT NULL DEFAULT '' COMMENT '店铺编码',
  `shop_name` varchar(255) NOT NULL DEFAULT '' COMMENT '店铺名称',
  `pick_by` varchar(255) NOT NULL DEFAULT '' COMMENT '拣货员pin',
  `pick_by_name` varchar(255) NOT NULL DEFAULT '' COMMENT '拣货员',
  `pick_by_hour` decimal(10,3) NOT NULL DEFAULT '0.000' COMMENT '出勤小时数',
  `sku_num` bigint(20) NOT NULL DEFAULT '0' COMMENT '商品行数',
  `pick_mins` decimal(10,3) NOT NULL DEFAULT '0.000' COMMENT '拣货时长',
  `pkt_no_num` bigint(20) NOT NULL DEFAULT '0' COMMENT '拣货单数',
  `ord_num` bigint(20) NOT NULL DEFAULT '0' COMMENT '拣货订单数',
  `pick_num` bigint(20) NOT NULL DEFAULT '0' COMMENT '拣货件数',
  `tenant_id` bigint(20) NOT NULL DEFAULT '0' COMMENT '租户ID',
  `work_record_id` bigint(20) NOT NULL DEFAULT '0' COMMENT '工作量记录ID',
  `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  `is_valid` tinyint(4) NOT NULL DEFAULT '1' COMMENT '1-有效、0-无效',
  PRIMARY KEY (`id`),
  KEY `idx_create_time` (`create_time`) USING BTREE,
  KEY `idx_update_time` (`update_time`) USING BTREE,
  KEY `idx_work_record_id` (`work_record_id`) USING BTREE,
  KEY `idx_date_shop_picker` (`sts_date`,`shop_cd`,`pick_by`) USING BTREE,
  KEY `idx_picker_date` (`pick_by`,`sts_date`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=804080 DEFAULT CHARSET=utf8mb4 COMMENT='拣货员汇总表(中间表)'
序号	Trigger	Event	Table	Statement	Timing	Created	sql_mode	Definer	character_set_client	collation_connection	Database Collation	
1	
No trigger

"_source": {
    "Database": "crowdsourcing_works",
    "Tables": "seven_fresh_wms_picker_di",
    "ThreadId": 0,
    "SqlType": "UPDATE",
    "SqlFinger": "UPDATE `seven_fresh_wms_picker_di` SET `work_record_id`=? WHERE `id`=? AND `work_record_id`=? AND `is_valid`=?",
    "SqlHash": "5427cf742460b40316e9ce12e0368b9c5ea4fc23",
    "SqlInfo": "UPDATE seven_fresh_wms_picker_di\n        SET work_record_id = 10214613\n        WHERE id = 802749\n          AND work_record_id = 0\n          AND is_valid = 1",
    "CreateTime": "2026-01-31T05:53:00.979912528+08:00",
    "ExecuteTime": 0,
    "AffectedRows": 0,
    "ReturnCode": "1048",
    "ExecuteTotal": 242,
    "ValueCount": 0
  },

How to repeat:
i do not known,Occasionally occurred!
In a relatively large MySQL transaction
[1 Feb 20:26] wenxiang wang
sql_mode
STRICT_TRANS_TABLES
	
transaction_isolation
READ-COMMITTED
[1 Feb 20:28] wenxiang wang
My Java program takes 10 milliseconds to execute. It still fails after three attempts.
[3 Feb 12:12] Roy Lyseng
Thank you for the bug report.
However, in order to investigate this problem,
we need a fully reproducible test case.
Note also that 5.7 is no longer a supported version,
we recommend upgrading to 8.4, or at least 8.0.
[4 Mar 1:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".