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;
|
set sql_mode= default;
|
||||||
show table status;
|
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
|
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,
|
t1 MyISAM 10 Fixed 0 0 0 0 2048 0 NULL X X NULL latin1_swedish_ci NULL partitioned
|
||||||
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
|
|
||||||
drop table t1;
|
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';
|
set sql_mode='ansi_quotes';
|
||||||
alter table t1 add partition (partition p1 values less than (10));
|
alter table t1 add partition (partition p1 values less than (10));
|
||||||
set sql_mode= default;
|
set sql_mode= default;
|
||||||
|
--replace_column 12 X 13 X
|
||||||
show table status;
|
show table status;
|
||||||
drop table t1;
|
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;
|
m_part_info->key_algorithm= partition_info::KEY_ALGORITHM_51;
|
||||||
if (skip_generation ||
|
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,
|
&part_buf_len,
|
||||||
true,
|
NULL, NULL)) ||
|
||||||
NULL,
|
|
||||||
NULL)) ||
|
|
||||||
print_admin_msg(thd, SQL_ADMIN_MSG_TEXT_SIZE + 1, "error",
|
print_admin_msg(thd, SQL_ADMIN_MSG_TEXT_SIZE + 1, "error",
|
||||||
table_share->db.str,
|
table_share->db.str,
|
||||||
table->alias,
|
table->alias,
|
||||||
|
@ -2219,6 +2219,18 @@ static int add_key_with_algorithm(String *str, partition_info *part_info)
|
|||||||
return err;
|
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.
|
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,
|
bool show_partition_options,
|
||||||
HA_CREATE_INFO *create_info,
|
HA_CREATE_INFO *create_info,
|
||||||
Alter_info *alter_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,
|
bool verify_data_with_partition(TABLE *table, TABLE *part_table,
|
||||||
uint32 part_id);
|
uint32 part_id);
|
||||||
bool compare_partition_options(HA_CREATE_INFO *table_create_info,
|
bool compare_partition_options(HA_CREATE_INFO *table_create_info,
|
||||||
|
@ -30,7 +30,6 @@
|
|||||||
#include "strfunc.h" // find_type2, find_set
|
#include "strfunc.h" // find_type2, find_set
|
||||||
#include "sql_truncate.h" // regenerate_locked_table
|
#include "sql_truncate.h" // regenerate_locked_table
|
||||||
#include "sql_partition.h" // mem_alloc_error,
|
#include "sql_partition.h" // mem_alloc_error,
|
||||||
// generate_partition_syntax,
|
|
||||||
// partition_info
|
// partition_info
|
||||||
// NOT_A_PARTITION_ID
|
// NOT_A_PARTITION_ID
|
||||||
#include "sql_db.h" // load_db_opt_by_name
|
#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;
|
partition_info *part_info= lpt->table->part_info;
|
||||||
if (part_info)
|
if (part_info)
|
||||||
{
|
{
|
||||||
if (!(part_syntax_buf= generate_partition_syntax(lpt->thd, part_info,
|
part_syntax_buf= generate_partition_syntax_for_frm(lpt->thd, part_info,
|
||||||
&syntax_len, TRUE,
|
&syntax_len, lpt->create_info, lpt->alter_info);
|
||||||
lpt->create_info,
|
if (!part_syntax_buf)
|
||||||
lpt->alter_info)))
|
|
||||||
{
|
|
||||||
DBUG_RETURN(TRUE);
|
DBUG_RETURN(TRUE);
|
||||||
}
|
|
||||||
part_info->part_info_string= part_syntax_buf;
|
part_info->part_info_string= part_syntax_buf;
|
||||||
part_info->part_info_len= syntax_len;
|
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;
|
TABLE_SHARE *share= lpt->table->s;
|
||||||
char *tmp_part_syntax_str;
|
char *tmp_part_syntax_str;
|
||||||
if (!(part_syntax_buf= generate_partition_syntax(lpt->thd, part_info,
|
part_syntax_buf= generate_partition_syntax_for_frm(lpt->thd,
|
||||||
&syntax_len, TRUE,
|
part_info, &syntax_len, lpt->create_info, lpt->alter_info);
|
||||||
lpt->create_info,
|
if (!part_syntax_buf)
|
||||||
lpt->alter_info)))
|
|
||||||
{
|
{
|
||||||
error= 1;
|
error= 1;
|
||||||
goto err;
|
goto err;
|
||||||
@ -4564,11 +4559,8 @@ handler *mysql_create_frm_image(THD *thd,
|
|||||||
We reverse the partitioning parser and generate a standard format
|
We reverse the partitioning parser and generate a standard format
|
||||||
for syntax stored in frm file.
|
for syntax stored in frm file.
|
||||||
*/
|
*/
|
||||||
sql_mode_t old_mode= thd->variables.sql_mode;
|
part_syntax_buf= generate_partition_syntax_for_frm(thd, part_info,
|
||||||
thd->variables.sql_mode &= ~MODE_ANSI_QUOTES;
|
&syntax_len, create_info, alter_info);
|
||||||
part_syntax_buf= generate_partition_syntax(thd, part_info, &syntax_len,
|
|
||||||
true, create_info, alter_info);
|
|
||||||
thd->variables.sql_mode= old_mode;
|
|
||||||
if (!part_syntax_buf)
|
if (!part_syntax_buf)
|
||||||
goto err;
|
goto err;
|
||||||
part_info->part_info_string= part_syntax_buf;
|
part_info->part_info_string= part_syntax_buf;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user