mirror of
https://github.com/MariaDB/server.git
synced 2025-08-07 00:04:31 +03:00
MDEV-35308 NO_KEY_OPTIONS SQL mode has no effect on engine key options
hide INVISIBLE and engine field options under sql_mode=no_field_options hide PARSER and engine key options under sql_mode=no_key_options
This commit is contained in:
@@ -48,7 +48,7 @@ Warning 1911 Unknown option 'foo'
|
|||||||
show create table t1;
|
show create table t1;
|
||||||
Table Create Table
|
Table Create Table
|
||||||
t1 CREATE TABLE `t1` (
|
t1 CREATE TABLE `t1` (
|
||||||
`f1` int(11) INVISIBLE DEFAULT NULL,
|
`f1` int(11) DEFAULT NULL INVISIBLE,
|
||||||
`f2` int(11) DEFAULT NULL COMMENT 'a comment',
|
`f2` int(11) DEFAULT NULL COMMENT 'a comment',
|
||||||
`f3` int(11) DEFAULT NULL `foo`='bar',
|
`f3` int(11) DEFAULT NULL `foo`='bar',
|
||||||
`f4` int(11) DEFAULT NULL CHECK (`f4` < 10),
|
`f4` int(11) DEFAULT NULL CHECK (`f4` < 10),
|
||||||
|
@@ -40,7 +40,7 @@ show create table t1;
|
|||||||
Table Create Table
|
Table Create Table
|
||||||
t1 CREATE TABLE `t1` (
|
t1 CREATE TABLE `t1` (
|
||||||
`a` int(11) DEFAULT NULL,
|
`a` int(11) DEFAULT NULL,
|
||||||
`b` int(11) INVISIBLE DEFAULT NULL
|
`b` int(11) DEFAULT NULL INVISIBLE
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
|
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
|
||||||
select * from t2;
|
select * from t2;
|
||||||
a
|
a
|
||||||
@@ -58,7 +58,7 @@ show create table t2;
|
|||||||
Table Create Table
|
Table Create Table
|
||||||
t2 CREATE TABLE `t2` (
|
t2 CREATE TABLE `t2` (
|
||||||
`a` int(11) DEFAULT NULL,
|
`a` int(11) DEFAULT NULL,
|
||||||
`b` int(11) INVISIBLE DEFAULT 5
|
`b` int(11) DEFAULT 5 INVISIBLE
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
|
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
|
||||||
connection master;
|
connection master;
|
||||||
drop table t1,t2;
|
drop table t1,t2;
|
||||||
|
@@ -11,7 +11,7 @@ show create table t1;
|
|||||||
Table Create Table
|
Table Create Table
|
||||||
t1 CREATE TABLE `t1` (
|
t1 CREATE TABLE `t1` (
|
||||||
`abc` int(11) NOT NULL,
|
`abc` int(11) NOT NULL,
|
||||||
`xyz` int(11) INVISIBLE DEFAULT NULL,
|
`xyz` int(11) DEFAULT NULL INVISIBLE,
|
||||||
PRIMARY KEY (`abc`)
|
PRIMARY KEY (`abc`)
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
|
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
|
||||||
select TABLE_CATALOG,TABLE_SCHEMA,TABLE_NAME,COLUMN_NAME,EXTRA from INFORMATION_SCHEMA.COLUMNS where TABLE_SCHEMA='test' and TABLE_NAME='t1';
|
select TABLE_CATALOG,TABLE_SCHEMA,TABLE_NAME,COLUMN_NAME,EXTRA from INFORMATION_SCHEMA.COLUMNS where TABLE_SCHEMA='test' and TABLE_NAME='t1';
|
||||||
@@ -147,7 +147,7 @@ a int(11) YES NULL
|
|||||||
show create table t1;
|
show create table t1;
|
||||||
Table Create Table
|
Table Create Table
|
||||||
t1 CREATE TABLE `t1` (
|
t1 CREATE TABLE `t1` (
|
||||||
`abc` int(11) NOT NULL INVISIBLE AUTO_INCREMENT,
|
`abc` int(11) NOT NULL AUTO_INCREMENT INVISIBLE,
|
||||||
`a` int(11) DEFAULT NULL,
|
`a` int(11) DEFAULT NULL,
|
||||||
PRIMARY KEY (`abc`)
|
PRIMARY KEY (`abc`)
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
|
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
|
||||||
@@ -419,8 +419,8 @@ show create table t1;
|
|||||||
Table Create Table
|
Table Create Table
|
||||||
t1 CREATE TABLE `t1` (
|
t1 CREATE TABLE `t1` (
|
||||||
`a` int(11) NOT NULL,
|
`a` int(11) NOT NULL,
|
||||||
`b` int(11) INVISIBLE DEFAULT NULL,
|
`b` int(11) DEFAULT NULL INVISIBLE,
|
||||||
`c` int(11) INVISIBLE DEFAULT NULL,
|
`c` int(11) DEFAULT NULL INVISIBLE,
|
||||||
PRIMARY KEY (`a`),
|
PRIMARY KEY (`a`),
|
||||||
UNIQUE KEY `c` (`c`)
|
UNIQUE KEY `c` (`c`)
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
|
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
|
||||||
|
@@ -6299,7 +6299,7 @@ insert into t4 values(1);
|
|||||||
/*!40101 SET character_set_client = utf8 */;
|
/*!40101 SET character_set_client = utf8 */;
|
||||||
CREATE TABLE `t1` (
|
CREATE TABLE `t1` (
|
||||||
`a` int(11) DEFAULT NULL,
|
`a` int(11) DEFAULT NULL,
|
||||||
`b` int(11) INVISIBLE DEFAULT NULL
|
`b` int(11) DEFAULT NULL INVISIBLE
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
|
||||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||||
INSERT INTO `t1` (`a`, `b`) VALUES (1,NULL),
|
INSERT INTO `t1` (`a`, `b`) VALUES (1,NULL),
|
||||||
@@ -6318,8 +6318,8 @@ INSERT INTO `t2` VALUES
|
|||||||
/*!40101 SET character_set_client = utf8 */;
|
/*!40101 SET character_set_client = utf8 */;
|
||||||
CREATE TABLE `t3` (
|
CREATE TABLE `t3` (
|
||||||
`invisible` int(11) DEFAULT NULL,
|
`invisible` int(11) DEFAULT NULL,
|
||||||
`a b c & $!@#$%^&*( )` int(11) INVISIBLE DEFAULT 4,
|
`a b c & $!@#$%^&*( )` int(11) DEFAULT 4 INVISIBLE,
|
||||||
`ds=~!@ \# $% ^ & * ( ) _ - = +` int(11) INVISIBLE DEFAULT 5
|
`ds=~!@ \# $% ^ & * ( ) _ - = +` int(11) DEFAULT 5 INVISIBLE
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
|
||||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||||
INSERT INTO `t3` (`invisible`, `a b c & $!@#$%^&*( )`, `ds=~!@ \# $% ^ & * ( ) _ - = +`) VALUES (1,4,5),
|
INSERT INTO `t3` (`invisible`, `a b c & $!@#$%^&*( )`, `ds=~!@ \# $% ^ & * ( ) _ - = +`) VALUES (1,4,5),
|
||||||
@@ -6340,7 +6340,7 @@ INSERT INTO `t4` VALUES
|
|||||||
/*!40101 SET character_set_client = utf8 */;
|
/*!40101 SET character_set_client = utf8 */;
|
||||||
CREATE TABLE `t1` (
|
CREATE TABLE `t1` (
|
||||||
`a` int(11) DEFAULT NULL,
|
`a` int(11) DEFAULT NULL,
|
||||||
`b` int(11) INVISIBLE DEFAULT NULL
|
`b` int(11) DEFAULT NULL INVISIBLE
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
|
||||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||||
INSERT INTO `t1` (`a`, `b`) VALUES (1,NULL),
|
INSERT INTO `t1` (`a`, `b`) VALUES (1,NULL),
|
||||||
@@ -6358,8 +6358,8 @@ INSERT INTO `t2` (`a`, `b`) VALUES (1,2),
|
|||||||
/*!40101 SET character_set_client = utf8 */;
|
/*!40101 SET character_set_client = utf8 */;
|
||||||
CREATE TABLE `t3` (
|
CREATE TABLE `t3` (
|
||||||
`invisible` int(11) DEFAULT NULL,
|
`invisible` int(11) DEFAULT NULL,
|
||||||
`a b c & $!@#$%^&*( )` int(11) INVISIBLE DEFAULT 4,
|
`a b c & $!@#$%^&*( )` int(11) DEFAULT 4 INVISIBLE,
|
||||||
`ds=~!@ \# $% ^ & * ( ) _ - = +` int(11) INVISIBLE DEFAULT 5
|
`ds=~!@ \# $% ^ & * ( ) _ - = +` int(11) DEFAULT 5 INVISIBLE
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
|
||||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||||
INSERT INTO `t3` (`invisible`, `a b c & $!@#$%^&*( )`, `ds=~!@ \# $% ^ & * ( ) _ - = +`) VALUES (1,4,5),
|
INSERT INTO `t3` (`invisible`, `a b c & $!@#$%^&*( )`, `ds=~!@ \# $% ^ & * ( ) _ - = +`) VALUES (1,4,5),
|
||||||
|
@@ -148,7 +148,7 @@ f2 timestamp not null default current_timestamp on update current_timestamp);
|
|||||||
show create table t1;
|
show create table t1;
|
||||||
Table Create Table
|
Table Create Table
|
||||||
t1 CREATE TABLE "t1" (
|
t1 CREATE TABLE "t1" (
|
||||||
"f1" int(11) NOT NULL AUTO_INCREMENT,
|
"f1" int(11) NOT NULL,
|
||||||
"f2" timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
|
"f2" timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
|
||||||
PRIMARY KEY ("f1")
|
PRIMARY KEY ("f1")
|
||||||
)
|
)
|
||||||
|
@@ -9,8 +9,8 @@ show create table tf;
|
|||||||
Table Create Table
|
Table Create Table
|
||||||
tf CREATE TABLE `tf` (
|
tf CREATE TABLE `tf` (
|
||||||
`x` int(11) DEFAULT NULL,
|
`x` int(11) DEFAULT NULL,
|
||||||
`row_start` SYS_TYPE INVISIBLE DEFAULT '1971-01-01 00:00:00.000000',
|
`row_start` SYS_TYPE DEFAULT '1971-01-01 00:00:00.000000' INVISIBLE,
|
||||||
`row_end` SYS_TYPE INVISIBLE DEFAULT '1971-01-01 00:00:00.000000'
|
`row_end` SYS_TYPE DEFAULT '1971-01-01 00:00:00.000000' INVISIBLE
|
||||||
) ENGINE=FEDERATED DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci CONNECTION='mysql://root@127.0.0.1:MASTER_MYPORT/test/t1'
|
) ENGINE=FEDERATED DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci CONNECTION='mysql://root@127.0.0.1:MASTER_MYPORT/test/t1'
|
||||||
# INSERT
|
# INSERT
|
||||||
insert into t1 values (1);
|
insert into t1 values (1);
|
||||||
|
@@ -14,5 +14,74 @@ Variable_name Value
|
|||||||
install soname 'mypluglib';
|
install soname 'mypluglib';
|
||||||
set session_track_system_variables="*";
|
set session_track_system_variables="*";
|
||||||
set session simple_parser_simple_thdvar_one = 10;
|
set session simple_parser_simple_thdvar_one = 10;
|
||||||
|
set session_track_system_variables="";
|
||||||
uninstall soname 'mypluglib';
|
uninstall soname 'mypluglib';
|
||||||
# End of 10.5 tests
|
# End of 10.5 tests
|
||||||
|
#
|
||||||
|
# MDEV-35308 NO_KEY_OPTIONS SQL mode has no effect on engine key options
|
||||||
|
#
|
||||||
|
install soname 'mypluglib';
|
||||||
|
set sql_mode=ignore_bad_table_options;
|
||||||
|
create table t1 (
|
||||||
|
f1 int foo=bar primary key auto_increment,
|
||||||
|
f2 int default 3 invisible,
|
||||||
|
f3 text,
|
||||||
|
vf1 int as (f2+2) invisible,
|
||||||
|
unique (f1) koo=12,
|
||||||
|
fulltext (f3) with parser simple_parser
|
||||||
|
) too=yes;
|
||||||
|
Warnings:
|
||||||
|
Warning 1911 Unknown option 'foo'
|
||||||
|
Warning 1911 Unknown option 'koo'
|
||||||
|
Warning 1911 Unknown option 'too'
|
||||||
|
show create table t1;
|
||||||
|
Table Create Table
|
||||||
|
t1 CREATE TABLE `t1` (
|
||||||
|
`f1` int(11) NOT NULL AUTO_INCREMENT `foo`=bar,
|
||||||
|
`f2` int(11) DEFAULT 3 INVISIBLE,
|
||||||
|
`f3` text DEFAULT NULL,
|
||||||
|
`vf1` int(11) GENERATED ALWAYS AS (`f2` + 2) VIRTUAL INVISIBLE,
|
||||||
|
PRIMARY KEY (`f1`),
|
||||||
|
UNIQUE KEY `f1` (`f1`) `koo`=12,
|
||||||
|
FULLTEXT KEY `f3` (`f3`) WITH PARSER `simple_parser`
|
||||||
|
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci `too`=yes
|
||||||
|
set sql_mode=no_table_options;
|
||||||
|
show create table t1;
|
||||||
|
Table Create Table
|
||||||
|
t1 CREATE TABLE `t1` (
|
||||||
|
`f1` int(11) NOT NULL AUTO_INCREMENT /* `foo`=bar */,
|
||||||
|
`f2` int(11) DEFAULT 3 INVISIBLE,
|
||||||
|
`f3` text DEFAULT NULL,
|
||||||
|
`vf1` int(11) GENERATED ALWAYS AS (`f2` + 2) VIRTUAL INVISIBLE,
|
||||||
|
PRIMARY KEY (`f1`),
|
||||||
|
UNIQUE KEY `f1` (`f1`) /* `koo`=12 */,
|
||||||
|
FULLTEXT KEY `f3` (`f3`) WITH PARSER `simple_parser`
|
||||||
|
)
|
||||||
|
set sql_mode=no_field_options;
|
||||||
|
show create table t1;
|
||||||
|
Table Create Table
|
||||||
|
t1 CREATE TABLE `t1` (
|
||||||
|
`f1` int(11) NOT NULL,
|
||||||
|
`f2` int(11) DEFAULT 3,
|
||||||
|
`f3` text DEFAULT NULL,
|
||||||
|
`vf1` int(11) GENERATED ALWAYS AS (`f2` + 2) VIRTUAL,
|
||||||
|
PRIMARY KEY (`f1`),
|
||||||
|
UNIQUE KEY `f1` (`f1`) /* `koo`=12 */,
|
||||||
|
FULLTEXT KEY `f3` (`f3`) WITH PARSER `simple_parser`
|
||||||
|
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci /* `too`=yes */
|
||||||
|
set sql_mode=no_key_options;
|
||||||
|
show create table t1;
|
||||||
|
Table Create Table
|
||||||
|
t1 CREATE TABLE `t1` (
|
||||||
|
`f1` int(11) NOT NULL AUTO_INCREMENT /* `foo`=bar */,
|
||||||
|
`f2` int(11) DEFAULT 3 INVISIBLE,
|
||||||
|
`f3` text DEFAULT NULL,
|
||||||
|
`vf1` int(11) GENERATED ALWAYS AS (`f2` + 2) VIRTUAL INVISIBLE,
|
||||||
|
PRIMARY KEY (`f1`),
|
||||||
|
UNIQUE KEY `f1` (`f1`),
|
||||||
|
FULLTEXT KEY `f3` (`f3`)
|
||||||
|
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci /* `too`=yes */
|
||||||
|
drop table t1;
|
||||||
|
set sql_mode=default;
|
||||||
|
uninstall soname 'mypluglib';
|
||||||
|
# End of 11.7 tests
|
||||||
|
@@ -22,6 +22,33 @@ show status like 'a%status';
|
|||||||
install soname 'mypluglib';
|
install soname 'mypluglib';
|
||||||
set session_track_system_variables="*";
|
set session_track_system_variables="*";
|
||||||
set session simple_parser_simple_thdvar_one = 10;
|
set session simple_parser_simple_thdvar_one = 10;
|
||||||
|
set session_track_system_variables="";
|
||||||
uninstall soname 'mypluglib';
|
uninstall soname 'mypluglib';
|
||||||
|
|
||||||
--echo # End of 10.5 tests
|
--echo # End of 10.5 tests
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # MDEV-35308 NO_KEY_OPTIONS SQL mode has no effect on engine key options
|
||||||
|
--echo #
|
||||||
|
install soname 'mypluglib';
|
||||||
|
set sql_mode=ignore_bad_table_options;
|
||||||
|
create table t1 (
|
||||||
|
f1 int foo=bar primary key auto_increment,
|
||||||
|
f2 int default 3 invisible,
|
||||||
|
f3 text,
|
||||||
|
vf1 int as (f2+2) invisible,
|
||||||
|
unique (f1) koo=12,
|
||||||
|
fulltext (f3) with parser simple_parser
|
||||||
|
) too=yes;
|
||||||
|
show create table t1;
|
||||||
|
set sql_mode=no_table_options;
|
||||||
|
show create table t1;
|
||||||
|
set sql_mode=no_field_options;
|
||||||
|
show create table t1;
|
||||||
|
set sql_mode=no_key_options;
|
||||||
|
show create table t1;
|
||||||
|
drop table t1;
|
||||||
|
set sql_mode=default;
|
||||||
|
uninstall soname 'mypluglib';
|
||||||
|
|
||||||
|
--echo # End of 11.7 tests
|
||||||
|
111
sql/sql_show.cc
111
sql/sql_show.cc
@@ -152,8 +152,6 @@ static const LEX_CSTRING ha_choice_values[]=
|
|||||||
{ STRING_WITH_LEN("1") }
|
{ STRING_WITH_LEN("1") }
|
||||||
};
|
};
|
||||||
|
|
||||||
static void store_key_options(THD *, String *, TABLE_SHARE *, KEY *);
|
|
||||||
|
|
||||||
static int show_create_view(THD *thd, TABLE_LIST *table, String *buff);
|
static int show_create_view(THD *thd, TABLE_LIST *table, String *buff);
|
||||||
static int show_create_sequence(THD *thd, TABLE_LIST *table_list,
|
static int show_create_sequence(THD *thd, TABLE_LIST *table_list,
|
||||||
String *packet);
|
String *packet);
|
||||||
@@ -2186,9 +2184,8 @@ int show_create_table(THD *thd, TABLE_LIST *table_list, String *packet,
|
|||||||
0 OK
|
0 OK
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int show_create_table_ex(THD *thd, TABLE_LIST *table_list,
|
int show_create_table_ex(THD *thd, TABLE_LIST *table_list, const char *force_db,
|
||||||
const char *force_db, const char *force_name,
|
const char *force_name, String *packet,
|
||||||
String *packet,
|
|
||||||
Table_specification_st *create_info_arg,
|
Table_specification_st *create_info_arg,
|
||||||
enum_with_db_name with_db_name)
|
enum_with_db_name with_db_name)
|
||||||
{
|
{
|
||||||
@@ -2348,10 +2345,6 @@ int show_create_table_ex(THD *thd, TABLE_LIST *table_list,
|
|||||||
packet->append(STRING_WITH_LEN(" STORED"));
|
packet->append(STRING_WITH_LEN(" STORED"));
|
||||||
else
|
else
|
||||||
packet->append(STRING_WITH_LEN(" VIRTUAL"));
|
packet->append(STRING_WITH_LEN(" VIRTUAL"));
|
||||||
if (field->invisible == INVISIBLE_USER)
|
|
||||||
{
|
|
||||||
packet->append(STRING_WITH_LEN(" INVISIBLE"));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -2374,10 +2367,6 @@ int show_create_table_ex(THD *thd, TABLE_LIST *table_list,
|
|||||||
packet->append(STRING_WITH_LEN(" NULL"));
|
packet->append(STRING_WITH_LEN(" NULL"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (field->invisible == INVISIBLE_USER)
|
|
||||||
{
|
|
||||||
packet->append(STRING_WITH_LEN(" INVISIBLE"));
|
|
||||||
}
|
|
||||||
def_value.set(def_value_buf, sizeof(def_value_buf), system_charset_info);
|
def_value.set(def_value_buf, sizeof(def_value_buf), system_charset_info);
|
||||||
if (get_field_default_value(thd, field, &def_value, 1))
|
if (get_field_default_value(thd, field, &def_value, 1))
|
||||||
{
|
{
|
||||||
@@ -2396,10 +2385,19 @@ int show_create_table_ex(THD *thd, TABLE_LIST *table_list,
|
|||||||
packet->append(STRING_WITH_LEN(" "));
|
packet->append(STRING_WITH_LEN(" "));
|
||||||
packet->append(def_value);
|
packet->append(def_value);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (field->unireg_check == Field::NEXT_NUMBER &&
|
if (!(sql_mode & MODE_NO_FIELD_OPTIONS) && !foreign_db_mode)
|
||||||
!(sql_mode & MODE_NO_FIELD_OPTIONS))
|
{
|
||||||
|
if (field->unireg_check == Field::NEXT_NUMBER)
|
||||||
packet->append(STRING_WITH_LEN(" AUTO_INCREMENT"));
|
packet->append(STRING_WITH_LEN(" AUTO_INCREMENT"));
|
||||||
|
if (!limited_mysql_mode)
|
||||||
|
{
|
||||||
|
if (field->invisible == INVISIBLE_USER)
|
||||||
|
packet->append(STRING_WITH_LEN(" INVISIBLE"));
|
||||||
|
append_create_options(thd, packet, field->option_list, check_options,
|
||||||
|
hton->field_options);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (field->comment.length)
|
if (field->comment.length)
|
||||||
@@ -2408,9 +2406,6 @@ int show_create_table_ex(THD *thd, TABLE_LIST *table_list,
|
|||||||
append_unescaped(packet, field->comment.str, field->comment.length);
|
append_unescaped(packet, field->comment.str, field->comment.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
append_create_options(thd, packet, field->option_list, check_options,
|
|
||||||
hton->field_options);
|
|
||||||
|
|
||||||
if (field->check_constraint)
|
if (field->check_constraint)
|
||||||
{
|
{
|
||||||
StringBuffer<MAX_FIELD_WIDTH> str(&my_charset_utf8mb4_general_ci);
|
StringBuffer<MAX_FIELD_WIDTH> str(&my_charset_utf8mb4_general_ci);
|
||||||
@@ -2419,7 +2414,6 @@ int show_create_table_ex(THD *thd, TABLE_LIST *table_list,
|
|||||||
packet->append(str);
|
packet->append(str);
|
||||||
packet->append(STRING_WITH_LEN(")"));
|
packet->append(STRING_WITH_LEN(")"));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (period.name)
|
if (period.name)
|
||||||
@@ -2503,18 +2497,46 @@ int show_create_table_ex(THD *thd, TABLE_LIST *table_list,
|
|||||||
}
|
}
|
||||||
|
|
||||||
packet->append(')');
|
packet->append(')');
|
||||||
store_key_options(thd, packet, share, &share->key_info[i]);
|
|
||||||
|
if (!(sql_mode & (MODE_NO_KEY_OPTIONS | MODE_MYSQL323 | MODE_MYSQL40)) &&
|
||||||
|
!foreign_db_mode)
|
||||||
|
{
|
||||||
|
if (key_info->algorithm == HA_KEY_ALG_BTREE)
|
||||||
|
packet->append(STRING_WITH_LEN(" USING BTREE"));
|
||||||
|
|
||||||
|
if (key_info->algorithm == HA_KEY_ALG_HASH ||
|
||||||
|
key_info->algorithm == HA_KEY_ALG_LONG_HASH)
|
||||||
|
packet->append(STRING_WITH_LEN(" USING HASH"));
|
||||||
|
|
||||||
|
if ((key_info->flags & HA_USES_BLOCK_SIZE) &&
|
||||||
|
share->key_block_size != key_info->block_size)
|
||||||
|
{
|
||||||
|
packet->append(STRING_WITH_LEN(" KEY_BLOCK_SIZE="));
|
||||||
|
packet->append_ulonglong(key_info->block_size);
|
||||||
|
}
|
||||||
|
DBUG_ASSERT(MY_TEST(key_info->flags & HA_USES_COMMENT) ==
|
||||||
|
(key_info->comment.length > 0));
|
||||||
|
if (key_info->flags & HA_USES_COMMENT)
|
||||||
|
{
|
||||||
|
packet->append(STRING_WITH_LEN(" COMMENT "));
|
||||||
|
append_unescaped(packet, key_info->comment.str,
|
||||||
|
key_info->comment.length);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (key_info->is_ignored)
|
||||||
|
packet->append(STRING_WITH_LEN(" IGNORED"));
|
||||||
|
|
||||||
if (key_info->parser)
|
if (key_info->parser)
|
||||||
{
|
{
|
||||||
LEX_CSTRING *parser_name= plugin_name(key_info->parser);
|
LEX_CSTRING *parser_name= plugin_name(key_info->parser);
|
||||||
packet->append(STRING_WITH_LEN(" /*!50100 WITH PARSER "));
|
packet->append(STRING_WITH_LEN(" WITH PARSER "));
|
||||||
append_identifier(thd, packet, parser_name);
|
append_identifier(thd, packet, parser_name);
|
||||||
packet->append(STRING_WITH_LEN(" */ "));
|
|
||||||
}
|
}
|
||||||
append_create_options(thd, packet, key_info->option_list, check_options,
|
append_create_options(thd, packet, key_info->option_list, check_options,
|
||||||
(key_info->algorithm == HA_KEY_ALG_VECTOR
|
(key_info->algorithm == HA_KEY_ALG_VECTOR
|
||||||
? mhnsw_index_options : hton->index_options));
|
? mhnsw_index_options : hton->index_options));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (table->versioned())
|
if (table->versioned())
|
||||||
{
|
{
|
||||||
@@ -2611,51 +2633,6 @@ int show_create_table_ex(THD *thd, TABLE_LIST *table_list,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void store_key_options(THD *thd, String *packet, TABLE_SHARE *share,
|
|
||||||
KEY *key_info)
|
|
||||||
{
|
|
||||||
bool limited_mysql_mode= (thd->variables.sql_mode &
|
|
||||||
(MODE_NO_FIELD_OPTIONS | MODE_MYSQL323 |
|
|
||||||
MODE_MYSQL40)) != 0;
|
|
||||||
bool foreign_db_mode= (thd->variables.sql_mode & (MODE_POSTGRESQL |
|
|
||||||
MODE_ORACLE |
|
|
||||||
MODE_MSSQL |
|
|
||||||
MODE_DB2 |
|
|
||||||
MODE_MAXDB |
|
|
||||||
MODE_ANSI)) != 0;
|
|
||||||
|
|
||||||
if (!(thd->variables.sql_mode & MODE_NO_KEY_OPTIONS) &&
|
|
||||||
!limited_mysql_mode && !foreign_db_mode)
|
|
||||||
{
|
|
||||||
|
|
||||||
if (key_info->algorithm == HA_KEY_ALG_BTREE)
|
|
||||||
packet->append(STRING_WITH_LEN(" USING BTREE"));
|
|
||||||
|
|
||||||
if (key_info->algorithm == HA_KEY_ALG_HASH ||
|
|
||||||
key_info->algorithm == HA_KEY_ALG_LONG_HASH)
|
|
||||||
packet->append(STRING_WITH_LEN(" USING HASH"));
|
|
||||||
|
|
||||||
if ((key_info->flags & HA_USES_BLOCK_SIZE) &&
|
|
||||||
share->key_block_size != key_info->block_size)
|
|
||||||
{
|
|
||||||
packet->append(STRING_WITH_LEN(" KEY_BLOCK_SIZE="));
|
|
||||||
packet->append_ulonglong(key_info->block_size);
|
|
||||||
}
|
|
||||||
DBUG_ASSERT(MY_TEST(key_info->flags & HA_USES_COMMENT) ==
|
|
||||||
(key_info->comment.length > 0));
|
|
||||||
if (key_info->flags & HA_USES_COMMENT)
|
|
||||||
{
|
|
||||||
packet->append(STRING_WITH_LEN(" COMMENT "));
|
|
||||||
append_unescaped(packet, key_info->comment.str,
|
|
||||||
key_info->comment.length);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (key_info->is_ignored)
|
|
||||||
packet->append(STRING_WITH_LEN(" IGNORED"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void view_store_options(THD *thd, TABLE_LIST *table, String *buff)
|
void view_store_options(THD *thd, TABLE_LIST *table, String *buff)
|
||||||
{
|
{
|
||||||
if (table->algorithm != VIEW_ALGORITHM_INHERIT)
|
if (table->algorithm != VIEW_ALGORITHM_INHERIT)
|
||||||
|
Reference in New Issue
Block a user