Server IP : 104.21.38.3 / Your IP : 172.71.81.216 Web Server : Apache System : Linux krdc-ubuntu-s-2vcpu-4gb-amd-blr1-01.localdomain 5.15.0-142-generic #152-Ubuntu SMP Mon May 19 10:54:31 UTC 2025 x86_64 User : www ( 1000) PHP Version : 7.4.33 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /www/server/mysql/src/mysql-test/suite/innodb/t/ |
Upload File : |
# This is the test for bug #47621, column rename operation should # not result in column definition inconsistency between MySQL and # InnoDB --source include/have_innodb.inc CREATE TABLE bug47621 (salesperson INT) ENGINE=InnoDB; # Change the column name ALTER TABLE bug47621 CHANGE salesperson sales_acct_id INT; # If there is inconsistency of column name definition # in MySQL or InnoDB, following create index would fail create index orgs on bug47621(sales_acct_id); # Change the column name back with the index defined on it. ALTER TABLE bug47621 CHANGE sales_acct_id salesperson INT; drop table bug47621; CREATE TABLE bug47621_sale ( salesperson INT, PRIMARY KEY(salesperson)) engine = innodb; CREATE TABLE bug47621_shirt( id SMALLINT, owner INT, FOREIGN KEY(owner) references bug47621_sale(salesperson) ON DELETE RESTRICT) engine = innodb; insert into bug47621_sale values(9); insert into bug47621_shirt values(1, 9); # Any rename operation on columns involved in a reference constraint will # fail, as it will be rejected by InnoDB row_rename_table_for_mysql(). # In above example, any rename on column "salesperson" for table # "bug47621_sale", or on column "owner" for table "bug47621_shirt will # be blocked. We do not put such rename in the test since InnoDB error # message will be printed in the error log, and result in test failure. # # ALTER TABLE bug47621_sale CHANGE salesperson sales_acct_id INT; # Any rename on columns not involved in the foreign key constraint # could still proceed ALTER TABLE bug47621_shirt CHANGE id new_id INT; # Referencing table dropped, the rename operation on related columns # could proceed drop table bug47621_shirt; ALTER TABLE bug47621_sale CHANGE salesperson sales_acct_id INT; ALTER TABLE bug47621_sale ADD INDEX idx (sales_acct_id); drop table bug47621_sale;