diff --git a/dbms/tests/queries/0_stateless/00712_prewhere_with_final.reference b/dbms/tests/queries/0_stateless/00712_prewhere_with_final.reference new file mode 100644 index 00000000000..d00491fd7e5 --- /dev/null +++ b/dbms/tests/queries/0_stateless/00712_prewhere_with_final.reference @@ -0,0 +1 @@ +1 diff --git a/dbms/tests/queries/0_stateless/00712_prewhere_with_final.sql b/dbms/tests/queries/0_stateless/00712_prewhere_with_final.sql new file mode 100644 index 00000000000..6379cae8a34 --- /dev/null +++ b/dbms/tests/queries/0_stateless/00712_prewhere_with_final.sql @@ -0,0 +1,13 @@ +drop table if exists test.trepl; +create table test.trepl +( +d Date, +a Int32, +b Int32 +) engine = ReplacingMergeTree(d, (a,b), 8192); + + +insert into test.trepl values ('2018-09-19', 1, 1); +select b from test.trepl FINAL prewhere a < 1000; +drop table test.trepl; + diff --git a/dbms/tests/queries/0_stateless/00712_prewhere_with_missing_columns_2.reference b/dbms/tests/queries/0_stateless/00712_prewhere_with_missing_columns_2.reference new file mode 100644 index 00000000000..e22493782f0 --- /dev/null +++ b/dbms/tests/queries/0_stateless/00712_prewhere_with_missing_columns_2.reference @@ -0,0 +1,3 @@ +1 +0 +0 diff --git a/dbms/tests/queries/0_stateless/00712_prewhere_with_missing_columns_2.sql b/dbms/tests/queries/0_stateless/00712_prewhere_with_missing_columns_2.sql new file mode 100644 index 00000000000..9dbe8125196 --- /dev/null +++ b/dbms/tests/queries/0_stateless/00712_prewhere_with_missing_columns_2.sql @@ -0,0 +1,13 @@ +create database if not exists test; +drop table if exists test.t; +create table test.t (a Int32, b Int32) engine = MergeTree partition by (a,b) order by (a); + +insert into test.t values (1, 1); +alter table test.t add column c Int32; + +select b from test.t prewhere a < 1000; +select c from test.t where a < 1000; +select c from test.t prewhere a < 1000; + +drop table test.t; +