Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.Original topic: 从6.1.2升级到7.1.1后,执行SQL报index out of range [0] with length 0
[TiDB Usage Environment] Production Environment
[TiDB Version] 7.1.1
[Encountered Problem: Problem Phenomenon and Impact]
SQL:
select d.*,group_concat(wi.wc_person_name) Talent Selection
from (
select suser.realName Owner,
base.id baseid,
luser.realName Entry Person,
resuser.realName Applicant,
sdept.d4 Region,
sdept.d5 Branch,
concat_ws('/', sdept.d4, sdept.d5, sdept.d6, sdept.d7) Department,
contract_no,
price Contract Amount,
kickback Consultation Fee,
FROM_UNIXTIME(contract_signing_time) Signing Time,
case
when base.state = 2
then 'Signed'
when base.state = 3
then 'Contract in Execution'
end as Contract Status,
ent_name Company Name,
ent_linkman Contact Person,
config.name Operation Status,
config2.name Fund Verification Status,
FROM_UNIXTIME(xxf.create_time) Application Time,
# xxf.state Operation Status,
xxf.transfer_price Performance Transfer Amount,
(select sum(transfer_price)
from kl_conm_account
where qconmid = base.id
and state in (12, 14)
and conmid = 0) Total Amount Recorded,
base.id
from ods_oa.kl_conm_base base
left join ods_oa.kl_users suser on base.ouid = suser.ID
left join ods_oa.kl_users luser on base.uid = luser.ID
left join ods_oa.dept_ext sdept on sdept.id = suser.DEPARTMENTID
left join kl_conm_ycenterprise qy on qy.conmid = base.id
left join kl_conm_account_xxf xxf on xxf.conmid = base.id
left join kl_conm_account_result res on res.cid = base.id and is_zx = 2
left join kl_status_config config on config.id = xxf.state
left join kl_status_config config2 on config2.id = entry_status
left join ods_oa.kl_users resuser on resuser.id = xxf.uid
where suser.realName in (
select Owner
from (
select suser.realName Owner
from ods_oa.kl_conm_base base
left join ods_oa.kl_users suser on base.ouid = suser.ID
left join kl_conm_account_xxf xxf on xxf.conmid = base.id
where contract_no like '%Q%'
and xxf.transfer_price > 0
group by contract_no
) t
group by t.Owner
having count(t.Owner) > 1
)
and contract_no like '%Q%'
and xxf.transfer_price > 0
group by contract_no, suser.realName
order by suser.realName) d
left join kl_conm_ycenterprise_withcert wi on wi.conmid = d.baseid
group by d.contract_no, Owner
order by Owner
If I reduce the number of fields in d., the error will not occur, but if the number of fields in d. reaches a certain number, it will report index out of range again.