mariadb/mysql-test/suite/vcol/inc
Alexander Barkov dc719597ee MDEV-18156 Assertion 0' failed or btr_validate_index(index, 0, false)' in row_upd_sec_index_entry or error code 126: Index is corrupted upon DELETE with PAD_CHAR_TO_FULL_LENGTH
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.
2019-09-03 05:34:53 +04:00
..
vcol_cleanup.inc
vcol_column_def_options.inc
vcol_dependancies_on_vcol.inc
vcol_handler.inc
vcol_init_vars.pre
vcol_ins_upd.inc MDEV-7635: Update tests to adapt to the new default sql_mode 2017-02-10 06:30:42 -05:00
vcol_keys.inc cleanup: don't ---replace_regex /#sql-.*/#sql-temporary/ 2019-02-05 01:34:17 +01:00
vcol_non_stored_columns.inc MDEV-11066 use MySQL terminology for "virtual columns" 2016-12-12 20:35:51 +01:00
vcol_partition.inc bugfix: non-deterministic vcols in partitioning 2016-12-12 20:35:50 +01:00
vcol_select.inc Set new default values for the optimizer switch flags 'derived_merge' 2011-11-26 14:23:00 -08:00
vcol_supported_sql_funcs.inc MDEV-7635: Update tests to adapt to the new default sql_mode 2017-02-10 06:30:42 -05:00
vcol_trigger_sp.inc MDEV-18156 Assertion 0' failed or btr_validate_index(index, 0, false)' in row_upd_sec_index_entry or error code 126: Index is corrupted upon DELETE with PAD_CHAR_TO_FULL_LENGTH 2019-09-03 05:34:53 +04:00
vcol_unsupported_storage_engines.inc MDEV-11066 use MySQL terminology for "virtual columns" 2016-12-12 20:35:51 +01:00
vcol_view.inc Made the optimizer switch flags 'outer_join_with_cache', 'semijoin_with_cache' 2011-12-15 00:21:15 -08:00