Skip to content

EXISTS does not work with subqueries #1904

Closed

Description

@alsundukov

The EXISTS function works correctly in the main query but throws an error when used in a subquery. For example:

res = alasql('SELECT EXISTS(SELECT "a"), a FROM ?', [[item1, item2]]);
// returns expected value

res = alasql('SELECT * FROM (SELECT EXISTS(SELECT "a"), a FROM ?)', [[item1, item2]]);
// error: Cannot read properties of undefined (reading '0')

Additionally, I've noticed that the function also fails when used with SET:

SET @ress = (SELECT EXISTS(SELECT "test"));

Activity

  1. added a commit that references this issue on Jul 9, 2024
    aeb3b00
  2. mathiasrw commented on Jul 11, 2024

    @mathiasrw
    Member

    Released as part of v4.5.0

  3. alsundukov commented on Jul 31, 2024

    @alsundukov
    ContributorAuthor

    Unfortunately, this does not fix the problem in any way. Now exists returns a Boolean value (true/false) instead of a number (0.1), but this still doesn't work for subquery(((.

    Why wasn't the test added?

  4. added a commit that references this issue on Jul 31, 2024
    85c24d4
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