MySQL 8.3.0
Source Code Documentation
sql_check_constraint.cc File Reference
#include "sql/sql_check_constraint.h"
#include "my_inttypes.h"
#include "my_sys.h"
#include "mysql/binlog/event/binlog_event.h"
#include "mysql/strings/m_ctype.h"
#include "mysql/thread_type.h"
#include "mysql_com.h"
#include "mysqld_error.h"
#include "sql/create_field.h"
#include "sql/enum_query_type.h"
#include "sql/field.h"
#include "sql/item.h"
#include "sql/sql_class.h"
#include "sql/sql_const.h"
#include "sql/sql_list.h"
#include "sql/sql_parse.h"
#include "sql/system_variables.h"
#include "sql/thd_raii.h"
#include "sql_string.h"

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...
 

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.