summaryrefslogtreecommitdiff
path: root/sql/sql_select.cc
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2017-12-07 14:47:58 +0100
committerSergei Golubchik <serg@mariadb.org>2017-12-13 21:44:30 +0100
commite77080c7d58a5d479a4ab6830047776640ce3a74 (patch)
tree5d0033c08ec2046cf65730c08c7b17ae473202c4 /sql/sql_select.cc
parent21d0a9fe3bb83100e6ea45b29557647bb83fe70b (diff)
downloadmariadb-git-e77080c7d58a5d479a4ab6830047776640ce3a74.tar.gz
if a table is partitioned by system_time, its partitions are not versioned
they store history and the history does not have history
Diffstat (limited to 'sql/sql_select.cc')
-rw-r--r--sql/sql_select.cc21
1 files changed, 21 insertions, 0 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index e0e160b45aa..a7046b4232c 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -824,6 +824,27 @@ int SELECT_LEX::vers_setup_conds(THD *thd, TABLE_LIST *tables, COND **where_expr
{
vers_select_conds_t &vers_conditions= table->vers_conditions;
+#ifdef WITH_PARTITION_STORAGE_ENGINE
+ /*
+ if the history is stored in partitions, then partitions
+ themselves are not versioned
+ */
+ if (table->partition_names && table->table->part_info->vers_info)
+ {
+ if (vers_conditions)
+ {
+#define PART_VERS_ERR_MSG "%s PARTITION (%s)"
+ char buf[NAME_LEN*2 + sizeof(PART_VERS_ERR_MSG)];
+ my_snprintf(buf, sizeof(buf), PART_VERS_ERR_MSG, table->alias,
+ table->partition_names->head()->c_ptr());
+ my_error(ER_VERSIONING_REQUIRED, MYF(0), buf);
+ DBUG_RETURN(-1);
+ }
+ else
+ vers_conditions.init(FOR_SYSTEM_TIME_ALL);
+ }
+#endif
+
// propagate system_time from nearest outer SELECT_LEX
if (!vers_conditions && outer_slex && vers_import_outer)
{