pingcap / pingcap/tidb

Recursive CTE returns error "invalid type 6"

Open
#48,778 5 comments 0 reactions 1 assignee Claimed by @wjhuang2016 View on GitHub
may-affects-5.3 may-affects-5.4 may-affects-6.1 may-affects-6.5 may-affects-7.1 may-affects-7.5 severity/moderate sig/sql-infra type/bug
Dominant language
Go
Stars
40.5k
Forks
6.2k
PR merge metrics
PR metrics pending

Description

## Bug Report

Please answer these questions before submitting your issue. Thanks!

### 1. Minimal reproduce step (Required)

```SQL
CREATE TABLE `9deb5f03` (
`78e52c17` tinytext DEFAULT NULL,
`7b40192e` decimal(36,25) DEFAULT '-55120128551.7265761088217869999048086'
) ENGINE=InnoDB DEFAULT CHARSET=ascii COLLATE=ascii_bin COMMENT='45cb465e';

INSERT INTO `9deb5f03` VALUES
('EIz_rti20',6.8900000000000000000000000),
('ve7kl',0.5700000000000000000000000),
('e^iH',80.0000000000000000000000000),
('bqm3sfG3*',5.6343000000000000000000000);

with recursive cte_1 ( col_1,col_2,col_3 ) AS ( select 1, 645777089,null from `b28f73fe` UNION DISTINCT select col_1 + 1,concat(col_3, 1),col_2+1 from cte_1 where col_1 < 5 ) ,cte_2 ( col_4,col_5,col_6 ) AS ( select 1, 2318589258,'Eee峗俔e牲骜怘K^CJa乁茉' from `9deb5f03` UNION select col_4 + 1,col_5+1,concat(col_6, 1) from cte_2 where col_4 < 5 limit 11 ) ( select 1,cte_as_3.col_4,cte_as_3.col_5,cte_as_3.col_6,cte_as_4.col_1,cte_as_4.col_2,cte_as_4.col_3 from cte_2 as cte_as_3,cte_1 as cte_as_4 order by 1,2,3,4,5,6,7 limit 18 );
```
### 2. What did you expect to see? (Required)

No error

### 3. What did you see instead (Required)
```
ERROR 8057 (HY000): invalid type 6
```
### 4. What is your TiDB version? (Required)

Release Version: v7.4.0
Edition: Community
Git Commit Hash: 38cb4f3312be9199a983c0ef282d2ea2e28a7824
Git Branch: heads/refs/tags/v7.4.0
UTC Build Time: 2023-10-10 14:10:02
GoVersion: go1.21.0
Race Enabled: false
Check Table Before Drop: false
Store: tikv

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.