summaryrefslogtreecommitdiff
path: root/sql/sql_select.cc
diff options
context:
space:
mode:
authorAleksey Midenkov <midenok@gmail.com>2020-10-20 10:49:54 +0300
committerAleksey Midenkov <midenok@gmail.com>2020-10-20 10:49:54 +0300
commitddea8f6a39bfd32d8c5d8e38b8fa60c14156025c (patch)
treef56b565aa7f31afa272237b2e08e059eff07030b /sql/sql_select.cc
parenta3c379ea61a5ba09b6d0db639ea28e700e66a591 (diff)
downloadmariadb-git-ddea8f6a39bfd32d8c5d8e38b8fa60c14156025c.tar.gz
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.
Diffstat (limited to 'sql/sql_select.cc')
-rw-r--r--sql/sql_select.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 3bbfc71e4e4..aaa4b4d6b8b 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -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: