Skip to content
This repository was archived by the owner on Mar 24, 2022. It is now read-only.
This repository was archived by the owner on Mar 24, 2022. It is now read-only.

COUNT(*) bug #212

@pateljm

Description

@pateljm

The following sequence of queries give surprising results:

CREATE TABLE Foo (a INT, b INT);
CREATE TABLE Bar (a INT, b INT);
INSERT INTO Foo SELECT i, i%2 FROM generate_series(0, 1) AS gs(i);
INSERT INTO Bar SELECT i, i%2 FROM generate_series(0, 1) AS gs(i);

SELECT COUNT(a) FROM (SELECT Foo.a FROM Foo, Bar WHERE Foo.a = Bar.b) AS A(a);
SELECT COUNT(*) FROM (SELECT Foo.a FROM Foo, Bar WHERE Foo.a = Bar.b) AS A(a);

The second SELECT query returns 0 instead of 2.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions