Skip to content

Confusing (wrong) error message. #4222

Closed

Description

@den-crane
SELECT v.x, r.a, sum(c)
FROM (select 1 x, 2 c) AS v 
ANY LEFT JOIN (SELECT 1 x, 2 a) AS r ON v.x = r.x
GROUP BY v.x

DB::Exception: Not found column a in block. There are only columns: x, sum(c).

Expected:
DB::Exception: Column r.a is not under aggregate function and not in GROUP BY..

Activity

  1. changed the title [-]Confusing (wrong error) message.[/-] [+]Confusing (wrong) error message.[/+] on Feb 1, 2019
  2. added
    comp-joins
    on May 11, 2019
  3. den-crane commented on Oct 20, 2019

    @den-crane
    ContributorAuthor

    .

  4. qoega commented on Apr 13, 2020

    @qoega
    Member

    Reproducing in 20.4
    How to reproduce

    SELECT
        dummy,
        x
    FROM system.one
    ANY LEFT JOIN
    (
        SELECT
            dummy,
            materialize(1) AS x
    ) AS t2 USING (dummy)
    GROUP BY dummy

    DB::Exception: Not found column x in block. There are only columns: dummy.

    Expected behavior

    SELECT
        a,
        b
    FROM
    (
        SELECT
            number AS a,
            number + 1 AS b
        FROM system.numbers
        LIMIT 10
    )
    GROUP BY a

    DB::Exception: Column b is not under aggregate function and not in GROUP BY.

    Additional context
    Correct query - any(x) instead of x

    SELECT
        dummy,
        any(x)
    FROM system.one
    ANY LEFT JOIN
    (
        SELECT
            dummy,
            materialize(1) AS x
    ) AS t2 USING (dummy)
    GROUP BY dummy
    
    ┌─dummy─┬─any(x)─┐
    │     0 │      1 │
    └───────┴────────┘
  5. deleted a comment from stale on Apr 13, 2020
  6. removed their assignment
    on Oct 16, 2020
  7. alexey-milovidov commented on Oct 19, 2022

    @alexey-milovidov
    Member
  8. added a commit that references this issue on Apr 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    comp-joinsusability

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions