MySQL  8.0.18
Source Code Documentation
sql_check_constraint.cc File Reference
#include "sql_check_constraint.h"
#include "item_func.h"
#include "libbinlogevents/include/binlog_event.h"
#include "mysqld_error.h"
#include "sql_parse.h"
#include "sql_string.h"
#include "strfunc.h"
#include "thd_raii.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.