Skip to content

[Bug] orca count bug #1309

@yjhjstz

Description

@yjhjstz

Apache Cloudberry version

main

What happened

orca result error

What you think should happen instead

No response

How to reproduce

CREATE TABLE count_empty (a int, b int);
CREATE TABLE count_one (a int, b int);
INSERT INTO count_one VALUES (0, 0);

-- optimizer=off:
SET optimizer=off;
SELECT *
FROM count_one
WHERE count_one.a IN (
SELECT COUNT(*)
FROM count_empty
WHERE count_one.b = count_empty.b
);
a | b
---+---
0 | 0
(1 row)

-- optimizer=on:
SET optimizer=on;
SELECT *
FROM count_one
WHERE count_one.a IN (
SELECT COUNT(*)
FROM count_empty
WHERE count_one.b = count_empty.b
);
a | b
---+---
(0 rows)

Operating System

centos 9

Anything else

No response

Are you willing to submit PR?

  • Yes, I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: BugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions