Skip to content

Support LATERAL subqueries with outer relation references outside WHERE clause #21201

Open

Description

@neilconway

Describe the bug

We only support LATERAL subqueries that reference the outer relation in their WHERE clause; we should expand this to support more queries.

To Reproduce

No response

Expected behavior

No response

Additional context

No response

Activity

  1. added theissue type on Mar 27, 2026
  2. neilconway commented on Mar 27, 2026

    @neilconway
    ContributorAuthor

    take

  3. alamb commented on Oct 28, 2026

    @alamb
    Contributor

    I think we should implement support support for this feature as part of the more general subquery decorrelation project described here

    in my opinion WE SHOULD NOT try and extend the existing subquery rewrites to support this type of query as that risks introducing many more wrong results, see #5492 (comment)

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

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions