MySQL 9.0.0
Source Code Documentation
Name_resolution_context Struct Reference

Instances of Name_resolution_context store the information necessary for name resolution of Items and other context analysis of a query made in fix_fields(). More...

#include <item.h>

Public Member Functions

void resolve_in_table_list_only (Table_ref *tables)
 

Public Attributes

Name_resolution_contextouter_context {nullptr}
 The name resolution context to search in when an Item cannot be resolved in this context (the context of an outer select) More...
 
Name_resolution_contextnext_context {nullptr}
 Link to next name res context with the same query block as the base. More...
 
Table_reftable_list {nullptr}
 List of tables used to resolve the items of this context. More...
 
Table_reffirst_name_resolution_table {nullptr}
 In most cases the two table references below replace 'table_list' above for the purpose of name resolution. More...
 
Table_reflast_name_resolution_table {nullptr}
 Last table to search in the list of leaf table references that begins with first_name_resolution_table. More...
 
Query_blockquery_block {nullptr}
 Query_block item belong to, in case of merged VIEW it can differ from Query_block where item was created, so we can't use table_list/field_list from there. More...
 
bool view_error_handler {false}
 
Table_refview_error_handler_arg {nullptr}
 
bool resolve_in_select_list {false}
 When true, items are resolved in this context against Query_block::item_list, SELECT_lex::group_list and this->table_list. More...
 
Security_contextsecurity_ctx {nullptr}
 Security context of this name resolution context. More...
 

Detailed Description

Instances of Name_resolution_context store the information necessary for name resolution of Items and other context analysis of a query made in fix_fields().

This structure is a part of Query_block, a pointer to this structure is assigned when an item is created (which happens mostly during parsing (sql_yacc.yy)), but the structure itself will be initialized after parsing is complete

Member Function Documentation

◆ resolve_in_table_list_only()

void Name_resolution_context::resolve_in_table_list_only ( Table_ref tables)
inline

Member Data Documentation

◆ first_name_resolution_table

Table_ref* Name_resolution_context::first_name_resolution_table {nullptr}

In most cases the two table references below replace 'table_list' above for the purpose of name resolution.

The first and last name resolution table references allow us to search only in a sub-tree of the nested join tree in a FROM clause. This is needed for NATURAL JOIN, JOIN ... USING and JOIN ... ON.

◆ last_name_resolution_table

Table_ref* Name_resolution_context::last_name_resolution_table {nullptr}

Last table to search in the list of leaf table references that begins with first_name_resolution_table.

◆ next_context

Name_resolution_context* Name_resolution_context::next_context {nullptr}

Link to next name res context with the same query block as the base.

◆ outer_context

Name_resolution_context* Name_resolution_context::outer_context {nullptr}

The name resolution context to search in when an Item cannot be resolved in this context (the context of an outer select)

◆ query_block

Query_block* Name_resolution_context::query_block {nullptr}

Query_block item belong to, in case of merged VIEW it can differ from Query_block where item was created, so we can't use table_list/field_list from there.

◆ resolve_in_select_list

bool Name_resolution_context::resolve_in_select_list {false}

When true, items are resolved in this context against Query_block::item_list, SELECT_lex::group_list and this->table_list.

If false, items are resolved only against this->table_list.

See also
Query_block::item_list, Query_block::group_list

◆ security_ctx

Security_context* Name_resolution_context::security_ctx {nullptr}

Security context of this name resolution context.

It's used for views and is non-zero only if the view is defined with SQL SECURITY DEFINER.

◆ table_list

Table_ref* Name_resolution_context::table_list {nullptr}

List of tables used to resolve the items of this context.

Usually these are tables from the FROM clause of SELECT statement. The exceptions are INSERT ... SELECT and CREATE ... SELECT statements, where SELECT subquery is not moved to a separate Query_block. For these types of statements we have to change this member dynamically to ensure correct name resolution of different parts of the statement.

◆ view_error_handler

bool Name_resolution_context::view_error_handler {false}

◆ view_error_handler_arg

Table_ref* Name_resolution_context::view_error_handler_arg {nullptr}

The documentation for this struct was generated from the following file: