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

MDEV-23779 Error upon querying the view, that selecting from versioned table with partitions

PARTITION clause in SELECT means query is non-versioned (see
WITH_PARTITION_STORAGE_ENGINE in vers_setup_conds()).

vers_setup_conds() expands such query to SYSTEM_TIME_ALL which is then
added to VIEW specification. When VIEW is queried both clauses
PARTITION and FOR SYSTEM_TIME ALL lead to ER_VERS_QUERY_IN_PARTITION
(same place WITH_PARTITION_STORAGE_ENGINE).

Fix removes FOR SYSTEM_TIME ALL from VIEW by accessing original
SYSTEM_TIME clause: the one specified in parser. As a side-effect
EXPLAIN SELECT displays SYSTEM_TIME specified in SELECT which is
user-friendly.
This commit is contained in:
Aleksey Midenkov
2020-10-20 10:49:54 +03:00
parent a3c379ea61
commit ddea8f6a39
7 changed files with 39 additions and 15 deletions

View File

@ -695,7 +695,7 @@ bool vers_select_conds_t::init_from_sysvar(THD *thd)
void vers_select_conds_t::print(String *str, enum_query_type query_type) const
{
switch (type) {
switch (orig_type) {
case SYSTEM_TIME_UNSPECIFIED:
break;
case SYSTEM_TIME_AS_OF: