MySQL 8.0.40
Source Code Documentation
sql_derived.cc File Reference
#include "sql/sql_derived.h"
#include <stddef.h>
#include <string.h>
#include <sys/types.h>
#include "lex_string.h"
#include "my_alloc.h"
#include "my_base.h"
#include "my_bitmap.h"
#include "my_dbug.h"
#include "my_inttypes.h"
#include "my_sys.h"
#include "my_table_map.h"
#include "mysqld_error.h"
#include "sql/auth/auth_acls.h"
#include "sql/debug_sync.h"
#include "sql/handler.h"
#include "sql/item.h"
#include "sql/join_optimizer/join_optimizer.h"
#include "sql/mem_root_array.h"
#include "sql/nested_join.h"
#include "sql/opt_trace.h"
#include "sql/query_options.h"
#include "sql/sql_base.h"
#include "sql/sql_class.h"
#include "sql/sql_const.h"
#include "sql/sql_executor.h"
#include "sql/sql_lex.h"
#include "sql/sql_list.h"
#include "sql/sql_opt_exec_shared.h"
#include "sql/sql_optimizer.h"
#include "sql/sql_parse.h"
#include "sql/sql_resolver.h"
#include "sql/sql_tmp_table.h"
#include "sql/sql_union.h"
#include "sql/sql_view.h"
#include "sql/table.h"
#include "sql/table_function.h"
#include "sql/thd_raii.h"
#include "thr_lock.h"

Functions

static void swap_column_names_of_unit_and_tmp_table (const mem_root_deque< Item * > &unit_items, const Create_col_name_list &tmp_table_col_names)
 Helper function for Table_ref::setup_materialized_derived() More...
 
bool copy_field_info (THD *thd, Item *orig_expr, Item *cloned_expr)
 Copy field information like table_ref, context etc of all the fields from the original expression to the cloned expression. More...
 
static Itemparse_expression (THD *thd, Item *item, Query_block *query_block, Table_ref *derived_table)
 Given an item and a query block, this function creates a clone of the item (unresolved) by reparsing the item. More...
 
Itemresolve_expression (THD *thd, Item *item, Query_block *query_block)
 Resolves the expression given. More...
 

Function Documentation

◆ copy_field_info()

bool copy_field_info ( THD thd,
Item orig_expr,
Item cloned_expr 
)

Copy field information like table_ref, context etc of all the fields from the original expression to the cloned expression.

Parameters
thdcurrent thread
orig_exproriginal expression
cloned_exprcloned expression
Returns
true on error, false otherwise

◆ parse_expression()

static Item * parse_expression ( THD thd,
Item item,
Query_block query_block,
Table_ref derived_table 
)
static

Given an item and a query block, this function creates a clone of the item (unresolved) by reparsing the item.

Used during condition pushdown to derived tables.

Parameters
thdCurrent thread.
itemItem to be reparsed to get a clone.
query_blockquery block where expression is being parsed
derived_tablederived table to which the item belongs to. "nullptr" when cloning to make a copy of the original condition to be pushed down to a derived table that has SET operations.
Returns
A copy of the original item (unresolved) on success else nullptr.

◆ resolve_expression()

Item * resolve_expression ( THD thd,
Item item,
Query_block query_block 
)

Resolves the expression given.

Used with parse_expression() to clone an item during condition pushdown. For all the column references in the expression, information like table reference, field, context etc is expected to be correctly set. This will just do a short cut fix_fields() for Item_field.

Parameters
thdCurrent thread.
itemItem to resolve.
query_blockquery block where this item needs to be resolved.
Returns
resolved item if resolving was successful else nullptr.

◆ swap_column_names_of_unit_and_tmp_table()

static void swap_column_names_of_unit_and_tmp_table ( const mem_root_deque< Item * > &  unit_items,
const Create_col_name_list tmp_table_col_names 
)
static

Helper function for Table_ref::setup_materialized_derived()