MDEV-13089 identifier quoting in partitioning
cover ALTER TABLE
This commit is contained in:
parent
e4b466aa3d
commit
e7d152293d
@ -109,9 +109,5 @@ alter table t1 add partition (partition p1 values less than (10));
|
||||
set sql_mode= default;
|
||||
show table status;
|
||||
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
|
||||
t1 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '"p0" VALUES LESS THAN (5) ENGINE = MyISAM,
|
||||
PARTITION "p1" VALUES LESS THAN (10)' at line 2
|
||||
Warnings:
|
||||
Warning 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '"p0" VALUES LESS THAN (5) ENGINE = MyISAM,
|
||||
PARTITION "p1" VALUES LESS THAN (10)' at line 2
|
||||
t1 MyISAM 10 Fixed 0 0 0 0 2048 0 NULL X X NULL latin1_swedish_ci NULL partitioned
|
||||
drop table t1;
|
||||
|
@ -47,5 +47,6 @@ create table t1 (a int) partition by range(a) (partition p0 values less than (5)
|
||||
set sql_mode='ansi_quotes';
|
||||
alter table t1 add partition (partition p1 values less than (10));
|
||||
set sql_mode= default;
|
||||
--replace_column 12 X 13 X
|
||||
show table status;
|
||||
drop table t1;
|
||||
|
@ -9092,11 +9092,9 @@ int ha_partition::check_for_upgrade(HA_CHECK_OPT *check_opt)
|
||||
}
|
||||
m_part_info->key_algorithm= partition_info::KEY_ALGORITHM_51;
|
||||
if (skip_generation ||
|
||||
!(part_buf= generate_partition_syntax(thd, m_part_info,
|
||||
!(part_buf= generate_partition_syntax_for_frm(thd, m_part_info,
|
||||
&part_buf_len,
|
||||
true,
|
||||
NULL,
|
||||
NULL)) ||
|
||||
NULL, NULL)) ||
|
||||
print_admin_msg(thd, SQL_ADMIN_MSG_TEXT_SIZE + 1, "error",
|
||||
table_share->db.str,
|
||||
table->alias,
|
||||
|
@ -2219,6 +2219,18 @@ static int add_key_with_algorithm(String *str, partition_info *part_info)
|
||||
return err;
|
||||
}
|
||||
|
||||
char *generate_partition_syntax_for_frm(THD *thd, partition_info *part_info,
|
||||
uint *buf_length,
|
||||
HA_CREATE_INFO *create_info,
|
||||
Alter_info *alter_info)
|
||||
{
|
||||
sql_mode_t old_mode= thd->variables.sql_mode;
|
||||
thd->variables.sql_mode &= ~MODE_ANSI_QUOTES;
|
||||
char *res= generate_partition_syntax(thd, part_info, buf_length,
|
||||
true, create_info, alter_info);
|
||||
thd->variables.sql_mode= old_mode;
|
||||
return res;
|
||||
}
|
||||
|
||||
/*
|
||||
Generate the partition syntax from the partition data structure.
|
||||
|
@ -272,6 +272,10 @@ char *generate_partition_syntax(THD *thd, partition_info *part_info,
|
||||
bool show_partition_options,
|
||||
HA_CREATE_INFO *create_info,
|
||||
Alter_info *alter_info);
|
||||
char *generate_partition_syntax_for_frm(THD *thd, partition_info *part_info,
|
||||
uint *buf_length,
|
||||
HA_CREATE_INFO *create_info,
|
||||
Alter_info *alter_info);
|
||||
bool verify_data_with_partition(TABLE *table, TABLE *part_table,
|
||||
uint32 part_id);
|
||||
bool compare_partition_options(HA_CREATE_INFO *table_create_info,
|
||||
|
@ -30,7 +30,6 @@
|
||||
#include "strfunc.h" // find_type2, find_set
|
||||
#include "sql_truncate.h" // regenerate_locked_table
|
||||
#include "sql_partition.h" // mem_alloc_error,
|
||||
// generate_partition_syntax,
|
||||
// partition_info
|
||||
// NOT_A_PARTITION_ID
|
||||
#include "sql_db.h" // load_db_opt_by_name
|
||||
@ -1820,13 +1819,10 @@ bool mysql_write_frm(ALTER_PARTITION_PARAM_TYPE *lpt, uint flags)
|
||||
partition_info *part_info= lpt->table->part_info;
|
||||
if (part_info)
|
||||
{
|
||||
if (!(part_syntax_buf= generate_partition_syntax(lpt->thd, part_info,
|
||||
&syntax_len, TRUE,
|
||||
lpt->create_info,
|
||||
lpt->alter_info)))
|
||||
{
|
||||
part_syntax_buf= generate_partition_syntax_for_frm(lpt->thd, part_info,
|
||||
&syntax_len, lpt->create_info, lpt->alter_info);
|
||||
if (!part_syntax_buf)
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
part_info->part_info_string= part_syntax_buf;
|
||||
part_info->part_info_len= syntax_len;
|
||||
}
|
||||
@ -1902,10 +1898,9 @@ bool mysql_write_frm(ALTER_PARTITION_PARAM_TYPE *lpt, uint flags)
|
||||
{
|
||||
TABLE_SHARE *share= lpt->table->s;
|
||||
char *tmp_part_syntax_str;
|
||||
if (!(part_syntax_buf= generate_partition_syntax(lpt->thd, part_info,
|
||||
&syntax_len, TRUE,
|
||||
lpt->create_info,
|
||||
lpt->alter_info)))
|
||||
part_syntax_buf= generate_partition_syntax_for_frm(lpt->thd,
|
||||
part_info, &syntax_len, lpt->create_info, lpt->alter_info);
|
||||
if (!part_syntax_buf)
|
||||
{
|
||||
error= 1;
|
||||
goto err;
|
||||
@ -4564,11 +4559,8 @@ handler *mysql_create_frm_image(THD *thd,
|
||||
We reverse the partitioning parser and generate a standard format
|
||||
for syntax stored in frm file.
|
||||
*/
|
||||
sql_mode_t old_mode= thd->variables.sql_mode;
|
||||
thd->variables.sql_mode &= ~MODE_ANSI_QUOTES;
|
||||
part_syntax_buf= generate_partition_syntax(thd, part_info, &syntax_len,
|
||||
true, create_info, alter_info);
|
||||
thd->variables.sql_mode= old_mode;
|
||||
part_syntax_buf= generate_partition_syntax_for_frm(thd, part_info,
|
||||
&syntax_len, create_info, alter_info);
|
||||
if (!part_syntax_buf)
|
||||
goto err;
|
||||
part_info->part_info_string= part_syntax_buf;
|
||||
|
Loading…
x
Reference in New Issue
Block a user