Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed bug #7839 : Potential bug in BETWEEN Operator #7842

Merged
merged 1 commit into from
Nov 14, 2023
Merged

Conversation

hvlad
Copy link
Member

@hvlad hvlad commented Nov 13, 2023

The test for BETWEEN correctness, assuming we have correct comparison and logical AND operators:

with t (x, a, b) as
  (
    select 0, 10, 20 from rdb$database union all
    select 0, 20, 10 from rdb$database union all
    select 10, 0, 20 from rdb$database union all
    select 10, 20, 0 from rdb$database union all
    select 20, 0, 10 from rdb$database union all
    select 20, 10, 0 from rdb$database union all

    select null, 10, 20 from rdb$database union all
    select null, 20, 10 from rdb$database union all
    select 10, null, 20 from rdb$database union all
    select 20, null, 10 from rdb$database union all    -- wrong 
    select 10, 20, null from rdb$database union all    -- wrong 
    select 20, 10, null from rdb$database union all

    select null, null, 20 from rdb$database union all
    select null, 20, null from rdb$database union all
    select 20, null, null from rdb$database union all

    select null, null, null from rdb$database
  ),

  cmp as
  (
    select t.*, x between a and b as cmp1, a <= x and x <= b as cmp2
      from t
  )

select * from cmp
 where cmp1 is distinct from cmp2

@hvlad hvlad self-assigned this Nov 13, 2023
@hvlad hvlad linked an issue Nov 13, 2023 that may be closed by this pull request
@hvlad hvlad merged commit 1eadaea into master Nov 14, 2023
@hvlad hvlad deleted the work/gh-7839 branch November 16, 2023 11:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Potential bug in BETWEEN operator
1 participant