Commit daf28db0 authored by Alexander Barkov's avatar Alexander Barkov

MDEV-21537 InnoDB INFORMATION_SCHEMA tables fail to define DEFAULT for ENUM NOT NULL

- Adding a way to define I_S columns without DEFAULT.
- Fixing all ENUM columns in I_S.INNODB* table definitions to have no DEFAULT.
parent c20bf8fd
...@@ -12,4 +12,3 @@ ...@@ -12,4 +12,3 @@
create-index-debug : MDEV-13680 InnoDB may crash when btr_page_alloc() fails create-index-debug : MDEV-13680 InnoDB may crash when btr_page_alloc() fails
innodb_wl6326 : MDEV-21535 Too broad ha_innobase::records_in_range() innodb_wl6326 : MDEV-21535 Too broad ha_innobase::records_in_range()
innodb_wl6326_big : MDEV-21537 invalid DEFAULT for ENUM NOT NULL column
...@@ -38,7 +38,7 @@ trx_lock_memory_bytes bigint(21) unsigned NO 0 ...@@ -38,7 +38,7 @@ trx_lock_memory_bytes bigint(21) unsigned NO 0
trx_rows_locked bigint(21) unsigned NO 0 trx_rows_locked bigint(21) unsigned NO 0
trx_rows_modified bigint(21) unsigned NO 0 trx_rows_modified bigint(21) unsigned NO 0
trx_concurrency_tickets bigint(21) unsigned NO 0 trx_concurrency_tickets bigint(21) unsigned NO 0
trx_isolation_level enum('READ UNCOMMITTED','READ COMMITTED','REPEATABLE READ','SERIALIZABLE') NO trx_isolation_level enum('READ UNCOMMITTED','READ COMMITTED','REPEATABLE READ','SERIALIZABLE') NO NULL
trx_unique_checks int(1) NO 0 trx_unique_checks int(1) NO 0
trx_foreign_key_checks int(1) NO 0 trx_foreign_key_checks int(1) NO 0
trx_last_foreign_key_error varchar(256) YES NULL trx_last_foreign_key_error varchar(256) YES NULL
......
...@@ -229,7 +229,7 @@ INSERT INTO my_metrics ...@@ -229,7 +229,7 @@ INSERT INTO my_metrics
SELECT NAME, COUNT, MAX_COUNT, MIN_COUNT, AVG_COUNT, SELECT NAME, COUNT, MAX_COUNT, MIN_COUNT, AVG_COUNT,
COUNT_RESET, MAX_COUNT_RESET, MIN_COUNT_RESET, AVG_COUNT_RESET, COUNT_RESET, MAX_COUNT_RESET, MIN_COUNT_RESET, AVG_COUNT_RESET,
TIME_ENABLED, TIME_DISABLED, TIME_ELAPSED, TIME_RESET, TIME_ENABLED, TIME_DISABLED, TIME_ELAPSED, TIME_RESET,
STATUS, 'before' ENABLED, 'before'
FROM information_schema.innodb_metrics FROM information_schema.innodb_metrics
WHERE NAME LIKE 'innodb_rwlock_sx_%'; WHERE NAME LIKE 'innodb_rwlock_sx_%';
# TC-01 There are exact three entries "innodb_rwlock_sx_%" with the # TC-01 There are exact three entries "innodb_rwlock_sx_%" with the
...@@ -254,7 +254,7 @@ INSERT INTO my_metrics ...@@ -254,7 +254,7 @@ INSERT INTO my_metrics
SELECT NAME, COUNT, MAX_COUNT, MIN_COUNT, AVG_COUNT, SELECT NAME, COUNT, MAX_COUNT, MIN_COUNT, AVG_COUNT,
COUNT_RESET, MAX_COUNT_RESET, MIN_COUNT_RESET, AVG_COUNT_RESET, COUNT_RESET, MAX_COUNT_RESET, MIN_COUNT_RESET, AVG_COUNT_RESET,
TIME_ENABLED, TIME_DISABLED, TIME_ELAPSED, TIME_RESET, TIME_ENABLED, TIME_DISABLED, TIME_ELAPSED, TIME_RESET,
STATUS, 'before' ENABLED, 'before'
FROM information_schema.innodb_metrics FROM information_schema.innodb_metrics
WHERE NAME LIKE 'innodb_rwlock_sx_%'; WHERE NAME LIKE 'innodb_rwlock_sx_%';
SET @extra_string = '__0_'; SET @extra_string = '__0_';
...@@ -369,7 +369,7 @@ INSERT INTO my_metrics ...@@ -369,7 +369,7 @@ INSERT INTO my_metrics
SELECT NAME, COUNT, MAX_COUNT, MIN_COUNT, AVG_COUNT, SELECT NAME, COUNT, MAX_COUNT, MIN_COUNT, AVG_COUNT,
COUNT_RESET, MAX_COUNT_RESET, MIN_COUNT_RESET, AVG_COUNT_RESET, COUNT_RESET, MAX_COUNT_RESET, MIN_COUNT_RESET, AVG_COUNT_RESET,
TIME_ENABLED, TIME_DISABLED, TIME_ELAPSED, TIME_RESET, TIME_ENABLED, TIME_DISABLED, TIME_ELAPSED, TIME_RESET,
STATUS, 'after' ENABLED, 'after'
FROM information_schema.innodb_metrics FROM information_schema.innodb_metrics
WHERE NAME LIKE 'innodb_rwlock_sx_%'; WHERE NAME LIKE 'innodb_rwlock_sx_%';
# TC-16 The following activities happend after reset in innodb_metrics # TC-16 The following activities happend after reset in innodb_metrics
...@@ -389,7 +389,7 @@ INSERT INTO my_metrics ...@@ -389,7 +389,7 @@ INSERT INTO my_metrics
SELECT NAME, COUNT, MAX_COUNT, MIN_COUNT, AVG_COUNT, SELECT NAME, COUNT, MAX_COUNT, MIN_COUNT, AVG_COUNT,
COUNT_RESET, MAX_COUNT_RESET, MIN_COUNT_RESET, AVG_COUNT_RESET, COUNT_RESET, MAX_COUNT_RESET, MIN_COUNT_RESET, AVG_COUNT_RESET,
TIME_ENABLED, TIME_DISABLED, TIME_ELAPSED, TIME_RESET, TIME_ENABLED, TIME_DISABLED, TIME_ELAPSED, TIME_RESET,
STATUS, 'before' ENABLED, 'before'
FROM information_schema.innodb_metrics FROM information_schema.innodb_metrics
WHERE NAME LIKE 'innodb_rwlock_sx_%'; WHERE NAME LIKE 'innodb_rwlock_sx_%';
SET GLOBAL innodb_monitor_reset = "innodb_rwlock_sx_%"; SET GLOBAL innodb_monitor_reset = "innodb_rwlock_sx_%";
...@@ -397,7 +397,7 @@ INSERT INTO my_metrics ...@@ -397,7 +397,7 @@ INSERT INTO my_metrics
SELECT NAME, COUNT, MAX_COUNT, MIN_COUNT, AVG_COUNT, SELECT NAME, COUNT, MAX_COUNT, MIN_COUNT, AVG_COUNT,
COUNT_RESET, MAX_COUNT_RESET, MIN_COUNT_RESET, AVG_COUNT_RESET, COUNT_RESET, MAX_COUNT_RESET, MIN_COUNT_RESET, AVG_COUNT_RESET,
TIME_ENABLED, TIME_DISABLED, TIME_ELAPSED, TIME_RESET, TIME_ENABLED, TIME_DISABLED, TIME_ELAPSED, TIME_RESET,
STATUS, 'after' ENABLED, 'after'
FROM information_schema.innodb_metrics FROM information_schema.innodb_metrics
WHERE NAME LIKE 'innodb_rwlock_sx_%'; WHERE NAME LIKE 'innodb_rwlock_sx_%';
# TC-08 There was a reset. COUNT_RESET = MAX_COUNT_RESET for ALL # TC-08 There was a reset. COUNT_RESET = MAX_COUNT_RESET for ALL
......
...@@ -163,19 +163,19 @@ let $before_my_metrics= INSERT INTO my_metrics ...@@ -163,19 +163,19 @@ let $before_my_metrics= INSERT INTO my_metrics
SELECT NAME, COUNT, MAX_COUNT, MIN_COUNT, AVG_COUNT, SELECT NAME, COUNT, MAX_COUNT, MIN_COUNT, AVG_COUNT,
COUNT_RESET, MAX_COUNT_RESET, MIN_COUNT_RESET, AVG_COUNT_RESET, COUNT_RESET, MAX_COUNT_RESET, MIN_COUNT_RESET, AVG_COUNT_RESET,
TIME_ENABLED, TIME_DISABLED, TIME_ELAPSED, TIME_RESET, TIME_ENABLED, TIME_DISABLED, TIME_ELAPSED, TIME_RESET,
STATUS, 'before' ENABLED, 'before'
FROM information_schema.innodb_metrics FROM information_schema.innodb_metrics
WHERE NAME LIKE 'innodb_rwlock_sx_%'; WHERE NAME LIKE 'innodb_rwlock_sx_%';
let $after_my_metrics= INSERT INTO my_metrics let $after_my_metrics= INSERT INTO my_metrics
SELECT NAME, COUNT, MAX_COUNT, MIN_COUNT, AVG_COUNT, SELECT NAME, COUNT, MAX_COUNT, MIN_COUNT, AVG_COUNT,
COUNT_RESET, MAX_COUNT_RESET, MIN_COUNT_RESET, AVG_COUNT_RESET, COUNT_RESET, MAX_COUNT_RESET, MIN_COUNT_RESET, AVG_COUNT_RESET,
TIME_ENABLED, TIME_DISABLED, TIME_ELAPSED, TIME_RESET, TIME_ENABLED, TIME_DISABLED, TIME_ELAPSED, TIME_RESET,
STATUS, 'after' ENABLED, 'after'
FROM information_schema.innodb_metrics FROM information_schema.innodb_metrics
WHERE NAME LIKE 'innodb_rwlock_sx_%'; WHERE NAME LIKE 'innodb_rwlock_sx_%';
let $print_metrics= SELECT NAME, COUNT, MAX_COUNT, MIN_COUNT, AVG_COUNT, let $print_metrics= SELECT NAME, COUNT, MAX_COUNT, MIN_COUNT, AVG_COUNT,
COUNT_RESET, MAX_COUNT_RESET, MIN_COUNT_RESET, AVG_COUNT_RESET, COUNT_RESET, MAX_COUNT_RESET, MIN_COUNT_RESET, AVG_COUNT_RESET,
TIME_ENABLED, TIME_DISABLED, TIME_ELAPSED, TIME_RESET, STATUS TIME_ENABLED, TIME_DISABLED, TIME_ELAPSED, TIME_RESET, ENABLED
FROM information_schema.innodb_metrics FROM information_schema.innodb_metrics
WHERE NAME LIKE 'innodb_rwlock_sx_%' WHERE NAME LIKE 'innodb_rwlock_sx_%'
ORDER BY NAME; ORDER BY NAME;
...@@ -315,12 +315,12 @@ SELECT COUNT(*) INTO @sx_count FROM my_metrics; ...@@ -315,12 +315,12 @@ SELECT COUNT(*) INTO @sx_count FROM my_metrics;
--echo # TC-02 Counting is now enabled. ALL = @sx_count entries show that. --echo # TC-02 Counting is now enabled. ALL = @sx_count entries show that.
let $check_statement= let $check_statement=
SELECT COUNT(*) <> @sx_count FROM my_metrics SELECT COUNT(*) <> @sx_count FROM my_metrics
WHERE STATUS = 'enabled'; WHERE ENABLED;
if(`$check_statement`) if(`$check_statement`)
{ {
--echo # fail --echo # fail
eval $check_statement; eval $check_statement;
SELECT NAME, STATUS FROM my_metrics SELECT NAME, ENABLED FROM my_metrics
ORDER BY NAME; ORDER BY NAME;
exit; exit;
} }
......
...@@ -17,8 +17,12 @@ INNODB_BUFFER_PAGE CREATE TEMPORARY TABLE `INNODB_BUFFER_PAGE` ( ...@@ -17,8 +17,12 @@ INNODB_BUFFER_PAGE CREATE TEMPORARY TABLE `INNODB_BUFFER_PAGE` (
`NUMBER_RECORDS` bigint(21) unsigned NOT NULL DEFAULT 0, `NUMBER_RECORDS` bigint(21) unsigned NOT NULL DEFAULT 0,
`DATA_SIZE` bigint(21) unsigned NOT NULL DEFAULT 0, `DATA_SIZE` bigint(21) unsigned NOT NULL DEFAULT 0,
`COMPRESSED_SIZE` bigint(21) unsigned NOT NULL DEFAULT 0, `COMPRESSED_SIZE` bigint(21) unsigned NOT NULL DEFAULT 0,
`PAGE_STATE` enum('NOT_USED','READY_FOR_USE','FILE_PAGE','MEMORY','REMOVE_HASH') NOT NULL DEFAULT '', `PAGE_STATE` enum('NOT_USED','READY_FOR_USE','FILE_PAGE','MEMORY','REMOVE_HASH') NOT NULL,
`IO_FIX` enum('IO_NONE','IO_READ','IO_WRITE','IO_PIN') NOT NULL DEFAULT '', `IO_FIX` enum('IO_NONE','IO_READ','IO_WRITE','IO_PIN') NOT NULL,
`IS_OLD` int(1) NOT NULL DEFAULT 0, `IS_OLD` int(1) NOT NULL DEFAULT 0,
`FREE_PAGE_CLOCK` bigint(21) unsigned NOT NULL DEFAULT 0 `FREE_PAGE_CLOCK` bigint(21) unsigned NOT NULL DEFAULT 0
) ENGINE=MEMORY DEFAULT CHARSET=utf8 ) ENGINE=MEMORY DEFAULT CHARSET=utf8
CREATE TEMPORARY TABLE t1 LIKE INFORMATION_SCHEMA.INNODB_BUFFER_PAGE;
DROP TEMPORARY TABLE t1;
CREATE TEMPORARY TABLE t1 AS SELECT * FROM INFORMATION_SCHEMA.INNODB_BUFFER_PAGE LIMIT 0;
DROP TEMPORARY TABLE t1;
--source include/have_innodb.inc --source include/have_innodb.inc
SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_BUFFER_PAGE; SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_BUFFER_PAGE;
CREATE TEMPORARY TABLE t1 LIKE INFORMATION_SCHEMA.INNODB_BUFFER_PAGE;
DROP TEMPORARY TABLE t1;
CREATE TEMPORARY TABLE t1 AS SELECT * FROM INFORMATION_SCHEMA.INNODB_BUFFER_PAGE LIMIT 0;
DROP TEMPORARY TABLE t1;
...@@ -18,7 +18,11 @@ INNODB_BUFFER_PAGE_LRU CREATE TEMPORARY TABLE `INNODB_BUFFER_PAGE_LRU` ( ...@@ -18,7 +18,11 @@ INNODB_BUFFER_PAGE_LRU CREATE TEMPORARY TABLE `INNODB_BUFFER_PAGE_LRU` (
`DATA_SIZE` bigint(21) unsigned NOT NULL DEFAULT 0, `DATA_SIZE` bigint(21) unsigned NOT NULL DEFAULT 0,
`COMPRESSED_SIZE` bigint(21) unsigned NOT NULL DEFAULT 0, `COMPRESSED_SIZE` bigint(21) unsigned NOT NULL DEFAULT 0,
`COMPRESSED` int(1) NOT NULL DEFAULT 0, `COMPRESSED` int(1) NOT NULL DEFAULT 0,
`IO_FIX` enum('IO_NONE','IO_READ','IO_WRITE','IO_PIN') NOT NULL DEFAULT '', `IO_FIX` enum('IO_NONE','IO_READ','IO_WRITE','IO_PIN') NOT NULL,
`IS_OLD` int(1) DEFAULT NULL, `IS_OLD` int(1) DEFAULT NULL,
`FREE_PAGE_CLOCK` bigint(21) unsigned NOT NULL DEFAULT 0 `FREE_PAGE_CLOCK` bigint(21) unsigned NOT NULL DEFAULT 0
) ENGINE=MEMORY DEFAULT CHARSET=utf8 ) ENGINE=MEMORY DEFAULT CHARSET=utf8
CREATE TEMPORARY TABLE t1 LIKE INFORMATION_SCHEMA.INNODB_BUFFER_PAGE_LRU;
DROP TEMPORARY TABLE t1;
CREATE TEMPORARY TABLE t1 AS SELECT * FROM INFORMATION_SCHEMA.INNODB_BUFFER_PAGE_LRU LIMIT 0;
DROP TEMPORARY TABLE t1;
--source include/have_innodb.inc --source include/have_innodb.inc
SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_BUFFER_PAGE_LRU; SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_BUFFER_PAGE_LRU;
CREATE TEMPORARY TABLE t1 LIKE INFORMATION_SCHEMA.INNODB_BUFFER_PAGE_LRU;
DROP TEMPORARY TABLE t1;
CREATE TEMPORARY TABLE t1 AS SELECT * FROM INFORMATION_SCHEMA.INNODB_BUFFER_PAGE_LRU LIMIT 0;
DROP TEMPORARY TABLE t1;
...@@ -3,8 +3,8 @@ Table Create Table ...@@ -3,8 +3,8 @@ Table Create Table
INNODB_LOCKS CREATE TEMPORARY TABLE `INNODB_LOCKS` ( INNODB_LOCKS CREATE TEMPORARY TABLE `INNODB_LOCKS` (
`lock_id` varchar(81) NOT NULL DEFAULT '', `lock_id` varchar(81) NOT NULL DEFAULT '',
`lock_trx_id` bigint(21) unsigned NOT NULL DEFAULT 0, `lock_trx_id` bigint(21) unsigned NOT NULL DEFAULT 0,
`lock_mode` enum('S','S,GAP','X','X,GAP','IS','IS,GAP','IX','IX,GAP','AUTO_INC') NOT NULL DEFAULT '', `lock_mode` enum('S','S,GAP','X','X,GAP','IS','IS,GAP','IX','IX,GAP','AUTO_INC') NOT NULL,
`lock_type` enum('RECORD','TABLE') NOT NULL DEFAULT '', `lock_type` enum('RECORD','TABLE') NOT NULL,
`lock_table` varchar(1024) NOT NULL DEFAULT '', `lock_table` varchar(1024) NOT NULL DEFAULT '',
`lock_index` varchar(1024) DEFAULT NULL, `lock_index` varchar(1024) DEFAULT NULL,
`lock_space` int(11) unsigned DEFAULT NULL, `lock_space` int(11) unsigned DEFAULT NULL,
...@@ -12,3 +12,7 @@ INNODB_LOCKS CREATE TEMPORARY TABLE `INNODB_LOCKS` ( ...@@ -12,3 +12,7 @@ INNODB_LOCKS CREATE TEMPORARY TABLE `INNODB_LOCKS` (
`lock_rec` int(11) unsigned DEFAULT NULL, `lock_rec` int(11) unsigned DEFAULT NULL,
`lock_data` varchar(8192) DEFAULT NULL `lock_data` varchar(8192) DEFAULT NULL
) ENGINE=MEMORY DEFAULT CHARSET=utf8 ) ENGINE=MEMORY DEFAULT CHARSET=utf8
CREATE TEMPORARY TABLE t1 LIKE INFORMATION_SCHEMA.INNODB_LOCKS;
DROP TEMPORARY TABLE t1;
CREATE TEMPORARY TABLE t1 AS SELECT * FROM INFORMATION_SCHEMA.INNODB_LOCKS LIMIT 0;
DROP TEMPORARY TABLE t1;
--source include/have_innodb.inc --source include/have_innodb.inc
SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_LOCKS; SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_LOCKS;
CREATE TEMPORARY TABLE t1 LIKE INFORMATION_SCHEMA.INNODB_LOCKS;
DROP TEMPORARY TABLE t1;
CREATE TEMPORARY TABLE t1 AS SELECT * FROM INFORMATION_SCHEMA.INNODB_LOCKS LIMIT 0;
DROP TEMPORARY TABLE t1;
...@@ -16,6 +16,10 @@ INNODB_METRICS CREATE TEMPORARY TABLE `INNODB_METRICS` ( ...@@ -16,6 +16,10 @@ INNODB_METRICS CREATE TEMPORARY TABLE `INNODB_METRICS` (
`TIME_ELAPSED` bigint(21) DEFAULT NULL, `TIME_ELAPSED` bigint(21) DEFAULT NULL,
`TIME_RESET` datetime DEFAULT NULL, `TIME_RESET` datetime DEFAULT NULL,
`ENABLED` int(1) NOT NULL DEFAULT 0, `ENABLED` int(1) NOT NULL DEFAULT 0,
`TYPE` enum('value','status_counter','set_owner','set_member','counter') NOT NULL DEFAULT '', `TYPE` enum('value','status_counter','set_owner','set_member','counter') NOT NULL,
`COMMENT` varchar(193) NOT NULL DEFAULT '' `COMMENT` varchar(193) NOT NULL DEFAULT ''
) ENGINE=MEMORY DEFAULT CHARSET=utf8 ) ENGINE=MEMORY DEFAULT CHARSET=utf8
CREATE TEMPORARY TABLE t1 LIKE INFORMATION_SCHEMA.INNODB_METRICS;
DROP TEMPORARY TABLE t1;
CREATE TEMPORARY TABLE t1 AS SELECT * FROM INFORMATION_SCHEMA.INNODB_METRICS LIMIT 0;
DROP TEMPORARY TABLE t1;
--source include/have_innodb.inc --source include/have_innodb.inc
SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_METRICS; SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_METRICS;
CREATE TEMPORARY TABLE t1 LIKE INFORMATION_SCHEMA.INNODB_METRICS;
DROP TEMPORARY TABLE t1;
CREATE TEMPORARY TABLE t1 AS SELECT * FROM INFORMATION_SCHEMA.INNODB_METRICS LIMIT 0;
DROP TEMPORARY TABLE t1;
...@@ -17,10 +17,14 @@ INNODB_TRX CREATE TEMPORARY TABLE `INNODB_TRX` ( ...@@ -17,10 +17,14 @@ INNODB_TRX CREATE TEMPORARY TABLE `INNODB_TRX` (
`trx_rows_locked` bigint(21) unsigned NOT NULL DEFAULT 0, `trx_rows_locked` bigint(21) unsigned NOT NULL DEFAULT 0,
`trx_rows_modified` bigint(21) unsigned NOT NULL DEFAULT 0, `trx_rows_modified` bigint(21) unsigned NOT NULL DEFAULT 0,
`trx_concurrency_tickets` bigint(21) unsigned NOT NULL DEFAULT 0, `trx_concurrency_tickets` bigint(21) unsigned NOT NULL DEFAULT 0,
`trx_isolation_level` enum('READ UNCOMMITTED','READ COMMITTED','REPEATABLE READ','SERIALIZABLE') NOT NULL DEFAULT '', `trx_isolation_level` enum('READ UNCOMMITTED','READ COMMITTED','REPEATABLE READ','SERIALIZABLE') NOT NULL,
`trx_unique_checks` int(1) NOT NULL DEFAULT 0, `trx_unique_checks` int(1) NOT NULL DEFAULT 0,
`trx_foreign_key_checks` int(1) NOT NULL DEFAULT 0, `trx_foreign_key_checks` int(1) NOT NULL DEFAULT 0,
`trx_last_foreign_key_error` varchar(256) DEFAULT NULL, `trx_last_foreign_key_error` varchar(256) DEFAULT NULL,
`trx_is_read_only` int(1) NOT NULL DEFAULT 0, `trx_is_read_only` int(1) NOT NULL DEFAULT 0,
`trx_autocommit_non_locking` int(1) NOT NULL DEFAULT 0 `trx_autocommit_non_locking` int(1) NOT NULL DEFAULT 0
) ENGINE=MEMORY DEFAULT CHARSET=utf8 ) ENGINE=MEMORY DEFAULT CHARSET=utf8
CREATE TEMPORARY TABLE t1 LIKE INFORMATION_SCHEMA.INNODB_TRX;
DROP TEMPORARY TABLE t1;
CREATE TEMPORARY TABLE t1 AS SELECT * FROM INFORMATION_SCHEMA.INNODB_TRX LIMIT 0;
DROP TEMPORARY TABLE t1;
--source include/have_innodb.inc --source include/have_innodb.inc
SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_TRX; SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_TRX;
CREATE TEMPORARY TABLE t1 LIKE INFORMATION_SCHEMA.INNODB_TRX;
DROP TEMPORARY TABLE t1;
CREATE TEMPORARY TABLE t1 AS SELECT * FROM INFORMATION_SCHEMA.INNODB_TRX LIMIT 0;
DROP TEMPORARY TABLE t1;
...@@ -45,6 +45,13 @@ enum enum_show_open_table ...@@ -45,6 +45,13 @@ enum enum_show_open_table
}; };
enum enum_show_default
{
DEFAULT_TYPE_IMPLICIT= 0,
DEFAULT_NONE
};
namespace Show { namespace Show {
class Type class Type
{ {
...@@ -88,21 +95,30 @@ class ST_FIELD_INFO: public Show::Type ...@@ -88,21 +95,30 @@ class ST_FIELD_INFO: public Show::Type
protected: protected:
LEX_CSTRING m_name; // I_S column name LEX_CSTRING m_name; // I_S column name
enum_nullability m_nullability; // NULLABLE or NOT NULL enum_nullability m_nullability; // NULLABLE or NOT NULL
enum_show_default m_def; // Whether has a DEFAULT value
LEX_CSTRING m_old_name; // SHOW column name LEX_CSTRING m_old_name; // SHOW column name
enum_show_open_table m_open_method; enum_show_open_table m_open_method;
public: public:
ST_FIELD_INFO(const LEX_CSTRING &name, const Type &type, ST_FIELD_INFO(const LEX_CSTRING &name, const Type &type,
enum_nullability nullability, enum_nullability nullability,
enum_show_default def,
LEX_CSTRING &old_name, LEX_CSTRING &old_name,
enum_show_open_table open_method) enum_show_open_table open_method)
:Type(type), m_name(name), m_nullability(nullability), m_old_name(old_name), :Type(type), m_name(name),
m_nullability(nullability),
m_def(def),
m_old_name(old_name),
m_open_method(open_method) m_open_method(open_method)
{ } { }
ST_FIELD_INFO(const char *name, const Type &type, ST_FIELD_INFO(const char *name, const Type &type,
enum_nullability nullability, enum_nullability nullability,
enum_show_default def,
const char *old_name, const char *old_name,
enum_show_open_table open_method) enum_show_open_table open_method)
:Type(type), m_nullability(nullability), m_open_method(open_method) :Type(type),
m_nullability(nullability),
m_def(def),
m_open_method(open_method)
{ {
m_name.str= name; m_name.str= name;
m_name.length= safe_strlen(name); m_name.length= safe_strlen(name);
...@@ -111,6 +127,7 @@ class ST_FIELD_INFO: public Show::Type ...@@ -111,6 +127,7 @@ class ST_FIELD_INFO: public Show::Type
} }
const LEX_CSTRING &name() const { return m_name; } const LEX_CSTRING &name() const { return m_name; }
bool nullable() const { return m_nullability == NULLABLE; } bool nullable() const { return m_nullability == NULLABLE; }
enum_show_default def() const { return m_def; }
const LEX_CSTRING &old_name() const { return m_old_name; } const LEX_CSTRING &old_name() const { return m_old_name; }
enum_show_open_table open_method() const { return m_open_method; } enum_show_open_table open_method() const { return m_open_method; }
bool end_marker() const { return m_name.str == NULL; } bool end_marker() const { return m_name.str == NULL; }
...@@ -279,14 +296,30 @@ class Float: public Type ...@@ -279,14 +296,30 @@ class Float: public Type
class Column: public ST_FIELD_INFO class Column: public ST_FIELD_INFO
{ {
public: public:
Column(const char *name, const Type &type, enum_nullability nullability, Column(const char *name, const Type &type,
enum_nullability nullability,
enum_show_default def,
const char *old_name, const char *old_name,
enum_show_open_table open_method= SKIP_OPEN_TABLE) enum_show_open_table open_method= SKIP_OPEN_TABLE)
:ST_FIELD_INFO(name, type, nullability, old_name, open_method) :ST_FIELD_INFO(name, type, nullability, def, old_name, open_method)
{ } { }
Column(const char *name, const Type &type, enum_nullability nullability, Column(const char *name, const Type &type, enum_nullability nullability,
enum_show_default def,
enum_show_open_table open_method= SKIP_OPEN_TABLE)
:ST_FIELD_INFO(name, type, nullability, def, NullS, open_method)
{ }
Column(const char *name, const Type &type,
enum_nullability nullability,
const char *old_name,
enum_show_open_table open_method= SKIP_OPEN_TABLE)
:ST_FIELD_INFO(name, type, nullability, DEFAULT_TYPE_IMPLICIT,
old_name, open_method)
{ }
Column(const char *name, const Type &type,
enum_nullability nullability,
enum_show_open_table open_method= SKIP_OPEN_TABLE) enum_show_open_table open_method= SKIP_OPEN_TABLE)
:Column(name, type, nullability, NullS, open_method) :ST_FIELD_INFO(name, type, nullability, DEFAULT_TYPE_IMPLICIT,
NullS, open_method)
{ } { }
}; };
......
...@@ -18897,6 +18897,16 @@ bool Create_tmp_table::add_schema_fields(THD *thd, TABLE *table, ...@@ -18897,6 +18897,16 @@ bool Create_tmp_table::add_schema_fields(THD *thd, TABLE *table,
DBUG_RETURN(true); // EOM DBUG_RETURN(true); // EOM
} }
field->init(table); field->init(table);
switch (def.def()) {
case DEFAULT_NONE:
field->flags|= NO_DEFAULT_VALUE_FLAG;
break;
case DEFAULT_TYPE_IMPLICIT:
break;
default:
DBUG_ASSERT(0);
break;
}
add_field(table, field, fieldnr, param->force_not_null_cols); add_field(table, field, fieldnr, param->force_not_null_cols);
} }
......
...@@ -337,7 +337,7 @@ static ST_FIELD_INFO innodb_trx_fields_info[] = ...@@ -337,7 +337,7 @@ static ST_FIELD_INFO innodb_trx_fields_info[] =
#define IDX_TRX_ISOLATION_LEVEL 16 #define IDX_TRX_ISOLATION_LEVEL 16
Column("trx_isolation_level", Column("trx_isolation_level",
Enum(&isolation_level_values_typelib), NOT_NULL), Enum(&isolation_level_values_typelib), NOT_NULL, DEFAULT_NONE),
#define IDX_TRX_UNIQUE_CHECKS 17 #define IDX_TRX_UNIQUE_CHECKS 17
Column("trx_unique_checks", SLong(1), NOT_NULL), Column("trx_unique_checks", SLong(1), NOT_NULL),
...@@ -616,10 +616,10 @@ static ST_FIELD_INFO innodb_locks_fields_info[] = ...@@ -616,10 +616,10 @@ static ST_FIELD_INFO innodb_locks_fields_info[] =
Column("lock_trx_id", ULonglong(), NOT_NULL), Column("lock_trx_id", ULonglong(), NOT_NULL),
#define IDX_LOCK_MODE 2 #define IDX_LOCK_MODE 2
Column("lock_mode", Enum(&lock_mode_values_typelib), NOT_NULL), Column("lock_mode", Enum(&lock_mode_values_typelib), NOT_NULL, DEFAULT_NONE),
#define IDX_LOCK_TYPE 3 #define IDX_LOCK_TYPE 3
Column("lock_type", Enum(&lock_type_values_typelib), NOT_NULL), Column("lock_type", Enum(&lock_type_values_typelib), NOT_NULL, DEFAULT_NONE),
#define IDX_LOCK_TABLE 4 #define IDX_LOCK_TABLE 4
Column("lock_table", Varchar(1024), NOT_NULL), Column("lock_table", Varchar(1024), NOT_NULL),
...@@ -1915,7 +1915,7 @@ static ST_FIELD_INFO innodb_metrics_fields_info[] = ...@@ -1915,7 +1915,7 @@ static ST_FIELD_INFO innodb_metrics_fields_info[] =
Column("ENABLED", SLong(1), NOT_NULL), Column("ENABLED", SLong(1), NOT_NULL),
#define METRIC_TYPE 15 #define METRIC_TYPE 15
Column("TYPE", Enum(&metric_type_values_typelib), NOT_NULL), Column("TYPE", Enum(&metric_type_values_typelib), NOT_NULL, DEFAULT_NONE),
#define METRIC_DESC 16 #define METRIC_DESC 16
Column("COMMENT", Varchar(NAME_LEN + 1), NOT_NULL), Column("COMMENT", Varchar(NAME_LEN + 1), NOT_NULL),
...@@ -3990,10 +3990,10 @@ static ST_FIELD_INFO i_s_innodb_buffer_page_fields_info[] = ...@@ -3990,10 +3990,10 @@ static ST_FIELD_INFO i_s_innodb_buffer_page_fields_info[] =
Column("COMPRESSED_SIZE", ULonglong(), NOT_NULL), Column("COMPRESSED_SIZE", ULonglong(), NOT_NULL),
#define IDX_BUFFER_PAGE_STATE 15 + I_S_AHI #define IDX_BUFFER_PAGE_STATE 15 + I_S_AHI
Column("PAGE_STATE", Enum(&page_state_values_typelib), NOT_NULL), Column("PAGE_STATE", Enum(&page_state_values_typelib), NOT_NULL, DEFAULT_NONE),
#define IDX_BUFFER_PAGE_IO_FIX 16 + I_S_AHI #define IDX_BUFFER_PAGE_IO_FIX 16 + I_S_AHI
Column("IO_FIX", Enum(&io_values_typelib), NOT_NULL), Column("IO_FIX", Enum(&io_values_typelib), NOT_NULL, DEFAULT_NONE),
#define IDX_BUFFER_PAGE_IS_OLD 17 + I_S_AHI #define IDX_BUFFER_PAGE_IS_OLD 17 + I_S_AHI
Column("IS_OLD", SLong(1), NOT_NULL), Column("IS_OLD", SLong(1), NOT_NULL),
...@@ -4561,7 +4561,7 @@ static ST_FIELD_INFO i_s_innodb_buf_page_lru_fields_info[] = ...@@ -4561,7 +4561,7 @@ static ST_FIELD_INFO i_s_innodb_buf_page_lru_fields_info[] =
Column("COMPRESSED", SLong(1), NOT_NULL), Column("COMPRESSED", SLong(1), NOT_NULL),
#define IDX_BUF_LRU_PAGE_IO_FIX 16 + I_S_AHI #define IDX_BUF_LRU_PAGE_IO_FIX 16 + I_S_AHI
Column("IO_FIX", Enum(&io_values_typelib), NOT_NULL), Column("IO_FIX", Enum(&io_values_typelib), NOT_NULL, DEFAULT_NONE),
#define IDX_BUF_LRU_PAGE_IS_OLD 17 + I_S_AHI #define IDX_BUF_LRU_PAGE_IS_OLD 17 + I_S_AHI
Column("IS_OLD", SLong(1), NULLABLE), Column("IS_OLD", SLong(1), NULLABLE),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment