1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-27 18:02:13 +03:00

SQL: derived, hiding, error messages

Many related changes.

Note that AS OF condition must always be pushed down to physical tables,
it cannot be applied to a derived or a view. Thus:

* no versioning for internal temporary tables, they can never store
  historical data.
* remove special versioning code from mysql_derived_prepare and
  remove ER_VERS_DERIVED_PROHIBITED - derived can have no historical
  data and cannot be prohibited for system versioning related reasons.
* do not expand select list for derived/views with sys vers fields,
  derived/views can never have historical data.
* remove special invisiblity rules for sys vers fields, they are no
  longer needed after the previous change
* remove system_versioning_hide, it lost the meaning after the
  previous change.
* remove ER_VERS_SYSTEM_TIME_CLASH, it's no "clash", the inner
  AS OF clause always wins.
* non-versioned fields in a historical query

reword the warning text, downgrade to note, don't
replace values with NULLs
This commit is contained in:
Sergei Golubchik
2017-12-30 13:40:36 +01:00
committed by Aleksey Midenkov
parent b06b5c3eab
commit e6a7457653
35 changed files with 98 additions and 451 deletions

View File

@ -14,62 +14,67 @@ a
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
1 2 2
3 4 4
Warnings:
Warning 4111 Attempt to read non-temporal field `b` in historical query
Warning 4111 Attempt to read non-temporal field `b` in historical query
Note 4111 Non-versioned field `b` in historical query
Note 4111 Non-versioned field `b` in historical query
select * from t for system_time as of timestamp now(6);
a b
1 NULL
3 NULL
1 2
3 4
Warnings:
Warning 4111 Attempt to read non-temporal field `b` in historical query
Note 4111 Non-versioned field `b` in historical query
select count(*) from t for system_time as of timestamp now(6) group by b;
count(*)
2
1
1
Warnings:
Warning 4111 Attempt to read non-temporal field `b` in historical query
Note 4111 Non-versioned 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
1 2
3 4
Warnings:
Warning 4111 Attempt to read non-temporal field `b` in historical query
Warning 4111 Attempt to read non-temporal field `b` in historical query
Note 4111 Non-versioned field `b` in historical query
Note 4111 Non-versioned 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
3 4
1 2
Warnings:
Warning 4111 Attempt to read non-temporal field `b` in historical query
Warning 4111 Attempt to read non-temporal field `b` in historical query
Note 4111 Non-versioned field `b` in historical query
Note 4111 Non-versioned field `b` in historical query
select * from t for system_time as of timestamp now(6) group by a having a=2;
a b
Warnings:
Warning 4111 Attempt to read non-temporal field `b` in historical query
Note 4111 Non-versioned field `b` in historical query
select * from t for system_time as of timestamp now(6) group by b having b=2;
a b
1 2
Warnings:
Warning 4111 Attempt to read non-temporal field `b` in historical query
Note 4111 Non-versioned field `b` in historical query
Note 4111 Non-versioned field `b` in historical query
Note 4111 Non-versioned field `b` in historical query
select a from t for system_time as of timestamp now(6) where b=2;
a
1
Warnings:
Warning 4111 Attempt to read non-temporal field `b` in historical query
Note 4111 Non-versioned field `b` in historical query
select a from t for system_time as of timestamp now(6) where b=NULL;
a
Warnings:
Warning 4111 Attempt to read non-temporal field `b` in historical query
Note 4111 Non-versioned field `b` in historical query
select a from t for system_time as of timestamp now(6) where b is NULL;
a
1
3
Warnings:
Warning 4111 Attempt to read non-temporal field `b` in historical query
Note 4111 Non-versioned field `b` in historical query
select count(*), b from t for system_time as of timestamp now(6) group by b having b=NULL;
count(*) b
Warnings:
Warning 4111 Attempt to read non-temporal field `b` in historical query
Note 4111 Non-versioned field `b` in historical query
Note 4111 Non-versioned field `b` in historical query
Note 4111 Non-versioned field `b` in historical query
select a, b from t;
a b
1 2
@ -81,15 +86,12 @@ b int not null without system versioning
insert into t values (1, 2), (3, 4);
select * from t for system_time as of timestamp now(6);
a b
1 NULL
3 NULL
1 2
3 4
Warnings:
Warning 4111 Attempt to read non-temporal field `b` in historical query
Note 4111 Non-versioned field `b` in historical query
select * from t for system_time as of timestamp now(6) where b is NULL;
a b
1 NULL
3 NULL
Warnings:
Warning 4111 Attempt to read non-temporal field `b` in historical query
Warning 4111 Attempt to read non-temporal field `b` in historical query
Note 4111 Non-versioned field `b` in historical query
drop table t;