Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
c228bd41
Commit
c228bd41
authored
Apr 06, 2006
by
ingo@mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge mysql.com:/home/mydev/mysql-5.1-bug18477
into mysql.com:/home/mydev/mysql-5.1-aid
parents
26f1663d
7253099c
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
63 additions
and
5 deletions
+63
-5
mysql-test/r/innodb.result
mysql-test/r/innodb.result
+32
-3
mysql-test/t/innodb.test
mysql-test/t/innodb.test
+25
-0
sql/sql_lex.h
sql/sql_lex.h
+1
-0
sql/sql_table.cc
sql/sql_table.cc
+1
-1
sql/sql_yacc.yy
sql/sql_yacc.yy
+4
-1
No files found.
mysql-test/r/innodb.result
View file @
c228bd41
...
...
@@ -3133,9 +3133,7 @@ SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`a` int(11) DEFAULT NULL,
KEY `t2_ibfk_0` (`a`),
CONSTRAINT `t2_ibfk_0` FOREIGN KEY (`a`) REFERENCES `t1` (`a`),
CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`)
KEY `t2_ibfk_0` (`a`)
)
ENGINE=InnoDB DEFAULT CHARSET=latin1
DROP TABLE t2,t1;
create table t1(a int not null, b int, c int, d int, primary key(a)) engine=innodb;
...
...
@@ -3214,3 +3212,34 @@ UPDATE t1 SET field1 = 'other' WHERE field2 = 'somevalu';
ERROR 23000: Upholding foreign key constraints for table 't1', entry 'other-somevalu', key 1 would lead to a duplicate entry
DROP TABLE t2;
DROP TABLE t1;
create table t1 (
c1 bigint not null,
c2 bigint not null,
primary key (c1),
unique key (c2)
)
engine=innodb;
create table t2 (
c1 bigint not null,
primary key (c1)
)
engine=innodb;
alter table t1 add constraint c2_fk foreign key (c2)
references t2(c1) on delete cascade;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` bigint(20) NOT NULL,
`c2` bigint(20) NOT NULL,
PRIMARY KEY (`c1`),
UNIQUE KEY `c2` (`c2`),
CONSTRAINT `c2_fk` FOREIGN KEY (`c2`) REFERENCES `t2` (`c1`) ON DELETE CASCADE
)
ENGINE=InnoDB DEFAULT CHARSET=latin1
alter table t1 drop foreign key c2_fk;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` bigint(20) NOT NULL,
`c2` bigint(20) NOT NULL,
PRIMARY KEY (`c1`),
UNIQUE KEY `c2` (`c2`)
)
ENGINE=InnoDB DEFAULT CHARSET=latin1
drop table t1, t2;
mysql-test/t/innodb.test
View file @
c228bd41
...
...
@@ -2113,3 +2113,28 @@ UPDATE t1 SET field1 = 'other' WHERE field2 = 'somevalu';
DROP
TABLE
t2
;
DROP
TABLE
t1
;
#
# Bug#18477 - MySQL/InnoDB Ignoring Foreign Keys in ALTER TABLE
#
create
table
t1
(
c1
bigint
not
null
,
c2
bigint
not
null
,
primary
key
(
c1
),
unique
key
(
c2
)
)
engine
=
innodb
;
#
create
table
t2
(
c1
bigint
not
null
,
primary
key
(
c1
)
)
engine
=
innodb
;
#
alter
table
t1
add
constraint
c2_fk
foreign
key
(
c2
)
references
t2
(
c1
)
on
delete
cascade
;
show
create
table
t1
;
#
alter
table
t1
drop
foreign
key
c2_fk
;
show
create
table
t1
;
#
drop
table
t1
,
t2
;
sql/sql_lex.h
View file @
c228bd41
...
...
@@ -706,6 +706,7 @@ typedef class st_select_lex SELECT_LEX;
#define ALTER_CHECK_PARTITION (1L << 23)
#define ALTER_REPAIR_PARTITION (1L << 24)
#define ALTER_REMOVE_PARTITIONING (1L << 25)
#define ALTER_FOREIGN_KEY (1L << 26)
typedef
struct
st_alter_info
{
...
...
sql/sql_table.cc
View file @
c228bd41
...
...
@@ -3796,7 +3796,7 @@ static uint compare_tables(TABLE *table, List<create_field> *create_list,
create_info
->
used_fields
&
HA_CREATE_USED_ENGINE
||
create_info
->
used_fields
&
HA_CREATE_USED_CHARSET
||
create_info
->
used_fields
&
HA_CREATE_USED_DEFAULT_CHARSET
||
(
alter_info
->
flags
&
ALTER_RECREATE
)
||
(
alter_info
->
flags
&
(
ALTER_RECREATE
|
ALTER_FOREIGN_KEY
)
)
||
order_num
)
DBUG_RETURN
(
ALTER_TABLE_DATA_CHANGED
);
...
...
sql/sql_yacc.yy
View file @
c228bd41
...
...
@@ -4167,6 +4167,9 @@ key_def:
HA_KEY_ALG_UNDEF, 1,
lex->col_list));
lex->col_list.empty(); /* Alloced by sql_alloc */
/* Only used for ALTER TABLE. Ignored otherwise. */
lex->alter_info.flags|= ALTER_FOREIGN_KEY;
}
| constraint opt_check_constraint
{
...
...
@@ -5137,7 +5140,7 @@ alter_list_item:
}
| DROP FOREIGN KEY_SYM opt_ident
{
Lex->alter_info.flags|= ALTER_DROP_INDEX;
Lex->alter_info.flags|= ALTER_DROP_INDEX
| ALTER_FOREIGN_KEY
;
}
| DROP PRIMARY_SYM KEY_SYM
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment