mirror of
https://github.com/MariaDB/server.git
synced 2025-01-17 12:32:27 +01:00
dc719597ee
This change takes into account a column's GENERATED ALWAYS AS expression dependcy on sql_mode's PAD_CHAR_TO_FULL_LENGTH and NO_UNSIGNED_SUBTRACTION flags. Indexed virtual columns as well as persistent generated columns are now not allowed to have such dependencies to avoid inconsistent data or index files on sql_mode changes. So an error is now returned in cases like this: CREATE OR REPLACE TABLE t1 ( a CHAR(5), v VARCHAR(5) AS (a) PERSISTENT -- CHAR->VARCHAR or CHAR->TEXT = ERROR ); Functions RPAD() and RTRIM() can now remove dependency on PAD_CHAR_TO_FULL_LENGTH. So this can be used instead: CREATE OR REPLACE TABLE t1 ( a CHAR(5), v VARCHAR(5) AS (RTRIM(a)) PERSISTENT ); Note, unlike CHAR->VARCHAR and CHAR->TEXT this still works, not RPAD(a) is needed: CREATE OR REPLACE TABLE t1 ( a CHAR(5), v CHAR(5) AS (a) PERSISTENT -- CHAR->CHAR is OK ); More sql_mode flags may affect values of generated columns. They will be addressed separately. See comments in sql_mode.h for implementation details. |
||
---|---|---|
.. | ||
vcol_cleanup.inc | ||
vcol_column_def_options.inc | ||
vcol_dependancies_on_vcol.inc | ||
vcol_handler.inc | ||
vcol_init_vars.pre | ||
vcol_ins_upd.inc | ||
vcol_keys.inc | ||
vcol_non_stored_columns.inc | ||
vcol_partition.inc | ||
vcol_select.inc | ||
vcol_supported_sql_funcs.inc | ||
vcol_trigger_sp.inc | ||
vcol_unsupported_storage_engines.inc | ||
vcol_view.inc |