Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

planner: invalid pointer caused by a recursive CTE query #54449

Closed
qw4990 opened this issue Jul 4, 2024 · 1 comment · Fixed by #54450
Closed

planner: invalid pointer caused by a recursive CTE query #54449

qw4990 opened this issue Jul 4, 2024 · 1 comment · Fixed by #54450
Assignees
Labels
affects-6.5 This bug affects the 6.5.x(LTS) versions. affects-7.1 This bug affects the 7.1.x(LTS) versions. affects-7.5 This bug affects the 7.5.x(LTS) versions. affects-8.1 This bug affects the 8.1.x(LTS) versions. impact/panic severity/major sig/planner SIG: Planner type/bug The issue is confirmed as a bug.

Comments

@qw4990
Copy link
Contributor

qw4990 commented Jul 4, 2024

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

CREATE TABLE `p` (
  `groupid` bigint(20) DEFAULT NULL,
  KEY `k1` (`groupid`)
);


CREATE TABLE `g` (
  `groupid` bigint(20) DEFAULT NULL,
  `parentid` bigint(20) NOT NULL,
  KEY `k1` (`parentid`),
  KEY `k2` (`groupid`,`parentid`)
);

set tidb_opt_enable_hash_join=off;

WITH RECURSIVE w(gid) AS (
  SELECT
    groupId
  FROM
    p
  UNION
  SELECT
    g.groupId
  FROM
    g
    JOIN w ON g.parentId = w.gid
)
SELECT
  1
FROM
  g
WHERE
  g.groupId IN (
    SELECT
      gid
    FROM
      w
  );

2. What did you expect to see? (Required)

no error

3. What did you see instead (Required)

ERROR 1105 (HY000): runtime error: invalid memory address or nil pointer dereference

4. What is your TiDB version? (Required)

Master

@hawkingrei
Copy link
Member

maybe the same as #54072

@ti-chi-bot ti-chi-bot added affects-7.5 This bug affects the 7.5.x(LTS) versions. affects-8.1 This bug affects the 8.1.x(LTS) versions. affects-6.5 This bug affects the 6.5.x(LTS) versions. affects-7.1 This bug affects the 7.1.x(LTS) versions. and removed may-affects-7.5 may-affects-6.5 may-affects-8.1 may-affects-7.1 labels Jul 9, 2024
@hawkingrei hawkingrei added affects-6.5 This bug affects the 6.5.x(LTS) versions. and removed may-affects-5.4 This bug maybe affects 5.4.x versions. may-affects-6.1 affects-6.5 This bug affects the 6.5.x(LTS) versions. labels Jul 17, 2024
@ti-chi-bot ti-chi-bot bot closed this as completed in 156f23a Jul 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-6.5 This bug affects the 6.5.x(LTS) versions. affects-7.1 This bug affects the 7.1.x(LTS) versions. affects-7.5 This bug affects the 7.5.x(LTS) versions. affects-8.1 This bug affects the 8.1.x(LTS) versions. impact/panic severity/major sig/planner SIG: Planner type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants