MySQL 8.4.2
Source Code Documentation
sql_check_constraint.h File Reference
#include "lex_string.h"
#include "sql/mem_root_array.h"

Go to the source code of this file.

Classes

class  Sql_check_constraint_spec
 Class to represent the check constraint specifications obtained from the SQL statement parse. More...
 
class  Sql_check_constraint_share
 Class to represent check constraint in the TABLE_SHARE. More...
 
class  Sql_table_check_constraint
 Class to represent check constraint in the TABLE instance. More...
 
class  Check_constraint_column_dependency_checker
 Helper class to check if column being dropped or removed in ALTER statement is in use by Check constraints. More...
 

Typedefs

using Sql_check_constraint_spec_list = Mem_root_array< Sql_check_constraint_spec * >
 Type for the list of Sql_check_constraint_spec elements. More...
 
using Sql_check_constraint_share_list = Mem_root_array< Sql_check_constraint_share >
 Type for the list of Sql_check_constraint_share elements. More...
 
using Sql_table_check_constraint_list = Mem_root_array< Sql_table_check_constraint >
 Type for the list of Sql_table_check_constraint elements. More...
 

Functions

bool is_slave_with_master_without_check_constraints_support (THD *thd)
 Method to check if server is a slave server and master server is on a version not supporting check constraints feature. More...
 
bool check_constraint_expr_refers_to_only_column (Item *check_expr, const char *column_name)
 Check if constraint expression refers to only "column_name" column of the table. More...
 

Typedef Documentation

◆ Sql_check_constraint_share_list

Type for the list of Sql_check_constraint_share elements.

◆ Sql_check_constraint_spec_list

Type for the list of Sql_check_constraint_spec elements.

◆ Sql_table_check_constraint_list

Type for the list of Sql_table_check_constraint elements.

Function Documentation

◆ check_constraint_expr_refers_to_only_column()

bool check_constraint_expr_refers_to_only_column ( Item check_expr,
const char *  column_name 
)

Check if constraint expression refers to only "column_name" column of the table.

Parameters
[in]check_exprCheck constraint expression.
[in]column_nameColumn name.
Return values
trueIf expression refers to only "column_name".
falseIf expression refers to more than one column or if expression does not refers to "column_name".

◆ is_slave_with_master_without_check_constraints_support()

bool is_slave_with_master_without_check_constraints_support ( THD thd)

Method to check if server is a slave server and master server is on a version not supporting check constraints feature.

Check constraint support is introduced in server version 80016.

Method is used by methods prepare_check_constraints_for_create() and prepare_check_constraints_for_alter(). Check constraints are not prepared (and specification list is cleared) when this method returns to true. In older versions, check constraint syntax was supported but check constraint feature was not supported. So if master is on older version and slave gets event with check constraint syntax then on slave supporting check constraint, query is parsed but during prepare time the specifications are ignored for the statement(event).

Return values
trueif server is a slave server and master server is on a version not supporting check constraints feature.
falseOtherwise.