v7.5.2 batch on 命令 报错 Unknown column in 'where clause'

【 TiDB 使用环境】生产环境
是batch 不支持这种写法吗, 去掉l.relate_auth_status = 1 就能跑

BATCH ON leader_manager.link.id LIMIT 10000
INSERT INTO leader_relate_link_store_fox
SELECT
  link.id,
  link.tenant_id,
  link.person_user_id,
  link.link_url,
  link.platform,
  link.relate_shop_id,
  link.relate_shop_name,
  link.relate_product_id,
  link.relate_product_name,
  link.relate_product_img,
  link.relate_product_img_list,
  link.relate_product_img_detail_list,
  link.relate_first_cid,
  link.relate_first_cname,
  link.relate_second_cid,
  link.relate_second_cname,
  link.relate_third_cid,
  link.relate_third_cname,
  link.relate_fourth_cid,
  link.relate_fourth_cname,
  link.relate_brand_id,
  link.relate_brand_name,
  link.relate_spec_live_price,
  link.relate_goods_stock,
  link.relate_spec_sell_num,
  link.relate_product_score,
  link.relate_shop_score,
  link.relate_logistics_score,
  link.relate_activity_id,
  link.relate_activity_name,
  link.relate_promises,
  link.relate_product_status,
  link.relate_activity_product_status,
  link.relate_apply_id,
  link.relate_logistics_info,
  link.relate_view_num,
  link.relate_kol_num,
  link.relate_yesterday_order_num,
  link.relate_order_num,
  link.relate_has_sxt,
  link.service_margin,
  link.commission_margin,
  link.activity_commission_margin,
  link.has_leader_sec,
  link.divide_service_margin_sec,
  link.link_start_time,
  link.link_end_time,
  link.create_time,
  link.update_time,
  link.review_status,
  link.institution_id,
  link.origin_buyin_id,
  link.origin_institution_id,
  link.origin_institution_name,
  link.origin_institution_phone,
  link.origin_activity_id,
  link.partner_type,
  link.partner_shop_id,
  link.partner_shop_name,
  link.local_first_cid,
  link.local_first_cname,
  link.relate_sharable,
  link.sort_weight
FROM
  leader_relate_link link
  LEFT JOIN leader_tenant_institution l ON link.tenant_id = l.tenant_id
WHERE
  relate_activity_product_status = 1
  AND partner_type IN (1, 3)
  AND review_status = 1
  AND relate_product_status = 1
  AND l.relate_auth_status = 1

报错

relate_auth_status确实有这个字段,而且是int型

CREATE TABLE `leader_tenant_institution` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `tenant_id` int(11) NOT NULL COMMENT '租户主键',
  `relate_platform_type` int(5) NOT NULL COMMENT '第三方平台类型 1抖音,3快手',
  `relate_institution_id` varchar(255) DEFAULT NULL COMMENT '第三方团长百应ID',
  `relate_institution_id_really` varchar(255) DEFAULT NULL COMMENT '第三方机构ID(用机构ID取此字段)',
  `relate_institution_name` varchar(255) DEFAULT NULL COMMENT '第三方团长机构名称',
  `relate_auth_time` datetime DEFAULT NULL COMMENT '第三方授权时间',
  `relate_auth_status` int(5) NOT NULL COMMENT '第三方授权状态 0未授权,1授权中,2授权过期,3在第三方平台关停',
  `create_platform` varchar(100) NOT NULL COMMENT '前后台服务类型,client,manager',
  `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `create_operator` varchar(100) NOT NULL COMMENT '创建人',
  `update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  `update_operator` varchar(100) NOT NULL COMMENT '最后修改人',
  `deleted` bigint(20) NOT NULL COMMENT '删除标识,0未删除,非0时间戳已删除',
  PRIMARY KEY (`id`) /*T![clustered_index] CLUSTERED */,
  UNIQUE KEY `uq_tenant_id_relate_institution_id` (`tenant_id`,`relate_platform_type`,`relate_institution_id`),
  KEY `idx_leader_tenant_institution_tenant_id` (`tenant_id`),
  KEY `idx_leader_tenant_institution_relate_institution_id` (`relate_institution_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin AUTO_INCREMENT=1080053 COMMENT='团长平台机构号表'

感觉是个bug啊,改成 inner join试试

select单独执行会报错吗?是不是batch on的把L表的字段也要写到select里

select正常的,只是batch on报错,就算把where字段加到select 里也报错

batch可用dry run看看实际跑的SQL长啥样

这样就能看出问题了

此话题已在最后回复的 60 天后被自动关闭。不再允许新回复。