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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
646d6925
Commit
646d6925
authored
Jan 13, 2004
by
ram@gw.mysql.r18.ru
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
a fix (bug #2361: ALTER TABLE ... DROP PRIMARY KEY drops a non-primary key).
parent
6fd6a9a7
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
3 deletions
+23
-3
mysql-test/r/alter_table.result
mysql-test/r/alter_table.result
+9
-0
mysql-test/t/alter_table.test
mysql-test/t/alter_table.test
+9
-0
sql/sql_table.cc
sql/sql_table.cc
+5
-3
No files found.
mysql-test/r/alter_table.result
View file @
646d6925
...
...
@@ -412,3 +412,12 @@ t1 0 PRIMARY 1 Host A NULL NULL NULL BTREE
t1 0 PRIMARY 2 User A 0 NULL NULL BTREE
t1 1 Host 1 Host A NULL NULL NULL BTREE disabled
DROP TABLE t1;
CREATE TABLE t1 (a int UNIQUE);
ALTER TABLE t1 DROP PRIMARY KEY;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) default NULL,
UNIQUE KEY `a` (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
mysql-test/t/alter_table.test
View file @
646d6925
...
...
@@ -244,3 +244,12 @@ LOCK TABLES t1 WRITE;
ALTER
TABLE
t1
DISABLE
KEYS
;
SHOW
INDEX
FROM
t1
;
DROP
TABLE
t1
;
#
# Bug 2361
#
CREATE
TABLE
t1
(
a
int
UNIQUE
);
ALTER
TABLE
t1
DROP
PRIMARY
KEY
;
SHOW
CREATE
TABLE
t1
;
DROP
TABLE
t1
;
sql/sql_table.cc
View file @
646d6925
...
...
@@ -2242,13 +2242,15 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
KEY
*
key_info
=
table
->
key_info
;
for
(
uint
i
=
0
;
i
<
table
->
keys
;
i
++
,
key_info
++
)
{
if
(
drop_primary
&&
(
key_info
->
flags
&
HA_NOSAME
))
char
*
key_name
=
key_info
->
name
;
if
(
drop_primary
&&
!
my_strcasecmp
(
system_charset_info
,
key_name
,
"PRIMARY"
))
{
drop_primary
=
0
;
drop_primary
=
0
;
continue
;
}
char
*
key_name
=
key_info
->
name
;
Alter_drop
*
drop
;
drop_it
.
rewind
();
while
((
drop
=
drop_it
++
))
...
...
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