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

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants