1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Merge branch '10.3' into 10.4

This commit is contained in:
Sergei Golubchik
2022-10-01 23:07:26 +02:00
208 changed files with 4249 additions and 2251 deletions

View File

@ -2012,6 +2012,11 @@ retry_share:
table_list->alias.str);
goto err_lock;
}
/* Open view */
if (mysql_make_view(thd, share, table_list, false))
goto err_lock;
/*
This table is a view. Validate its metadata version: in particular,
that it was a view when the statement was prepared.
@ -2019,10 +2024,6 @@ retry_share:
if (check_and_update_table_version(thd, table_list, share))
goto err_lock;
/* Open view */
if (mysql_make_view(thd, share, table_list, false))
goto err_lock;
/* TODO: Don't free this */
tdc_release_share(share);
@ -2897,7 +2898,7 @@ static bool inject_reprepare(THD *thd)
@sa Execute_observer
@sa check_prepared_statement() to see cases when an observer is installed
@sa TABLE_LIST::is_table_ref_id_equal()
@sa TABLE_LIST::is_the_same_definition()
@sa TABLE_SHARE::get_table_ref_id()
@param[in] thd used to report errors
@ -2914,7 +2915,7 @@ static bool
check_and_update_table_version(THD *thd,
TABLE_LIST *tables, TABLE_SHARE *table_share)
{
if (! tables->is_table_ref_id_equal(table_share))
if (! tables->is_the_same_definition(thd, table_share))
{
if (thd->m_reprepare_observer &&
thd->m_reprepare_observer->report_error(thd))
@ -3020,7 +3021,9 @@ bool tdc_open_view(THD *thd, TABLE_LIST *table_list, uint flags)
DBUG_ASSERT(share->is_view);
if (flags & CHECK_METADATA_VERSION)
err= mysql_make_view(thd, share, table_list, (flags & OPEN_VIEW_NO_PARSE));
if (!err && (flags & CHECK_METADATA_VERSION))
{
/*
Check TABLE_SHARE-version of view only if we have been instructed to do
@ -3035,7 +3038,6 @@ bool tdc_open_view(THD *thd, TABLE_LIST *table_list, uint flags)
goto ret;
}
err= mysql_make_view(thd, share, table_list, (flags & OPEN_VIEW_NO_PARSE));
ret:
tdc_release_share(share);
@ -8273,19 +8275,20 @@ insert_fields(THD *thd, Name_resolution_context *context, const char *db_name,
tables->is_natural_join);
DBUG_ASSERT(item->type() == Item::FIELD_ITEM);
Item_field *fld= (Item_field*) item;
const char *field_db_name= field_iterator.get_db_name();
const char *field_table_name= field_iterator.get_table_name();
if (!tables->schema_table &&
!(fld->have_privileges=
(get_column_grant(thd, field_iterator.grant(),
field_iterator.get_db_name(),
field_db_name,
field_table_name, fld->field_name.str) &
VIEW_ANY_ACL)))
{
my_error(ER_TABLEACCESS_DENIED_ERROR, MYF(0), "ANY",
thd->security_ctx->priv_user,
thd->security_ctx->host_or_ip,
field_table_name);
field_db_name, field_table_name);
DBUG_RETURN(TRUE);
}
}