|
| static LEX_CSTRING | make_lex_cstring (MEM_ROOT *root, const String &string) |
| |
| static bool | equal_names_for_masking_policy (std::string_view name1, std::string_view name2) |
| | Returns true if the two names are considered equal when they are used either as masking policy names or as masking policy argument names. More...
|
| |
| static bool | invalidate_tables_with_masking_policy (THD *thd, std::string_view policy_name) |
| | Iterate the Table Definition Cache (TDC) to find tables whose TABLE_SHARE has at least one field referencing the given masking policy name and invalidate those tables so they will be reopened with up-to-date metadata. More...
|
| |
| bool | drop_masking_policy (THD *thd, LEX_CSTRING policy_name, bool if_exists) |
| | Drop the masking policy with the given name. More...
|
| |
| std::optional< Sql_masking_policy_spec > | get_masking_policy_spec (THD *thd, LEX_CSTRING policy_name, std::string *reason) |
| | Returns the masking policy with the given name if it can be found. More...
|
| |
| bool | check_masking_policy_manage_privilege (THD *thd) |
| | Checks if the current user has the MANAGE_DATA_MASKING_POLICY privilege. More...
|
| |
| bool | create_masking_policy (THD *thd, bool if_not_exists, const Sql_masking_policy_spec &spec) |
| | Create a masking policy with the given specification. More...
|
| |
| static bool | validate_masking_policy_column_constraints (const Create_field &create_field) |
| | Validates constraints for masking policy assignment on a column. More...
|
| |
| bool | check_masking_policy_name (LEX_CSTRING name) |
| | Check if the name is valid for a masking policy name or a masking policy argument name. More...
|
| |
| static bool | validate_masking_policy_gatekeeper (Item *gatekeeper_expr) |
| |
| static bool | validate_policy_argument_reference (Item_field *field, LEX_CSTRING argument_name) |
| | The only column references allowed in a masking function are unqualified names (no schema or table) that are equal to the policy's argument name. More...
|
| |
| static bool | validate_masking_function_syntax (THD *thd, Item *masking_func, LEX_CSTRING argument_name) |
| | Perform pre-resolving checks for the validity of the masking function: More...
|
| |
| bool | validate_masking_policy_syntax (THD *thd, LEX_CSTRING argument_name, Item *expr) |
| | Validate structural and semantic restrictions for a masking policy expression. More...
|
| |
| static bool | compatible_string_types (const Item_field *col, const Item *expr) |
| | Check if both items have compatible (simple-string) types and collation. More...
|
| |
| static bool | is_simple_integer_or_year_type (enum_field_types type) |
| | Returns true if type is a plain integer or YEAR. More...
|
| |
| static bool | compatible_int_types (const Item_field *col, const Item *expr) |
| | Returns true if the types of the two items are identical, or if both are "simple" integers (including YEAR). More...
|
| |
| static bool | compatible_temporal_types (const Item_field *col, const Item *expr) |
| | Returns true if both items have the same temporal type (DATETIME and TIMESTAMP are considered the same type) with the same fractional seconds precision (FSP). More...
|
| |
| static bool | compatible_types (const Item_field *col, const Item *expr) |
| | Checks whether the column and resolved masking expression are type-compatible for masking. More...
|
| |
| static bool | validate_masking_policy_for_column (Item_field *item_field, Item *mask_expr) |
| | Validates that the resolved masking expression is appropriate for the specified column: checks type compatibility and that the expression is deterministic. More...
|
| |
| static Item * | wrap_gatekeeper_in_item_cache (Item *mask_expr) |
| |
| Item * | resolve_masking_expression (THD *thd, Item_field *item_field, const Sql_masking_policy_spec &spec) |
| | Parse and resolve the column’s masking expression under the column’s security context. More...
|
| |
| bool | validate_masking_policy_for_create_alter_table (THD *thd, uchar *buf, TABLE *table, const Create_field &field) |
| | Validates masking policies for CREATE/ALTER TABLE. More...
|
| |
| static bool validate_masking_policy_column_constraints |
( |
const Create_field & |
create_field | ) |
|
|
static |
Validates constraints for masking policy assignment on a column.
Central checker for column-level eligibility: enforces the constraints listed under "Checked here" and enumerates related constraints validated elsewhere (with pointers), so this block is the canonical index of eligibility rules.
Constraints checked here:
- The column must not be a generated column.
- For existing columns (create_field.field != nullptr), the column must not have a histogram.
Constraints validated elsewhere:
- The column must not be indexed. Checked in prepare_key_column().
- The column must not be referenced by generated columns, functional indexes, DEFAULT value expressions or CHECK constraints. Checked by Item_field::check_function_as_value_generator().
- The column must not be used by the table partitioning/subpartitioning function. This is enforced during partition function fixing in sql_partition.cc (fix_partition_func/create_partition_field_array), which raises ER_MASKING_POLICY_INCOMPATIBLE_COLUMN_FEATURE when a partition key references a masked column.
- Parameters
-
| create_field | Create_field object for the column to validate |
- Return values
-
| true | Validation failed, error was reported |
| false | Validation succeeded |
| static bool validate_masking_policy_for_column |
( |
Item_field * |
item_field, |
|
|
Item * |
mask_expr |
|
) |
| |
|
static |
Validates that the resolved masking expression is appropriate for the specified column: checks type compatibility and that the expression is deterministic.
Reports errors for incompatible/unsafe masking policies. Rationale: users permitted to see the unmasked value must observe behavior identical to a column without a policy: both presentation and semantics must match. In particular, comparison and ordering must not change (same collation/charset), and numeric precision/scale must be preserved; the expression must be deterministic. Assumes: mask_expr is fully resolved (types, collation/charset, nullability).