forked from MariaDB/server
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SQL: NULL instead of optimized fields in versioned queries
- Loading branch information
Showing
6 changed files
with
115 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
create table t( | ||
a int, | ||
b int without system versioning | ||
) with system versioning; | ||
insert into t values(1, 2); | ||
insert into t values(3, 4); | ||
select * from t; | ||
a b | ||
1 2 | ||
3 4 | ||
select a from t for system_time as of timestamp now(6); | ||
a | ||
1 | ||
3 | ||
select a, b, b+0 from t for system_time as of timestamp now(6); | ||
a b b+0 | ||
1 NULL NULL | ||
3 NULL NULL | ||
Warnings: | ||
Warning 4050 Attempt to read unversioned field 'b' in historical query | ||
select * from t for system_time as of timestamp now(6); | ||
a b | ||
1 NULL | ||
3 NULL | ||
Warnings: | ||
Warning 4050 Attempt to read unversioned field 'b' in historical query | ||
select count(*) from t group by b for system_time as of timestamp now(6); | ||
count(*) | ||
2 | ||
Warnings: | ||
Warning 4050 Attempt to read unversioned field 'b' in historical query | ||
select * from t for system_time as of timestamp now(6) order by b asc; | ||
a b | ||
1 NULL | ||
3 NULL | ||
Warnings: | ||
Warning 4050 Attempt to read unversioned field 'b' in historical query | ||
select * from t for system_time as of timestamp now(6) order by b desc; | ||
a b | ||
1 NULL | ||
3 NULL | ||
Warnings: | ||
Warning 4050 Attempt to read unversioned field 'b' in historical query | ||
select * from t group by a having a=2 for system_time as of timestamp now(6); | ||
a b | ||
Warnings: | ||
Warning 4050 Attempt to read unversioned field 'b' in historical query | ||
select * from t group by b having b=2 for system_time as of timestamp now(6); | ||
a b | ||
Warnings: | ||
Warning 4050 Attempt to read unversioned field 'b' in historical query | ||
select a from t where b=2 for system_time as of timestamp now(6); | ||
a | ||
Warnings: | ||
Warning 4050 Attempt to read unversioned field 'b' in historical query | ||
select a from t where b=NULL for system_time as of timestamp now(6); | ||
a | ||
Warnings: | ||
Warning 4050 Attempt to read unversioned field 'b' in historical query | ||
select count(*), b from t group by b having b=NULL for system_time as of timestamp now(6); | ||
count(*) b | ||
Warnings: | ||
Warning 4050 Attempt to read unversioned field 'b' in historical query | ||
select a, b from t; | ||
a b | ||
1 2 | ||
3 4 | ||
drop table t; |
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,22 @@ | ||
create table t( | ||
a int, | ||
b int without system versioning | ||
) with system versioning; | ||
|
||
insert into t values(1, 2); | ||
insert into t values(3, 4); | ||
select * from t; | ||
select a from t for system_time as of timestamp now(6); | ||
select a, b, b+0 from t for system_time as of timestamp now(6); | ||
select * from t for system_time as of timestamp now(6); | ||
select count(*) from t group by b for system_time as of timestamp now(6); | ||
select * from t for system_time as of timestamp now(6) order by b asc; | ||
select * from t for system_time as of timestamp now(6) order by b desc; | ||
select * from t group by a having a=2 for system_time as of timestamp now(6); | ||
select * from t group by b having b=2 for system_time as of timestamp now(6); | ||
select a from t where b=2 for system_time as of timestamp now(6); | ||
select a from t where b=NULL for system_time as of timestamp now(6); | ||
select count(*), b from t group by b having b=NULL for system_time as of timestamp now(6); | ||
select a, b from t; | ||
|
||
drop table t; |
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
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