1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

SQL, IB: Copy history via CREATE .. SELECT [closes #157, #152]

This commit is contained in:
Aleksey Midenkov
2017-03-24 16:00:42 +03:00
parent 7a525e7e93
commit 67cd92b6f4
29 changed files with 636 additions and 276 deletions

View File

@ -7586,10 +7586,27 @@ insert_fields(THD *thd, Name_resolution_context *context, const char *db_name,
{
Item_field *f= static_cast<Item_field *>(item);
DBUG_ASSERT(f->field);
if (f->field->flags & HIDDEN_FLAG)
uint32 fl= f->field->flags;
bool sys_field= fl & (VERS_SYS_START_FLAG | VERS_SYS_END_FLAG);
SELECT_LEX *slex= thd->lex->current_select;
TABLE *table= f->field->table;
DBUG_ASSERT(table && table->pos_in_table_list);
TABLE_LIST *tl= table->pos_in_table_list;
vers_range_type_t vers_type=
tl->vers_conditions.type == FOR_SYSTEM_TIME_UNSPECIFIED ?
slex->vers_conditions.type : tl->vers_conditions.type;
if ((sys_field && vers_hide == VERS_HIDE_FULL &&
thd->lex->sql_command != SQLCOM_CREATE_TABLE) ||
((fl & HIDDEN_FLAG) && (
!sys_field ||
vers_hide == VERS_HIDE_IMPLICIT ||
(vers_hide == VERS_HIDE_AUTO && (
vers_type == FOR_SYSTEM_TIME_UNSPECIFIED ||
vers_type == FOR_SYSTEM_TIME_AS_OF)))))
continue;
}
if (item->type() == Item::REF_ITEM)
else if (item->type() == Item::REF_ITEM)
{
Item *i= item;
while (i->type() == Item::REF_ITEM)