midenok / mariadb

MariaDB server is a community developed fork of MySQL server. Started by core members of the original MySQL team, MariaDB actively works with outside developers to deliver the most featureful, stable, and sanely licensed open SQL server in the industry.
GNU General Public License v2.0
0 stars 0 forks source link

MDEV-16290 ALTER TABLE ... RENAME COLUMN syntax #69

Closed midenok closed 4 years ago

midenok commented 4 years ago

Good

1. create_list incremented

#0  0x0000000000747df3 in base_list::push_back (this=0x7f9d00006518, info=0x7f9d000293e0, mem_root=0x7f9d00006830) at /home/midenok/src/mariadb/10.5/src/sql/sql_list.h:198
#1  0x000000000086b9e0 in List<Create_field>::push_back (this=0x7f9d00006518, a=0x7f9d000293e0, mem_root=0x7f9d00006830) at /home/midenok/src/mariadb/10.5/src/sql/sql_list.h:505
#2  0x0000000000b8e44d in MYSQLparse (thd=0x7f9d00000d38) at /home/midenok/src/mariadb/10.5/src/sql/sql_yacc.yy:5952
#3  0x00000000008c796d in parse_sql (thd=0x7f9d00000d38, parser_state=0x7f9d281a95c0, creation_ctx=0x0, do_pfs_digest=true) at /home/midenok/src/mariadb/10.5/src/sql/sql_parse.cc:10224
#4  0x00000000008b10d6 in mysql_parse (thd=0x7f9d00000d38, rawbuf=0x7f9d00076830 "ALTER TABLE t_gen CHANGE COLUMN c x INT", length=39, parser_state=0x7f9d281a95c0, is_com_multi=false, is_next_command=false) at /home/midenok/src/mariadb/10.5/src/sql/sql_parse.cc:7871
5926    field_spec:
5927              field_ident
5928              {
5929                LEX *lex=Lex;
5930                Create_field *f= new (thd->mem_root) Create_field();
5931
5932                if (unlikely(check_string_char_length(&$1, 0, NAME_CHAR_LEN,
5933                                                      system_charset_info, 1)))
5934                  my_yyabort_error((ER_TOO_LONG_IDENT, MYF(0), $1.str));
5935
5936                if (unlikely(!f))
5937                  MYSQL_YYABORT;
5938
5939                lex->init_last_field(f, &$1, NULL);
5940                $<create_field>$= f;
5941              }
5942              field_type_or_serial opt_check_constraint
5943              {
5944                LEX *lex=Lex;
5945                $$= $<create_field>2;
5946
5947                $$->check_constraint= $4;
5948
5949                if (unlikely($$->check(thd)))
5950                  MYSQL_YYABORT;
5951
5952                lex->alter_info.create_list.push_back($$, thd->mem_root);

2. create_list checked

#0  Item_field::rename_fields_processor (this=0x7f9d000289a0, arg=0x7f9d281a3750) at /home/midenok/src/mariadb/10.5/src/sql/item.cc:791
#1  0x0000000000758799 in Item::walk (this=0x7f9d000289a0, processor=&virtual table offset 1048, walk_subquery=true, arg=0x7f9d281a3750) at /home/midenok/src/mariadb/10.5/src/sql/item.h:1840
#2  0x000000000080aeae in Item_args::walk_args (this=0x7f9d000e59a8, processor=&virtual table offset 1048, walk_subquery=true, arg=0x7f9d281a3750) at /home/midenok/src/mariadb/10.5/src/sql/item.h:2513
#3  0x0000000000809d5e in Item_func_or_sum::walk (this=0x7f9d000e5910, processor=&virtual table offset 1048, walk_subquery=true, arg=0x7f9d281a3750) at /home/midenok/src/mariadb/10.5/src/sql/item.h:5062
#4  0x00000000009c2115 in mysql_prepare_alter_table (thd=0x7f9d00000d38, table=0x7f9d000f29f8, create_info=0x7f9d281a6fc8, alter_info=0x7f9d281a6ee0, alter_ctx=0x7f9d281a5b98) at /home/midenok/src/mariadb/10.5/src/sql/sql_table.cc:8148
#5  0x00000000009c7d2e in mysql_alter_table (thd=0x7f9d00000d38, new_db=0x7f9d00005540, new_name=0x7f9d000059d0, create_info=0x7f9d281a6fc8, table_list=0x7f9d000c4c40, alter_info=0x7f9d281a6ee0, order_num=0, order=0x0, ignore=false) at /home/midenok/src/mariadb/10.5/src/sql/sql_table.cc:9848
#6  0x0000000000a8a461 in Sql_cmd_alter_table::execute (this=0x7f9d000c0500, thd=0x7f9d00000d38) at /home/midenok/src/mariadb/10.5/src/sql/sql_alter.cc:517
#7  0x00000000008c030a in mysql_execute_command (thd=0x7f9d00000d38) at /home/midenok/src/mariadb/10.5/src/sql/sql_parse.cc:5878
#8  0x00000000008b1306 in mysql_parse (thd=0x7f9d00000d38, rawbuf=0x7f9d00076830 "ALTER TABLE t_gen CHANGE COLUMN c x INT", length=39, parser_state=0x7f9d281a95c0, is_com_multi=false, is_next_command=false) at /home/midenok/src/mariadb/10.5/src/sql/sql_parse.cc:7918
782       while ((def=def_it++))
783       {
784         if (def->change.str &&
785             (!db_name.str || !db_name.str[0] ||
786              !my_strcasecmp(table_alias_charset, db_name.str, rename->db_name.str)) &&
787             (!table_name.str || !table_name.str[0] ||
788              !my_strcasecmp(table_alias_charset, table_name.str, rename->table_name.str)) &&
789             !my_strcasecmp(system_charset_info, field_name.str, def->change.str))
790         {
791           field_name= def->field_name;
792           break;
793         }
794       }
midenok commented 4 years ago

MDEV-7318 RENAME INDEX

Tests related:

innodb.innodb \
innodb.innodb-index-online-fk \
innodb.innodb-alter \
innodb.alter_candidate_key \
main.mysql_upgrade-20228 \
innodb.instant_alter_crash \
innodb.instant_alter_index_rename \
main.alter_table