MDEV-9524 Cannot load from mysql.event when sql_mode is set to PAD_CHAR_TO_FULL_LENGTH

The patch fixes the problem with loading information from system tables
(e.g. event and help related tables) when PAD_CHAR_TO_FULL_LENGTH is enabled,
as well as includes some additional minor improvements:
- refactoring in get_field() to return an error rather than success
  if strmake_root() failed
- removing of duplicate code in similar functions:
  char *get_field(MEM_ROOT *mem, Field *field)
  bool get_field(MEM_ROOT *mem, Field *field, String *res)
This commit is contained in:
Alexander Barkov 2016-06-21 21:26:31 +04:00
commit 21479a6bb3
6 changed files with 86 additions and 19 deletions

View file

@ -459,6 +459,25 @@ DROP EVENT ev1;
SHOW EVENTS;
--echo #
--echo # MDEV-9524 Cannot load from mysql.event when sql_mode is set to PAD_CHAR_TO_FULL_LENGTH
--echo #
CREATE TABLE t1 (a INT);
CREATE EVENT ev1 ON SCHEDULE EVERY 5 SECOND DO DELETE FROM t1;
--replace_column 8 # 9 #
SHOW EVENTS;
SET sql_mode=PAD_CHAR_TO_FULL_LENGTH;
--replace_column 8 # 9 #
SHOW EVENTS;
DROP EVENT ev1;
CREATE EVENT ev1 ON SCHEDULE EVERY 5 SECOND DO DELETE FROM t1;
--replace_column 8 # 9 #
SHOW EVENTS;
DROP EVENT ev1;
DROP TABLE t1;
SET sql_mode=DEFAULT;
--echo
--echo #
--echo # End of tests

View file

@ -61,6 +61,12 @@ help '%function_7';
help '%category_2';
help 'impossible_function_1';
help 'impossible_category_1';
--echo # MDEV-9524 Cannot load from mysql.event when sql_mode is set to PAD_CHAR_TO_FULL_LENGTH
help 'impossible_function_1';
SET sql_mode=PAD_CHAR_TO_FULL_LENGTH;
help 'impossible_function_1';
SET sql_mode=DEFAULT;
##############
--disable_warnings