Skip to content

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

Merged
hvlad merged 1 commit intomasterfrom
work/gh-7839
Nov 14, 2023
Merged

Fixed bug #7839 : Potential bug in BETWEEN Operator#7842
hvlad merged 1 commit intomasterfrom
work/gh-7839

Conversation

@hvlad
Copy link
Copy Markdown
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