pingcap / pingcap/tidb

recursive cte returns invalid type 6

Open
#40,323 0 comments 0 reactions 1 assignee Claimed by @xiongjiwei View on GitHub
fuzz/schrddl 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 `e638a30b-01a5-41f7-a3c4-fc5b8e91c080` (
`09aae2bf-433a-4356-b15e-2da9fde724ef` varchar(25) DEFAULT 'nosh5qussphq14',
`c27b7674-24f0-434e-97de-bc3126b74b08` year(4) DEFAULT '2053'
);
CREATE TABLE `afc9484d-7e41-4240-8097-befb4abb7bbc` (
`a0a2dbc1-f3db-4a8f-9ae1-e36b66883220` mediumint(9) DEFAULT '6380173',
`3534d6e6-2aa4-4ce9-8580-117a54594161` tinyint(4) NOT NULL DEFAULT '-26',
PRIMARY KEY (`3534d6e6-2aa4-4ce9-8580-117a54594161`) /*T![clustered_index] CLUSTERED */,
KEY `ea77e784-e310-4c6e-af4d-2e058da53907` (`a0a2dbc1-f3db-4a8f-9ae1-e36b66883220`),
UNIQUE KEY `4514675b-775b-4820-bd18-1563d1a9442d` (`a0a2dbc1-f3db-4a8f-9ae1-e36b66883220`,`3534d6e6-2aa4-4ce9-8580-117a54594161`),
UNIQUE KEY `bba9a7e0-4b07-44da-92da-58651a024dc1` (`3534d6e6-2aa4-4ce9-8580-117a54594161`)
) ENGINE=InnoDB DEFAULT CHARSET=gbk COLLATE=gbk_chinese_ci;
INSERT INTO `e638a30b-01a5-41f7-a3c4-fc5b8e91c080` VALUES ('_xdlh=',2021),('_xdlh=',2021),('_xdlh=',2021),('_xdlh=',2021),('_xdlh=',2021),('_xdlh=',2021),('_xdlh=',2021),('_xdlh=',2021),('_xdlh=',1979),('_xdlh=',2021),('_xdlh=',2011),('_xdlh=',2024),('_xdlh=',1979),('_xdlh=',2016),('_xdlh=',2024),('_xdlh=',2003),('q8its3h2jcxh1',1961);
INSERT INTO `afc9484d-7e41-4240-8097-befb4abb7bbc` VALUES (6380173,-128),(2026965,-121),(6380173,-116),(2026965,-70),(2026965,-64),(2026965,-59),(2026965,-55),(2026965,-48),(7772134,-34),(2026965,-19),(2026965,0),(2026965,1),(2026965,8),(2026965,16),(2026965,29),(2026965,32),(2026965,35),(2026965,50),(2026965,72),(2026965,84),(2026965,98),(2026965,127);
with recursive cte_1 ( col_1,col_2,col_3,col_4 ) AS ( select 1, 1+1,null,'' from `e638a30b-01a5-41f7-a3c4-fc5b8e91c080` UNION DISTINCT select col_1 + 1,concat(col_3, 1),col_2+1,concat(col_4, 1) from cte_1 where col_1 < 5 limit 6 ) ,cte_2 ( col_5,col_6,col_7 ) AS ( select 1, '~XSDD+','' from `afc9484d-7e41-4240-8097-befb4abb7bbc` UNION ALL select col_5 + 1,concat(col_6, 1),concat(col_7, 1) from cte_2 where col_5 < 5 limit 14 ) ( select 1,cte_as_3.col_5,cte_as_3.col_6,cte_as_3.col_7,cte_as_4.col_1,cte_as_4.col_2,cte_as_4.col_3,cte_as_4.col_4 from cte_2 as cte_as_3,cte_1 as cte_as_4 order by 1,2,3,4,5,6,7,8 limit 17 );
```
### 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)
master

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.