summaryrefslogtreecommitdiff
path: root/sql/sql_view.cc
diff options
context:
space:
mode:
authorAleksey Midenkov <midenok@gmail.com>2017-12-13 18:03:38 +0300
committerAleksey Midenkov <midenok@gmail.com>2017-12-13 18:23:32 +0300
commit8e8363bb7540a5281c3fbc5a7cec37d9d8f35bd2 (patch)
treed8d681ca268a2ac56fba36590b5656b4718b3f3a /sql/sql_view.cc
parenta83fcbaa3b6053c392bf69f57ac9a9e346187a6a (diff)
downloadmariadb-git-8e8363bb7540a5281c3fbc5a7cec37d9d8f35bd2.tar.gz
SQL: VIEW system fields propagation removed [fixes #393]
Diffstat (limited to 'sql/sql_view.cc')
-rw-r--r--sql/sql_view.cc130
1 files changed, 0 insertions, 130 deletions
diff --git a/sql/sql_view.cc b/sql/sql_view.cc
index 6ea4633385b..21ceb6ce19b 100644
--- a/sql/sql_view.cc
+++ b/sql/sql_view.cc
@@ -455,136 +455,6 @@ bool mysql_create_view(THD *thd, TABLE_LIST *views,
goto err;
}
- for (SELECT_LEX *sl= select_lex; sl; sl= sl->next_select())
- { /* System Versioning: fix system fields of versioned view */
- // Similar logic as in mysql_derived_prepare()
- // Leading versioning table detected implicitly (first one selected)
- TABLE_LIST *impli_table= NULL;
- // Leading versioning table specified explicitly
- // (i.e. if at least one system field is selected)
- TABLE_LIST *expli_table= NULL;
- LEX_CSTRING impli_start, impli_end;
- Item_field *expli_start= NULL, *expli_end= NULL;
-
- for (TABLE_LIST *table= tables; table; table= table->next_local)
- {
- DBUG_ASSERT(!table->is_view() || table->view);
-
- // Any versioned table in VIEW will add `FOR SYSTEM_TIME ALL` + WHERE:
- // if there are at least one versioned table then VIEW will contain FOR_SYSTEM_TIME_ALL
- // (because it is in fact LEX used to parse its SELECT).
- if (table->is_view() && table->view->vers_conditions == FOR_SYSTEM_TIME_ALL)
- {
- my_printf_error(
- ER_VERS_VIEW_PROHIBITED,
- "Creating VIEW `%s` is prohibited: versioned VIEW `%s` in query!", MYF(0),
- view->table_name,
- table->table_name);
- res= true;
- goto err;
- }
-
- if (!table->table || !table->table->versioned())
- continue;
-
- const LString_i table_start= table->table->vers_start_field()->field_name;
- const LString_i table_end= table->table->vers_end_field()->field_name;
-
- if (!impli_table)
- {
- impli_table= table;
- impli_start= table_start;
- impli_end= table_end;
- }
-
- /* Implicitly add versioning fields if needed */
- Item *item;
- List_iterator_fast<Item> it(sl->item_list);
-
- DBUG_ASSERT(table->alias);
- while ((item= it++))
- {
- if (item->real_item()->type() != Item::FIELD_ITEM)
- continue;
- Item_field *fld= (Item_field*) item->real_item();
- if (fld->table_name && 0 != my_strcasecmp(table_alias_charset, table->alias, fld->table_name))
- continue;
- DBUG_ASSERT(fld->field_name.str);
- if (table_start == fld->field_name)
- {
- if (expli_start)
- {
- my_printf_error(
- ER_VERS_VIEW_PROHIBITED,
- "Creating VIEW `%s` is prohibited: multiple start system fields `%s.%s`, `%s.%s` in query!", MYF(0),
- view->table_name,
- expli_table->alias,
- expli_start->field_name.str,
- table->alias,
- fld->field_name.str);
- res= true;
- goto err;
- }
- if (expli_table)
- {
- if (expli_table != table)
- {
-expli_table_err:
- my_printf_error(
- ER_VERS_VIEW_PROHIBITED,
- "Creating VIEW `%s` is prohibited: system fields from multiple tables `%s`, `%s` in query!", MYF(0),
- view->table_name,
- expli_table->alias,
- table->alias);
- res= true;
- goto err;
- }
- }
- else
- expli_table= table;
- expli_start= fld;
- impli_end= table_end;
- }
- else if (table_end == fld->field_name)
- {
- if (expli_end)
- {
- my_printf_error(
- ER_VERS_VIEW_PROHIBITED,
- "Creating VIEW `%s` is prohibited: multiple end system fields `%s.%s`, `%s.%s` in query!", MYF(0),
- view->table_name,
- expli_table->alias,
- expli_end->field_name.str,
- table->alias,
- fld->field_name.str);
- res= true;
- goto err;
- }
- if (expli_table)
- {
- if (expli_table != table)
- goto expli_table_err;
- }
- else
- expli_table= table;
- expli_end= fld;
- impli_start= table_start;
- }
- } // while ((item= it++))
- } // for (TABLE_LIST *table)
-
- if (expli_table)
- impli_table= expli_table;
-
- if (impli_table)
- {
- if (!expli_start && sl->vers_push_field(thd, impli_table, impli_start))
- goto err;
- if (!expli_end && sl->vers_push_field(thd, impli_table, impli_end))
- goto err;
- }
- } /* System Versioning end */
-
view= lex->unlink_first_table(&link_to_local);
if (check_db_dir_existence(view->db))