Skip to content

Review #2406 for code improvements: a view's subqueries are moved from the statement to its SELECT #2688

Backlog

Description

@mathiasrw

This is not a bug report. It is an invitation to look at #2406 again, because it works around the statement-level subquery list described in #2666. The goal is to understand the change and decide whether anything should be improved. The notes below come from a quick read of the diff and a few runs, not from a full analysis.

The concern:

  • The view's subqueries belong to the CREATE VIEW statement, not to its SELECT. The parser collects all subqueries of a statement into one list on the statement. For CREATE VIEW v AS SELECT (SELECT …) … that is the CREATE VIEW statement, so the view's SELECT could not find them. Fix error when creating view with subquery in alasql #2406 moves the list onto the SELECT in alasql.precompile (src/41exists.js, with an early return for views) and compiles the view lazily on first use.
  • If each SELECT owned its subqueries from parsing on (Give each SELECT its own list of subqueries from parsing on #2666), the view's SELECT would carry them itself, and the special case for views in precompile could go. Views with a scalar subquery, EXISTS and IN all work today.

Related: #1154, #2518, #2550, #2620, #2666.

Activity

  1. mathiasrw commented on Nov 26, 2026

    @mathiasrw
    MemberAuthor

    Will be covered by #2666.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions