Skip to content

Issue with NOT grouping #386

Closed
Closed

Description

@workmad3

When writing a query with a NOT in the WHERE clause, the result seems to indicate that the precedence grouping in the query is incorrect, as it appears to group a NOT with just the column name not the full expression when not using parenthesis.

Reproducible with:
alasql('SELECT a FROM ? WHERE NOT id = 2', [[{id:2,a:123},{id:1,a:null}]])
(no results)
vs
alasql('SELECT a FROM ? WHERE NOT (id = 2)', [[{id:2,a:123},{id:1,a:null}]])
(1 result, as expected)

Activity

  1. added this to the milestone on Aug 10, 2015
  2. agershun commented on Aug 10, 2015

    @agershun
    Member

    @workmad3 Thank you for the note. It is so, because we place NOT with higher priority than =.

    I just checked SQL standards and some realizations (e.g. Transact SQL, MySQL. You are right, we need to fix it.

  3. self-assigned this
    on Aug 10, 2015
  4. mathiasrw commented on Aug 10, 2015

    @mathiasrw
    Member

    Thank you for taking the time to investigate and describe the issue.

    @agershun Could this be the same cause as issue #368 ?

  5. agershun commented on Aug 10, 2015

    @agershun
    Member

    I fixed it. See the version in develop branch.

  6. workmad3 commented on Aug 10, 2015

    @workmad3
    ContributorAuthor

    @agershun Seems good in my initial testing, just going to ask some of my users to test the change as well. Thanks for the quick fix!

  7. workmad3 commented on Aug 10, 2015

    @workmad3
    ContributorAuthor

    My users just confirmed the fix works as expected too, and pass on their thanks!

    Closing this issue.

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions