Skip to content

Column not found in correlated subquery, when referencing outer column from LEFT JOIN .. ON clause #3945

@lukaseder

Description

@lukaseder

I'm using H2 2.2.224

This query works:

with
  a(a) as (values (1)),
  b(b) as (values (1)),
  c(c) as (values (1))
select 
  a.a,
  (
    select b.b
    from b
    join c
    on b.b = a.a
    and c.c = b.b
  )
from a;

This one doesn't

with
  a(a) as (values (1)),
  b(b) as (values (1)),
  c(c) as (values (1))
select 
  a.a,
  (
    select b.b
    from b
    left join c -- Difference here
    on b.b = a.a
    and c.c = b.b
  )
from a;

The error is:

Column "A.A" not found; SQL statement:

I don't think there's a good reason for A.A being out of scope at that location?

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