forked from duckdb/duckdb
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix CheckMarkToSemi conversion in FilterPushdown optimizer
This fixes issue duckdb#13542
- Loading branch information
Showing
2 changed files
with
48 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# name: test/issues/general/test_13542.test | ||
# description: Correlated subquery related? Failed to bind column reference "once_state2" [35.0] (bindings: {#[1.0], #[33.0]}) | ||
# group: [general] | ||
|
||
statement ok | ||
PRAGMA enable_verification | ||
|
||
statement ok | ||
create table stuff ( | ||
ts timestamp, | ||
item_id int, | ||
type text | ||
); | ||
|
||
query III | ||
with | ||
unique_items as ( | ||
select distinct item_id from stuff | ||
), | ||
state_stuff as ( | ||
select | ||
item_id, | ||
exists (select 1 from stuff c where s.item_id = c.item_id | ||
and type = 'state1') as once_state1, | ||
exists (select 1 from stuff c where s.item_id = c.item_id | ||
and type = 'state2') as once_state2 | ||
from unique_items s) | ||
select * from state_stuff; | ||
---- | ||
|
||
query III | ||
with | ||
unique_items as ( | ||
select distinct item_id from stuff | ||
), | ||
state_stuff as ( | ||
select | ||
item_id, | ||
exists (select 1 from stuff c where s.item_id = c.item_id | ||
and type = 'state1') as once_state1, | ||
exists (select 1 from stuff c where s.item_id = c.item_id | ||
and type = 'state2') as once_state2 | ||
from unique_items s) | ||
select * from state_stuff where not once_state2; | ||
---- |